Skip to content

Commit cb35582

Browse files
Sujith Manoharanlinvjw
authored andcommitted
ath9k: Cache BSS information
Using the BSS information stored in mac80211 directly is racy in certain conditions. For example, in a MCC setup, if the scheduler is switching channels when a local deauth is issued, calculation of the opmode/bssid etc. is incorrect. To avoid this, store the bss params in the driver and use it. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 093ec3c commit cb35582

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

‎drivers/net/wireless/ath/ath9k/ath9k.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,11 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
585585
struct ath_vif {
586586
struct list_head list;
587587

588+
/* BSS info */
589+
u8 bssid[ETH_ALEN];
590+
u16 aid;
591+
bool assoc;
592+
588593
struct ieee80211_vif *vif;
589594
struct ath_node mcast_node;
590595
int av_bslot;

‎drivers/net/wireless/ath/ath9k/channel.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)
211211
switch (vif->type) {
212212
case NL80211_IFTYPE_P2P_CLIENT:
213213
case NL80211_IFTYPE_STATION:
214-
if (vif->bss_conf.assoc)
214+
if (avp->assoc)
215215
active = true;
216216
break;
217217
default:
@@ -917,7 +917,7 @@ ath_chanctx_send_vif_ps_frame(struct ath_softc *sc, struct ath_vif *avp,
917917

918918
switch (vif->type) {
919919
case NL80211_IFTYPE_STATION:
920-
if (!vif->bss_conf.assoc)
920+
if (!avp->assoc)
921921
return false;
922922

923923
skb = ieee80211_nullfunc_get(sc->hw, vif);
@@ -1339,7 +1339,7 @@ void ath9k_p2p_ps_timer(void *priv)
13391339
rcu_read_lock();
13401340

13411341
vif = avp->vif;
1342-
sta = ieee80211_find_sta(vif, vif->bss_conf.bssid);
1342+
sta = ieee80211_find_sta(vif, avp->bssid);
13431343
if (!sta)
13441344
goto out;
13451345

‎drivers/net/wireless/ath/ath9k/main.c‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,7 @@ static bool ath9k_uses_beacons(int type)
898898
static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data,
899899
u8 *mac, struct ieee80211_vif *vif)
900900
{
901+
struct ath_vif *avp = (struct ath_vif *)vif->drv_priv;
901902
int i;
902903

903904
if (iter_data->has_hw_macaddr) {
@@ -918,7 +919,7 @@ static void ath9k_vif_iter(struct ath9k_vif_iter_data *iter_data,
918919
break;
919920
case NL80211_IFTYPE_STATION:
920921
iter_data->nstations++;
921-
if (vif->bss_conf.assoc && !iter_data->primary_sta)
922+
if (avp->assoc && !iter_data->primary_sta)
922923
iter_data->primary_sta = vif;
923924
break;
924925
case NL80211_IFTYPE_ADHOC:
@@ -963,13 +964,13 @@ static void ath9k_set_assoc_state(struct ath_softc *sc,
963964
struct ieee80211_vif *vif, bool changed)
964965
{
965966
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
966-
struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
967+
struct ath_vif *avp = (struct ath_vif *)vif->drv_priv;
967968
unsigned long flags;
968969

969970
set_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags);
970971

971-
ether_addr_copy(common->curbssid, bss_conf->bssid);
972-
common->curaid = bss_conf->aid;
972+
ether_addr_copy(common->curbssid, avp->bssid);
973+
common->curaid = avp->aid;
973974
ath9k_hw_write_associd(sc->sc_ah);
974975

975976
if (changed) {
@@ -1698,6 +1699,10 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
16981699
ath_dbg(common, CONFIG, "BSSID %pM Changed ASSOC %d\n",
16991700
bss_conf->bssid, bss_conf->assoc);
17001701

1702+
ether_addr_copy(avp->bssid, bss_conf->bssid);
1703+
avp->aid = bss_conf->aid;
1704+
avp->assoc = bss_conf->assoc;
1705+
17011706
ath9k_calculate_summary_state(sc, avp->chanctx);
17021707

17031708
if (ath9k_is_chanctx_enabled()) {

0 commit comments

Comments
 (0)