mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-20 19:03:39 +00:00
294 lines
11 KiB
Diff
294 lines
11 KiB
Diff
From 70ab6ca18864d0511e2f6cf3039c9160e592d8df Mon Sep 17 00:00:00 2001
|
|
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
|
|
Date: Tue, 29 Nov 2022 16:12:26 +0530
|
|
Subject: [PATCH 1/2] ath12k: refactor vdev configuration related functions
|
|
|
|
During vdev start_restart, currently, there are operations
|
|
which needs to performed even if multi-vdev restart
|
|
optimization is in place. For example, after starting the
|
|
vdev, setting the Tx beamforming and setting non-HT duplicate
|
|
configruation for vdev.
|
|
|
|
Similarly, after channel update, restarting the internal monitor
|
|
vdev and handling AWGN related data.
|
|
|
|
Refactor below functions so that they can be used even when
|
|
optimization is also there
|
|
- ath12k_mac_vdev_start_restart()
|
|
- ath12k_mac_update_vif_chan()
|
|
|
|
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
|
|
---
|
|
drivers/net/wireless/ath/ath12k/mac.c | 209 +++++++++++++++-----------
|
|
1 file changed, 125 insertions(+), 84 deletions(-)
|
|
|
|
--- a/drivers/net/wireless/ath/ath12k/mac.c
|
|
+++ b/drivers/net/wireless/ath/ath12k/mac.c
|
|
@@ -9668,6 +9668,55 @@ ath12k_mac_mlo_get_vdev_args(struct ath1
|
|
}
|
|
|
|
static int
|
|
+ath12k_mac_vdev_config_after_start(struct ath12k_link_vif *arvif,
|
|
+ const struct cfg80211_chan_def *chandef)
|
|
+{
|
|
+ struct ath12k_vif *ahvif = arvif->ahvif;
|
|
+ struct ath12k *ar = arvif->ar;
|
|
+ struct ath12k_base *ab = ar->ab;
|
|
+ int ret;
|
|
+
|
|
+ lockdep_assert_held(&ar->conf_mutex);
|
|
+
|
|
+ if (ar->supports_6ghz &&
|
|
+ chandef->chan->band == NL80211_BAND_6GHZ &&
|
|
+ (ahvif->vdev_type == WMI_VDEV_TYPE_STA || ahvif->vdev_type == WMI_VDEV_TYPE_AP) &&
|
|
+ test_bit(WMI_TLV_SERVICE_EXT_TPC_REG_SUPPORT, ar->ab->wmi_ab.svc_map)) {
|
|
+ ath12k_mac_fill_reg_tpc_info(ar, arvif, &arvif->chanctx);
|
|
+ ath12k_wmi_send_vdev_set_tpc_power(ar, arvif->vdev_id,
|
|
+ &arvif->reg_tpc_info);
|
|
+ }
|
|
+
|
|
+ /* Enable CAC Flag in the driver by checking the channel DFS cac time,
|
|
+ * i.e dfs_cac_ms value which will be valid only for radar channels
|
|
+ * and state as NL80211_DFS_USABLE which indicates CAC needs to be
|
|
+ * done before channel usage. This flags is used to drop rx packets.
|
|
+ * during CAC.
|
|
+ */
|
|
+ /* TODO Set the flag for other interface types as required */
|
|
+ if (ahvif->vdev_type == WMI_VDEV_TYPE_AP &&
|
|
+ chandef->chan->dfs_cac_ms &&
|
|
+ chandef->chan->dfs_state == NL80211_DFS_USABLE) {
|
|
+ set_bit(ATH12K_CAC_RUNNING, &ar->dev_flags);
|
|
+ ath12k_dbg(ab, ATH12K_DBG_MAC,
|
|
+ "CAC Started in chan_freq %d for vdev %d\n",
|
|
+ chandef->chan->center_freq, arvif->vdev_id);
|
|
+ }
|
|
+
|
|
+ ret = ath12k_mac_set_txbf_conf(arvif);
|
|
+ if (ret)
|
|
+ ath12k_warn(ab, "failed to set txbf conf for vdev %d: %d\n",
|
|
+ arvif->vdev_id, ret);
|
|
+
|
|
+ ret = ath12k_mac_set_6g_nonht_dup_conf(arvif, chandef);
|
|
+ if (ret)
|
|
+ ath12k_warn(ab, "failed to set 6G non-ht dup conf for vdev %d: %d\n",
|
|
+ arvif->vdev_id, ret);
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+
|
|
+static int
|
|
ath12k_mac_vdev_start_restart(struct ath12k_link_vif *arvif,
|
|
const struct cfg80211_chan_def *chandef,
|
|
bool restart, bool radar_enabled)
|
|
@@ -9756,44 +9805,15 @@ ath12k_mac_vdev_start_restart(struct ath
|
|
return ret;
|
|
}
|
|
|
|
- if (ar->supports_6ghz &&
|
|
- chandef->chan->band == NL80211_BAND_6GHZ &&
|
|
- (ahvif->vdev_type == WMI_VDEV_TYPE_STA || ahvif->vdev_type == WMI_VDEV_TYPE_AP) &&
|
|
- test_bit(WMI_TLV_SERVICE_EXT_TPC_REG_SUPPORT, ar->ab->wmi_ab.svc_map)) {
|
|
- ath12k_mac_fill_reg_tpc_info(ar, arvif, &arvif->chanctx);
|
|
- ath12k_wmi_send_vdev_set_tpc_power(ar, arvif->vdev_id,
|
|
- &arvif->reg_tpc_info);
|
|
- }
|
|
-
|
|
ar->num_started_vdevs++;
|
|
ath12k_dbg(ab, ATH12K_DBG_MAC, "vdev %pM started, vdev_id %d\n",
|
|
arvif->addr, arvif->vdev_id);
|
|
|
|
- /* Enable CAC Flag in the driver by checking the channel DFS cac time,
|
|
- * i.e dfs_cac_ms value which will be valid only for radar channels
|
|
- * and state as NL80211_DFS_USABLE which indicates CAC needs to be
|
|
- * done before channel usage. This flags is used to drop rx packets.
|
|
- * during CAC.
|
|
- */
|
|
- /* TODO Set the flag for other interface types as required */
|
|
- if (ahvif->vdev_type == WMI_VDEV_TYPE_AP &&
|
|
- chandef->chan->dfs_cac_ms &&
|
|
- chandef->chan->dfs_state == NL80211_DFS_USABLE) {
|
|
- set_bit(ATH12K_CAC_RUNNING, &ar->dev_flags);
|
|
- ath12k_dbg(ab, ATH12K_DBG_MAC,
|
|
- "CAC Started in chan_freq %d for vdev %d\n",
|
|
- arg.channel.freq, arg.vdev_id);
|
|
- }
|
|
-
|
|
- ret = ath12k_mac_set_txbf_conf(arvif);
|
|
+ ret = ath12k_mac_vdev_config_after_start(arvif, chandef);
|
|
if (ret)
|
|
- ath12k_warn(ab, "failed to set txbf conf for vdev %d: %d\n",
|
|
- arvif->vdev_id, ret);
|
|
-
|
|
- ret = ath12k_mac_set_6g_nonht_dup_conf(arvif, chandef);
|
|
- if (ret)
|
|
- ath12k_warn(ab, "failed to set 6G non-ht dup conf for vdev %d: %d\n",
|
|
- arvif->vdev_id, ret);
|
|
+ ath12k_warn(ab, "failed to configure vdev %d after %s: %d\n",
|
|
+ arvif->vdev_id,
|
|
+ restart ? "restart" : "start", ret);
|
|
|
|
return 0;
|
|
}
|
|
@@ -10162,6 +10182,67 @@ static void ath12k_mac_update_rx_channel
|
|
}
|
|
|
|
static void
|
|
+ath12k_mac_update_vif_chan_extras(struct ath12k *ar,
|
|
+ struct ieee80211_vif_chanctx_switch *vifs,
|
|
+ int n_vifs)
|
|
+{
|
|
+ struct ath12k_base *ab = ar->ab;
|
|
+ bool monitor_vif = false;
|
|
+ struct cfg80211_chan_def *chandef;
|
|
+ int i;
|
|
+
|
|
+ lockdep_assert_held(&ar->conf_mutex);
|
|
+
|
|
+ for (i = 0; i < n_vifs; i++) {
|
|
+ if (vifs[i].vif->type == NL80211_IFTYPE_MONITOR) {
|
|
+ monitor_vif = true;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ /* Restart the internal monitor vdev on new channel */
|
|
+ if (!monitor_vif &&
|
|
+ test_bit(MONITOR_VDEV_CREATED, &ar->monitor_flags)) {
|
|
+ if (!ath12k_mac_monitor_stop(ar))
|
|
+ ath12k_mac_monitor_start(ar);
|
|
+ }
|
|
+
|
|
+ chandef = &vifs[0].new_ctx->def;
|
|
+
|
|
+ spin_lock_bh(&ar->data_lock);
|
|
+ if (ar->awgn_intf_handling_in_prog && chandef) {
|
|
+ if (!ar->chan_bw_interference_bitmap ||
|
|
+ (ar->chan_bw_interference_bitmap & WMI_DCS_SEG_PRI20)) {
|
|
+ if (ar->awgn_chandef.chan->center_freq !=
|
|
+ chandef->chan->center_freq) {
|
|
+ ar->awgn_intf_handling_in_prog = false;
|
|
+ ath12k_dbg(ab, ATH12K_DBG_MAC,
|
|
+ "AWGN : channel switch completed\n");
|
|
+ } else {
|
|
+ ath12k_warn(ab, "AWGN : channel switch is not done, freq : %d\n",
|
|
+ ar->awgn_chandef.chan->center_freq);
|
|
+ }
|
|
+ } else {
|
|
+ if ((ar->awgn_chandef.chan->center_freq ==
|
|
+ chandef->chan->center_freq) &&
|
|
+ (ar->awgn_chandef.width != chandef->width)) {
|
|
+ ath12k_dbg(ab, ATH12K_DBG_MAC,
|
|
+ "AWGN : BW reduction is complete\n");
|
|
+ ar->awgn_intf_handling_in_prog = false;
|
|
+ } else {
|
|
+ ath12k_warn(ab, "AWGN : awgn_freq : %d chan_freq %d"
|
|
+ " awgn_width %d chan_width %d\n",
|
|
+ ar->awgn_chandef.chan->center_freq,
|
|
+ chandef->chan->center_freq,
|
|
+ ar->awgn_chandef.width,
|
|
+ chandef->width);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ spin_unlock_bh(&ar->data_lock);
|
|
+}
|
|
+
|
|
+static void
|
|
ath12k_mac_update_vif_chan(struct ath12k *ar,
|
|
struct ieee80211_vif_chanctx_switch *vifs,
|
|
int n_vifs)
|
|
@@ -10169,10 +10250,8 @@ ath12k_mac_update_vif_chan(struct ath12k
|
|
struct ath12k_base *ab = ar->ab;
|
|
struct ath12k_link_vif *arvif, *tx_arvif;
|
|
struct ath12k_vif *ahvif;
|
|
- struct cfg80211_chan_def *chandef = NULL;
|
|
int ret;
|
|
int i, trans_vdev_index;
|
|
- bool monitor_vif = false;
|
|
u64 vif_down_failed_map = 0;
|
|
struct ieee80211_vif *tx_vif;
|
|
|
|
@@ -10194,9 +10273,6 @@ ath12k_mac_update_vif_chan(struct ath12k
|
|
if (WARN_ON(!arvif))
|
|
continue;
|
|
|
|
- if (vifs[i].vif->type == NL80211_IFTYPE_MONITOR)
|
|
- monitor_vif = true;
|
|
-
|
|
ath12k_dbg(ab, ATH12K_DBG_MAC,
|
|
"mac chanctx switch vdev_id %i freq %u->%u width %d->%d\n",
|
|
arvif->vdev_id,
|
|
@@ -10205,7 +10281,7 @@ ath12k_mac_update_vif_chan(struct ath12k
|
|
vifs[i].old_ctx->def.width,
|
|
vifs[i].new_ctx->def.width);
|
|
|
|
- if (WARN_ON(!arvif->is_started)) {
|
|
+ if (!arvif->is_started) {
|
|
memcpy(&arvif->chanctx, vifs[i].new_ctx, sizeof(*vifs[i].new_ctx));
|
|
continue;
|
|
}
|
|
@@ -10230,8 +10306,6 @@ ath12k_mac_update_vif_chan(struct ath12k
|
|
}
|
|
}
|
|
|
|
- chandef = &vifs[0].new_ctx->def;
|
|
-
|
|
ath12k_mac_update_rx_channel(ar, NULL, vifs, n_vifs);
|
|
|
|
if (tx_arvif) {
|
|
@@ -10252,9 +10326,6 @@ ath12k_mac_update_vif_chan(struct ath12k
|
|
if (WARN_ON(!arvif))
|
|
continue;
|
|
|
|
- if (vifs[i].vif->type == NL80211_IFTYPE_MONITOR)
|
|
- monitor_vif = true;
|
|
-
|
|
if (ahvif->vif->mbssid_tx_vif &&
|
|
arvif == tx_arvif)
|
|
continue;
|
|
@@ -10269,43 +10340,7 @@ ath12k_mac_update_vif_chan(struct ath12k
|
|
}
|
|
}
|
|
|
|
- /* Restart the internal monitor vdev on new channel */
|
|
- if (!monitor_vif &&
|
|
- test_bit(MONITOR_VDEV_CREATED, &ar->monitor_flags)) {
|
|
- if (!ath12k_mac_monitor_stop(ar))
|
|
- ath12k_mac_monitor_start(ar);
|
|
- }
|
|
- spin_lock_bh(&ar->data_lock);
|
|
- if (ar->awgn_intf_handling_in_prog && chandef) {
|
|
- if (!ar->chan_bw_interference_bitmap ||
|
|
- (ar->chan_bw_interference_bitmap & WMI_DCS_SEG_PRI20)) {
|
|
- if (ar->awgn_chandef.chan->center_freq !=
|
|
- chandef->chan->center_freq) {
|
|
- ar->awgn_intf_handling_in_prog = false;
|
|
- ath12k_dbg(ab, ATH12K_DBG_MAC,
|
|
- "AWGN : channel switch completed\n");
|
|
- } else {
|
|
- ath12k_warn(ab, "AWGN : channel switch is not done, freq : %d\n",
|
|
- ar->awgn_chandef.chan->center_freq);
|
|
- }
|
|
- } else {
|
|
- if ((ar->awgn_chandef.chan->center_freq ==
|
|
- chandef->chan->center_freq) &&
|
|
- (ar->awgn_chandef.width != chandef->width)) {
|
|
- ath12k_dbg(ab, ATH12K_DBG_MAC,
|
|
- "AWGN : BW reduction is complete\n");
|
|
- ar->awgn_intf_handling_in_prog = false;
|
|
- } else {
|
|
- ath12k_warn(ab, "AWGN : awgn_freq : %d chan_freq %d"
|
|
- " awgn_width %d chan_width %d\n",
|
|
- ar->awgn_chandef.chan->center_freq,
|
|
- chandef->chan->center_freq,
|
|
- ar->awgn_chandef.width,
|
|
- chandef->width);
|
|
- }
|
|
- }
|
|
- }
|
|
- spin_unlock_bh(&ar->data_lock);
|
|
+ ath12k_mac_update_vif_chan_extras(ar, vifs, n_vifs);
|
|
}
|
|
|
|
static void
|