ath9k: Fix up hardware mode and beacons with multiple vifs.
PATCH v2 1/1 ath9k: Fix up hardware mode and beacons with multiple vifs.
From: Ben Greear <[email protected]>
When using a mixture of AP and Station interfaces, the hardware mode was using the type of the last VIF registered. Instead, we should keep track of the number of different types of vifs and set the mode accordingly.
In addtion, use the vif type instead of hardware opmode when dealing with beacons.
Attempt to move some of the common setup code into smaller methods so we can re-use it when changing vif mode as well as adding/deleting vifs.
---
v1 -> v2: Use only ADHOC, AP, and STATION opmodes.
Set up tsf and ani based on current existing vifs instead of depending on opmode. Remove spurious 'TODO' comment that did not apply.
:100644 100644 3108699... a2da259... M drivers/net/wireless/ath/ath9k/ath9k.h
:100644 100644 385ba03... 8de591e... M drivers/net/wireless/ath/ath9k/beacon.c
:100644 100644 0452580... 3845832... M drivers/net/wireless/ath/ath9k/main.c
:100644 100644 ea2f67c... 8def8c2... M drivers/net/wireless/ath/ath9k/recv.c
drivers/net/wireless/ath/ath9k/ath9k.h | 10 +- drivers/net/wireless/ath/ath9k/beacon.c | 14 +- drivers/net/wireless/ath/ath9k/main.c | 284 +++++++++++++++++++++---------- drivers/net/wireless/ath/ath9k/recv.c | 16 ++- 4 files changed, 224 insertions(+), 100 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +8 -2
@@ -607,10 +607,15 @@ struct ath_softc {u32 sc_flags;/* SC_OP_* */ u16 ps_flags;/* PS_* */ u16 curtxpow; -u8 nbcnvifs; -u16 nvifs;bool ps_enabled;bool ps_idle; +short nbcnvifs; +short nvifs; +short naps;/* number of APs */ +short nmeshes; +short nstations; +short nwds; +short nadhocs;unsigned long ps_usecount;struct ath_config config;
@@ -694,6 +699,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,void ath_radio_enable (struct ath_softc *sc,struct ieee80211_hw *hw);void ath_radio_disable (struct ath_softc *sc,struct ieee80211_hw *hw);bool ath9k_setpower (struct ath_softc *sc,enum ath9k_power_mode mode); +bool ath9k_uses_beacons (int type);#ifdef CONFIG_PCI int ath_pci_init (void );
drivers/net/wireless/ath/ath9k/beacon.c +6 -8
@@ -244,9 +244,7 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif) struct ath_buf, list);list_del (&avp->av_bcbuf->list); -if (sc->sc_ah->opmode ==NL80211_IFTYPE_AP || - sc->sc_ah->opmode ==NL80211_IFTYPE_ADHOC || - sc->sc_ah->opmode ==NL80211_IFTYPE_MESH_POINT ) { +if (ath9k_uses_beacons (vif->type)) {int slot;/* * Assign the vif to a beacon xmit slot. As
@@ -282,7 +280,7 @@ int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)/* NB: the beacon data buffer must be 32-bit aligned. */ skb =ieee80211_beacon_get (sc->hw, vif);if (skb ==NULL ) { -ath_dbg (common,ATH_DBG_BEACON ,"cannot get skb\n" ); +ath_err (common,"ieee80211_beacon_get failed\n" );return -ENOMEM ; }
@@ -720,10 +718,10 @@ void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif) iftype = sc->sc_ah->opmode; } - cur_conf->listen_interval =1 ; - cur_conf->dtim_count =1 ; - cur_conf->bmiss_timeout = -ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval; + cur_conf->listen_interval =1 ; + cur_conf->dtim_count =1 ; + cur_conf->bmiss_timeout = +ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;/* * It looks like mac80211 may end up using beacon interval of zero in
drivers/net/wireless/ath/ath9k/main.c +196 -88
357 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/recv.c +14 -2
@@ -589,8 +589,14 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)return ; mgmt = (struct ieee80211_mgmt *)skb->data; -if (memcmp (common->curbssid, mgmt->bssid,ETH_ALEN ) !=0 ) +if (memcmp (common->curbssid, mgmt->bssid,ETH_ALEN ) !=0 ) { +/* TODO: This doesn't work well if you have stations +* associated to two different APs because curbssid +* is just the last AP that any of the stations associated +* with. +*/ return ;/* not from our current AP */ + } sc->ps_flags &= ~PS_WAIT_FOR_BEACON ;
@@ -985,8 +991,14 @@ static void ath9k_process_rssi(struct ath_common *common, fc = hdr->frame_control;if (!ieee80211_is_beacon (fc) || -compare_ether_addr (hdr->addr3, common->curbssid)) +compare_ether_addr (hdr->addr3, common->curbssid)) { +/* TODO: This doesn't work well if you have stations +* associated to two different APs because curbssid +* is just the last AP that any of the stations associated +* with. +*/ return ; + }if (rx_stats->rs_rssi !=ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr)ATH_RSSI_LPF (aphy->last_rssi, rx_stats->rs_rssi);
Signature · 1 line
1.7.2.3