Commit cec77a25 authored by Sriram R's avatar Sriram R Committed by Kalle Valo

wifi: ath12k: Add additional checks for vif and sta iterators

Since vif and sta objects of different radios are added to same
local hw list in mac80211, additional checks need to be done
in driver to ensure we are processing the intended vif
and sta corresponding to the radio when the vif and sta mac80211
iterator utils are used from driver.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Signed-off-by: default avatarSriram R <quic_srirrama@quicinc.com>
Signed-off-by: default avatarRameshkumar Sundaram <quic_ramess@quicinc.com>
Acked-by: default avatarJeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240405194519.1337906-9-quic_ramess@quicinc.com
parent b5068bc9
...@@ -291,6 +291,7 @@ struct ath12k_vif { ...@@ -291,6 +291,7 @@ struct ath12k_vif {
struct ath12k_vif_iter { struct ath12k_vif_iter {
u32 vdev_id; u32 vdev_id;
struct ath12k *ar;
struct ath12k_vif *arvif; struct ath12k_vif *arvif;
}; };
......
...@@ -534,7 +534,8 @@ static void ath12k_get_arvif_iter(void *data, u8 *mac, ...@@ -534,7 +534,8 @@ static void ath12k_get_arvif_iter(void *data, u8 *mac,
struct ath12k_vif_iter *arvif_iter = data; struct ath12k_vif_iter *arvif_iter = data;
struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
if (arvif->vdev_id == arvif_iter->vdev_id) if (arvif->vdev_id == arvif_iter->vdev_id &&
arvif->ar == arvif_iter->ar)
arvif_iter->arvif = arvif; arvif_iter->arvif = arvif;
} }
...@@ -544,6 +545,7 @@ struct ath12k_vif *ath12k_mac_get_arvif(struct ath12k *ar, u32 vdev_id) ...@@ -544,6 +545,7 @@ struct ath12k_vif *ath12k_mac_get_arvif(struct ath12k *ar, u32 vdev_id)
u32 flags; u32 flags;
arvif_iter.vdev_id = vdev_id; arvif_iter.vdev_id = vdev_id;
arvif_iter.ar = ar;
flags = IEEE80211_IFACE_ITER_RESUME_ALL; flags = IEEE80211_IFACE_ITER_RESUME_ALL;
ieee80211_iterate_active_interfaces_atomic(ath12k_ar_to_hw(ar), ieee80211_iterate_active_interfaces_atomic(ath12k_ar_to_hw(ar),
...@@ -6848,14 +6850,19 @@ struct ath12k_mac_change_chanctx_arg { ...@@ -6848,14 +6850,19 @@ struct ath12k_mac_change_chanctx_arg {
struct ieee80211_vif_chanctx_switch *vifs; struct ieee80211_vif_chanctx_switch *vifs;
int n_vifs; int n_vifs;
int next_vif; int next_vif;
struct ath12k *ar;
}; };
static void static void
ath12k_mac_change_chanctx_cnt_iter(void *data, u8 *mac, ath12k_mac_change_chanctx_cnt_iter(void *data, u8 *mac,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
struct ath12k_mac_change_chanctx_arg *arg = data; struct ath12k_mac_change_chanctx_arg *arg = data;
if (arvif->ar != arg->ar)
return;
if (rcu_access_pointer(vif->bss_conf.chanctx_conf) != arg->ctx) if (rcu_access_pointer(vif->bss_conf.chanctx_conf) != arg->ctx)
return; return;
...@@ -6866,9 +6873,13 @@ static void ...@@ -6866,9 +6873,13 @@ static void
ath12k_mac_change_chanctx_fill_iter(void *data, u8 *mac, ath12k_mac_change_chanctx_fill_iter(void *data, u8 *mac,
struct ieee80211_vif *vif) struct ieee80211_vif *vif)
{ {
struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
struct ath12k_mac_change_chanctx_arg *arg = data; struct ath12k_mac_change_chanctx_arg *arg = data;
struct ieee80211_chanctx_conf *ctx; struct ieee80211_chanctx_conf *ctx;
if (arvif->ar != arg->ar)
return;
ctx = rcu_access_pointer(vif->bss_conf.chanctx_conf); ctx = rcu_access_pointer(vif->bss_conf.chanctx_conf);
if (ctx != arg->ctx) if (ctx != arg->ctx)
return; return;
...@@ -6987,7 +6998,7 @@ static void ...@@ -6987,7 +6998,7 @@ static void
ath12k_mac_update_active_vif_chan(struct ath12k *ar, ath12k_mac_update_active_vif_chan(struct ath12k *ar,
struct ieee80211_chanctx_conf *ctx) struct ieee80211_chanctx_conf *ctx)
{ {
struct ath12k_mac_change_chanctx_arg arg = { .ctx = ctx }; struct ath12k_mac_change_chanctx_arg arg = { .ctx = ctx, .ar = ar };
struct ieee80211_hw *hw = ath12k_ar_to_hw(ar); struct ieee80211_hw *hw = ath12k_ar_to_hw(ar);
lockdep_assert_held(&ar->conf_mutex); lockdep_assert_held(&ar->conf_mutex);
...@@ -7563,6 +7574,9 @@ static void ath12k_mac_set_bitrate_mask_iter(void *data, ...@@ -7563,6 +7574,9 @@ static void ath12k_mac_set_bitrate_mask_iter(void *data,
struct ath12k_sta *arsta = ath12k_sta_to_arsta(sta); struct ath12k_sta *arsta = ath12k_sta_to_arsta(sta);
struct ath12k *ar = arvif->ar; struct ath12k *ar = arvif->ar;
if (arsta->arvif != arvif)
return;
spin_lock_bh(&ar->data_lock); spin_lock_bh(&ar->data_lock);
arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED; arsta->changed |= IEEE80211_RC_SUPP_RATES_CHANGED;
spin_unlock_bh(&ar->data_lock); spin_unlock_bh(&ar->data_lock);
...@@ -7573,10 +7587,14 @@ static void ath12k_mac_set_bitrate_mask_iter(void *data, ...@@ -7573,10 +7587,14 @@ static void ath12k_mac_set_bitrate_mask_iter(void *data,
static void ath12k_mac_disable_peer_fixed_rate(void *data, static void ath12k_mac_disable_peer_fixed_rate(void *data,
struct ieee80211_sta *sta) struct ieee80211_sta *sta)
{ {
struct ath12k_sta *arsta = ath12k_sta_to_arsta(sta);
struct ath12k_vif *arvif = data; struct ath12k_vif *arvif = data;
struct ath12k *ar = arvif->ar; struct ath12k *ar = arvif->ar;
int ret; int ret;
if (arsta->arvif != arvif)
return;
ret = ath12k_wmi_set_peer_param(ar, sta->addr, ret = ath12k_wmi_set_peer_param(ar, sta->addr,
arvif->vdev_id, arvif->vdev_id,
WMI_PEER_PARAM_FIXED_RATE, WMI_PEER_PARAM_FIXED_RATE,
......
...@@ -121,7 +121,7 @@ static void ath12k_p2p_noa_update_vdev_iter(void *data, u8 *mac, ...@@ -121,7 +121,7 @@ static void ath12k_p2p_noa_update_vdev_iter(void *data, u8 *mac,
struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif); struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
struct ath12k_p2p_noa_arg *arg = data; struct ath12k_p2p_noa_arg *arg = data;
if (arvif->vdev_id != arg->vdev_id) if (arvif->ar != arg->ar || arvif->vdev_id != arg->vdev_id)
return; return;
ath12k_p2p_noa_update(arvif, arg->noa); ath12k_p2p_noa_update(arvif, arg->noa);
...@@ -132,6 +132,7 @@ void ath12k_p2p_noa_update_by_vdev_id(struct ath12k *ar, u32 vdev_id, ...@@ -132,6 +132,7 @@ void ath12k_p2p_noa_update_by_vdev_id(struct ath12k *ar, u32 vdev_id,
{ {
struct ath12k_p2p_noa_arg arg = { struct ath12k_p2p_noa_arg arg = {
.vdev_id = vdev_id, .vdev_id = vdev_id,
.ar = ar,
.noa = noa, .noa = noa,
}; };
......
...@@ -12,6 +12,7 @@ struct ath12k_wmi_p2p_noa_info; ...@@ -12,6 +12,7 @@ struct ath12k_wmi_p2p_noa_info;
struct ath12k_p2p_noa_arg { struct ath12k_p2p_noa_arg {
u32 vdev_id; u32 vdev_id;
struct ath12k *ar;
const struct ath12k_wmi_p2p_noa_info *noa; const struct ath12k_wmi_p2p_noa_info *noa;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment