ath9k: support for multiple beacon intervals
This patch maintains a beacon interval for each beacon. The SWBA interrupts are based on the shortest interval of the active beacons.
This has been tested as a mesh access point with both AP and MESH on one interface.
---
A patch to wireshark has been posted to lists.open80211s.org that decodes the traffic.
I have left some printk's to aid in testing. I'll remove them when I submit the patch.
drivers/net/wireless/ath/ath9k/ath9k.h +6 -0
@@ -351,6 +351,9 @@ struct ath_vif {bool is_bslot_active, primary_sta_vif;__le64 tsf_adjust;/* TSF adjustment for staggered beacons */ struct ath_buf *av_bcbuf; +u16 dtim_period; +u32 intval;/* beacon interval */ +int intval_remaining;/* time to next beacon */ };/*******************/
@@ -406,6 +409,9 @@ void ath_beacon_return(struct ath_softcint ath_beaconq_config (struct ath_softc *sc);void ath_set_beacon (struct ath_softc *sc);void ath9k_set_beaconing_status (struct ath_softc *sc,bool status); +struct ath_vif *ath_find_min_intval (struct ath_softc *sc); +void ath9k_beacon_init (struct ath_softc *sc,u32 next_beacon, +u32 beacon_period);/*******/ /* ANI */
drivers/net/wireless/ath/ath9k/beacon.c +98 -25
195 lines not on this page · raw message
drivers/net/wireless/ath/ath9k/hw.c +1 -2
@@ -1082,11 +1082,11 @@ static void ath9k_hw_set_operating_mode(switch (opmode) {case NL80211_IFTYPE_ADHOC : -case NL80211_IFTYPE_MESH_POINT : set |=AR_STA_ID1_ADHOC ;REG_SET_BIT (ah,AR_CFG ,AR_CFG_AP_ADHOC_INDICATION );break ;case NL80211_IFTYPE_AP : +case NL80211_IFTYPE_MESH_POINT : set |=AR_STA_ID1_STA_AP ;/* fall through */ case NL80211_IFTYPE_STATION :
@@ -1822,7 +1822,6 @@ void ath9k_hw_beaconinit(struct ath_hw *switch (ah->opmode) {case NL80211_IFTYPE_ADHOC : -case NL80211_IFTYPE_MESH_POINT :REG_SET_BIT (ah,AR_TXCFG ,AR_TXCFG_ADHOC_BEACON_ATIM_TX_POLICY ); REG_WRITE(ah, AR_NEXT_NDP_TIMER, next_beacon +
drivers/net/wireless/ath/ath9k/main.c +1 -3
@@ -1396,9 +1396,7 @@ static void ath9k_calculate_summary_statath9k_hw_set_tsfadjust (ah,0 ); sc->sc_flags &= ~SC_OP_TSF_RESET ; -if (iter_data.nmeshes) - ah->opmode =NL80211_IFTYPE_MESH_POINT ; -else if (iter_data.nwds) +if (iter_data.nmeshes + iter_data.nwds) ah->opmode =NL80211_IFTYPE_AP ;else if (iter_data.nadhocs) ah->opmode =NL80211_IFTYPE_ADHOC ;
Quoted 1 line · Steve Brown
This patch maintains a beacon interval for each beacon.
Why do we need this feature?
The SWBA interrupts
Quoted 6 lines
are based on the shortest interval of the active beacons.
This has been tested as a mesh access point with both AP and MESH on one interface.
Signed-off-by Steve Brown <[email protected]>
Quoted 4 lines · kang haiyang
Quoted 1 line · Steve Brown
This patch maintains a beacon interval for each beacon.
Why do we need this feature?
The purpose is to support what the 802.11s spec calls a mesh access point (MAP). That allows a node to be both an AP and part of a mesh network at the same time.
Steve
I say NACK (but like the idea), and here's why:
Quoted 2 lines · Steve Brown
This patch maintains a beacon interval for each beacon. The SWBA interrupts are based on the shortest interval of the active beacons.
It also includes changes to the beacon logic for Mesh, eg:
* Can not configure station vif's beacon config
* while on AP opmode
*/
if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) &&
- (vif->type != NL80211_IFTYPE_AP)) {
+ !(vif->type == NL80211_IFTYPE_AP ||
+ vif->type == NL80211_IFTYPE_MESH_POINT)) {
ath_dbg(common, ATH_DBG_CONFIG,
there's a couple more sections like this.
So you've not only modified the driver to support >1 beacon interval, but you've also changed how things are handled for IFTYPE_MESHPOINT. Please split the patch up into (at least) two chunks so they can be separately reviewed.
Quoted 2 lines
This has been tested as a mesh access point with both AP and MESH on one interface.
Is mesh+ap on the same interface currently supported?
I like the idea, but as i've been knee-deep in the beacon handling code recently, I can't help but wonder if there's corner cases that need to be taken into account.
(Eg, if there's multiple STA interfaces with beacon miss interrupts being generated, are you handling that case correctly so you don't trigger bmiss incorrectly for STAs?)
Also, FreeBSD's 802.11s mesh mode support is implemented using hostap mode in the NIC, versus adhoc mode (I only found this out yesterday. :-) So your mode change may have unintended consequences.
It's not a bad idea though; I'd like it properly investigated and tested though before a change like this makes it into the public tree.
Adrian
Quoted 6 lines · Adrian Chadd
I say NACK (but like the idea), and here's why:
So you've not only modified the driver to support >1 beacon interval, but you've also changed how things are handled for
IFTYPE_MESHPOINT. Please split the patch up into (at least) two chunks so they can be separately reviewed.
I'll resend as 2 patches. One for handling MESH beacons as AP rather than IBSS as is done now. And, the beacon interval changes in another.
Quoted 3 lines
Is mesh+ap on the same interface currently supported?
No, only with this patch. AP beacon interval is 100 while MESH is 1000. The current code uses the same interval for all beacons.
Quoted 5 lines
Also, FreeBSD's 802.11s mesh mode support is implemented using hostap mode in the NIC, versus adhoc mode (I only found this out yesterday. :-) So your mode change may have unintended consequences.
I just looked at the FreeBSD code (if_ath.c). It seems to be handling AP and MESH beaconing the same. Have there been problems with that?
Thanks for your comments,
Steve
Quoted 10 lines · Steve Brown
Quoted 6 lines · Adrian Chadd
I say NACK (but like the idea), and here's why:
So you've not only modified the driver to support >1 beacon interval, but you've also changed how things are handled for
IFTYPE_MESHPOINT. Please split the patch up into (at least) two chunks so they can be separately reviewed.I'll resend as 2 patches. One for handling MESH beacons as AP rather than IBSS as is done now. And, the beacon interval changes in another.
Thanks. Someone who understands the mesh stuff a bit better will need to review the mesh beacon changes.
Quoted 5 lines
Quoted 2 lines
Is mesh+ap on the same interface currently supported?
No, only with this patch. AP beacon interval is 100 while MESH is 1000. The current code uses the same interval for all beacons.
Even with your patch, is it still intended to be a supported setup?
Eg, what's supposed to happen with TSF adjustment in mesh mode? Are the TSF's being bumped based on received TSFs from other mesh nodes? If so, are your AP mode TSFs drifting because of this? Could this impact eg (dynamic) power saving mode support on STAs that are synched to the AP TSF?
Adrian
[ath9k-devel] AR9380 MSI
Hello,
I have tried the same thing as you did on Freescale P1020 processor (Power architecture) using 2.6.39.1 and I am getting some results when performing scanning. Before enabling MSI in ath9k pci.c, I newer got any scan results. But now when enabled I am getting at least 1 network very often.
However it seems the operation is not very stable. I can not connect to the AP.
Have you made any progress on this one?
I got an answer from Atheros guys, they use INTA by default. And also looking at defines AR_PCIE_MSI and AR_PCIE_MSI_ENABLE I got a question: who is using that defines? It seems like nobody???
regards,
Matevz Langus
Quoted 9 lines · Adrian Chadd
Quoted 6 lines · Steve Brown
Quoted 2 lines · Adrian Chadd
Is mesh+ap on the same interface currently supported?
No, only with this patch. AP beacon interval is 100 while MESH is 1000. The current code uses the same interval for all beacons.
Even with your patch, is it still intended to be a supported setup?
Yes, Mesh Access Point support was the motivation for the patch.
Quoted 6 lines
Eg, what's supposed to happen with TSF adjustment in mesh mode? Are the TSF's being bumped based on received TSFs from other mesh nodes? If so, are your AP mode TSFs drifting because of this? Could this impact eg (dynamic) power saving mode support on STAs that are synched to the AP TSF?
802.11s doesn't seem to require tsf sync among the members of the mesh. Further, I can't find any code that implements mesh tsf sync. It looks like tsf sync is done in hardware when using adhoc style beacons, but not when using ap style beacons. Many drivers, including rt2800, b43, rtlwifi and FreeBSD's ath, which you mentioned, use ap style beaconing.
So, I don't see how adding mesh beacons will interfere with the ap beacons going out on schedule. In my testing, wireshark also verified that all the beacons went out when they were supposed to.
I hope this explanation addresses your concern.
Steve
Oh I'm all for this, I really am. I'd like to get FreeBSD's ath driver support ap+mesh too. I'm just worried that there's lurking gotchas in the driver code that make this difficult to pull off and I'm in no way equipped to comment on the ath9k mesh support to say yes or no to this.
But I am very glad you're working on it. :)
Adrian
Quoted 37 lines · Steve Brown
Quoted 9 lines · Adrian Chadd
Quoted 6 lines · Steve Brown
Quoted 2 lines · Adrian Chadd
Is mesh+ap on the same interface currently supported?
No, only with this patch. AP beacon interval is 100 while MESH is 1000. The current code uses the same interval for all beacons.
Even with your patch, is it still intended to be a supported setup?
Yes, Mesh Access Point support was the motivation for the patch.
Quoted 6 lines
Eg, what's supposed to happen with TSF adjustment in mesh mode? Are the TSF's being bumped based on received TSFs from other mesh nodes? If so, are your AP mode TSFs drifting because of this? Could this impact eg (dynamic) power saving mode support on STAs that are synched to the AP TSF?
802.11s doesn't seem to require tsf sync among the members of the mesh. Further, I can't find any code that implements mesh tsf sync. It looks like tsf sync is done in hardware when using adhoc style beacons, but not when using ap style beacons. Many drivers, including rt2800, b43, rtlwifi and FreeBSD's ath, which you mentioned, use ap style beaconing.
So, I don't see how adding mesh beacons will interfere with the ap beacons going out on schedule. In my testing, wireshark also verified that all the beacons went out when they were supposed to.
I hope this explanation addresses your concern.
Steve
Quoted 3 lines · Steve Brown
This patch maintains a beacon interval for each beacon. The SWBA interrupts are based on the shortest interval of the active beacons.
Steve, thank you for the patch. I for one would really like this functionality in the driver. :)
One question: how does your patch handle the case where the longer beacon intervals are not evenly divisible by the shortest beacon interval? For example lets say there are two beacons, one with interval 300 and one with interval 1000, what happens then?
If possible I would prefer an implementation that sets SWBA interrupts to the greatest common divisor of all beacon intervals. There will then be an interrupt at each beacon tx time (but some interrupts may be unnecessary). If a beaconing interface with a "weird" beacon interval is added so that the greatest common divisor becomes too small then the operation IMHO should fail.
Thanks again for looking into this!
/Bj?rn
Quoted 3 lines · Bj?rn Smedman
If possible I would prefer an implementation that sets SWBA interrupts to the greatest common divisor of all beacon intervals. /Bj?rn
The purpose of the patch is to support a Mesh Access Point by allowing both ap and mesh vifs on the same interface. Support for different ap beacon intervals isn't a goal.
The general case gets pretty complicated. If there is an AP vif, cur_conf->beacon_interval appears to want to be the AP interval. Other timings depend on it.
If the SWBA interrupt is based on the minimum of the mesh or ap interval, it will always be that of the ap vif. The mesh beacons don't seem to be used for timing, so even if one interval is not a multiple of the other, some jitter in the mesh beaconing shouldn't be a problem. The AP beacons would always go out on schedule and the mesh beacons would be interleaved every (mesh%ap + 1) ap beacons.
Steve