From e40b5cefe1b4558d8cdd9b8de4e09104043095b5 Mon Sep 17 00:00:00 2001 From: Aloka Dixit Date: Fri, 21 Jan 2022 10:47:04 -0800 Subject: [PATCH 07/14] ath12k: configure MBSSID device parameters Add new field nontransmitting_vif_count in struct ath12k_vif which keeps track of non-transmitting interfaces associated with a transmitting interface when MBSSID is enabled. The count is decremented when WMI vdev down is invoked and incremented when WMI vdev up is invoked. Use this field to set the profile index and total profile count during WMI vdev up operation. Signed-off-by: Aloka Dixit --- drivers/net/wireless/ath/ath12k/core.h | 1 + drivers/net/wireless/ath/ath12k/mac.c | 32 +++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -274,6 +274,7 @@ struct ath12k_vif { u8 tx_encap_type; u8 vdev_stats_id; struct ath12k_fw_vdev_ol_stats vdev_stats; + u8 nontransmitting_vif_count; }; struct ath12k_vif_iter { --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -1223,9 +1223,13 @@ static void ath12k_control_beaconing(str struct ieee80211_bss_conf *info) { struct ath12k *ar = arvif->ar; + struct ath12k_vif *tx_arvif = NULL; int ret = 0; struct vdev_up_params params = { 0 }; + if (arvif->vif->mbssid_tx_vif) + tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; + lockdep_assert_held(&arvif->ar->conf_mutex); if (!info->enable_beacon) { @@ -1235,6 +1239,9 @@ static void ath12k_control_beaconing(str arvif->vdev_id, ret); arvif->is_up = false; + if (tx_arvif) + tx_arvif->nontransmitting_vif_count = 0; + return; } @@ -1255,6 +1262,13 @@ static void ath12k_control_beaconing(str params.vdev_id = arvif->vdev_id; params.aid = arvif->aid; params.bssid = arvif->bssid; + if (tx_arvif) { + params.tx_bssid = tx_arvif->bssid; + params.profile_idx = info->bssid_index; + if (params.profile_idx >= tx_arvif->nontransmitting_vif_count) + tx_arvif->nontransmitting_vif_count = params.profile_idx; + params.profile_count = tx_arvif->nontransmitting_vif_count; + } ret = ath12k_wmi_vdev_up(arvif->ar, ¶ms); if (ret) { ath12k_warn(ar->ab, "failed to bring up vdev %d: %i\n", @@ -3010,7 +3024,7 @@ static void ath12k_bss_disassoc(struct i struct ieee80211_vif *vif) { struct ath12k *ar = hw->priv; - struct ath12k_vif *arvif = (void *)vif->drv_priv; + struct ath12k_vif *arvif = (void *)vif->drv_priv, *tx_arvif; int ret; lockdep_assert_held(&ar->conf_mutex); @@ -3024,6 +3038,11 @@ static void ath12k_bss_disassoc(struct i arvif->vdev_id, ret); arvif->is_up = false; + if (arvif->vif->mbssid_tx_vif) { + tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; + if (tx_arvif != arvif) + tx_arvif->nontransmitting_vif_count--; + } /* TODO: cancel connection_loss_work */ } @@ -3593,7 +3612,8 @@ static void ath12k_mac_op_bss_info_chang arvif->vdev_id, info->he_bss_color.color, ATH12K_BSS_COLOR_AP_PERIODS, - info->he_bss_color.enabled); + arvif->vif->bss_conf.nontransmitted ? + 0 : info->he_bss_color.enabled); if (ret) ath12k_warn(ar->ab, "failed to set bss color collision on vdev %i: %d\n", arvif->vdev_id, ret); @@ -6979,7 +6999,7 @@ ath12k_mac_update_vif_chan(struct ath12k int n_vifs) { struct ath12k_base *ab = ar->ab; - struct ath12k_vif *arvif; + struct ath12k_vif *arvif, *tx_arvif; int ret; int i; bool monitor_vif = false; @@ -7046,6 +7066,12 @@ ath12k_mac_update_vif_chan(struct ath12k params.vdev_id = arvif->vdev_id; params.aid = arvif->aid; params.bssid = arvif->bssid; + if (arvif->vif->mbssid_tx_vif) { + tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; + params.tx_bssid = tx_arvif->bssid; + params.profile_idx = arvif->vif->bss_conf.bssid_index; + params.profile_count = tx_arvif->nontransmitting_vif_count; + } ret = ath12k_wmi_vdev_up(arvif->ar, ¶ms); if (ret) { ath12k_warn(ab, "failed to bring vdev up %d: %d\n",