2010-09-10 20:07:24

by Ben Greear

[permalink] [raw]
Subject: RFC: v3: Support multiple STA on same AP with ath9k

The attached patch lets mac80111 create multiple STA on the same
AP, and the changes to ath9k let it function properly, at least for
un-encrypted traffic. WPA does not work..no idea why yet.

It also consolidates some of the util.c iterator logic in
mac80211.

Please let me know if this is moving in the right direction.

Thanks,
Ben

--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com



Attachments:
wt-36-vsta-ok-c.patch (9.80 kB)

Subject: Re: RFC: v3: Support multiple STA on same AP with ath9k

> /* configure operational mode */
> diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
> index b32c8f0..4ce4029 100644
> --- a/drivers/net/wireless/ath/ath9k/recv.c
> +++ b/drivers/net/wireless/ath/ath9k/recv.c
> @@ -110,7 +110,6 @@ static void ath_setdefantenna(struct ath_softc *sc, u32 antenna)
> static void ath_opmode_init(struct ath_softc *sc)
> {
> struct ath_hw *ah = sc->sc_ah;
> - struct ath_common *common = ath9k_hw_common(ah);
>
> u32 rfilt, mfilt[2];
>
> @@ -118,9 +117,15 @@ static void ath_opmode_init(struct ath_softc *sc)
> rfilt = ath_calcrxfilter(sc);
> ath9k_hw_setrxfilter(ah, rfilt);
>
> - /* configure bssid mask */
> - if (ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
> - ath_hw_setbssidmask(common);
> + /* configure bssid mask, if ah->hw is configured.
> + * it is NOT configured when mac80211 is calling
> + * ieee80211_do_open, but probably just as well since
> + * this STA isn't in the list yet.
> + */
> + if (ah->hw) {

This seems bogus. why a check for hw at this point??. IIRS hw of
ah is not initialized at all, in that case this would fail always.
Did you test with these code?

> + int avifs = ieee80211_count_sta_atomic(sc->hw);

If your aim here is to get the number of virtual interfaces
associated to a hw, sc->nvifs should work.

2010-09-14 14:40:03

by Ben Greear

[permalink] [raw]
Subject: Re: RFC: v3: Support multiple STA on same AP with ath9k

On 09/14/2010 06:46 AM, Vasanthakumar Thiagarajan wrote:
> On Tue, Sep 14, 2010 at 12:53:29AM +0530, Ben Greear wrote:
>> Any suggestions for fixing the bssid mask setting in ath_opmode_init?
>> My change, appears to work because it's set in ath9k_add_interface, even
>> if not in the ath_opmode_init method.
>
> checking for ah->hw in ath_opmode_init() is buggy. bssid mask
> configuration from ath9k_add_interface() may not work well when
> some of the other vifs are in down state, may be this needs to
> be in ath_opmode_init() without that incorrect check.

It seems we need the ah->hw object to get the list of interfaces, but
ah->hw is NULL in ath_opmode_init. Is there another way to get the
list of interfaces so we can iterate over them to build the ssid mask?

Thanks,
Ben

--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com

2010-09-10 21:23:26

by Ben Greear

[permalink] [raw]
Subject: Re: RFC: v3: Support multiple STA on same AP with ath9k

On 09/10/2010 02:12 PM, Johannes Berg wrote:
>
> On Fri, 10 Sep 2010 13:07:20 -0700, Ben Greear<[email protected]>
> wrote:
>> It also consolidates some of the util.c iterator logic in
>> mac80211.
>
> That really ought to be a different patch.
>
> And I don't think I like the counting in mac80211 -- it's just overhead
> (EXPORT_SYMBOL etc) and a very simple implementation in the driver itself.

I can just use the helper method by itself if you don't want another
new method exposed to explicitly count interfaces.

As for counting, as far as I can tell, ath9k doesn't keep a list of
interfaces, but rather calls those iterator methods when it wants to
know them, so one way or another I need to call back into mac80211.

I'll break the patches apart for the next posting.

Did you get a chance to think more about this part of the patch?

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 687077e..db751f1 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -440,7 +440,7 @@ int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU)

spin_lock_irqsave(&local->sta_lock, flags);
/* check if STA exists already */
- if (sta_info_get_bss(sdata, sta->sta.addr)) {
+ if (sta_info_get(sdata, sta->sta.addr)) {
spin_unlock_irqrestore(&local->sta_lock, flags);
mutex_unlock(&local->sta_mtx);
rcu_read_lock();

Thanks,
Ben


--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com


Subject: Re: RFC: v3: Support multiple STA on same AP with ath9k

On Tue, Sep 14, 2010 at 12:53:29AM +0530, Ben Greear wrote:
> Any suggestions for fixing the bssid mask setting in ath_opmode_init?
> My change, appears to work because it's set in ath9k_add_interface, even
> if not in the ath_opmode_init method.

checking for ah->hw in ath_opmode_init() is buggy. bssid mask
configuration from ath9k_add_interface() may not work well when
some of the other vifs are in down state, may be this needs to
be in ath_opmode_init() without that incorrect check.

Vasanth

2010-09-13 14:36:38

by Ben Greear

[permalink] [raw]
Subject: Re: RFC: v3: Support multiple STA on same AP with ath9k

On 09/13/2010 05:14 AM, Vasanthakumar Thiagarajan wrote:
>> /* configure operational mode */
>> diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
>> index b32c8f0..4ce4029 100644
>> --- a/drivers/net/wireless/ath/ath9k/recv.c
>> +++ b/drivers/net/wireless/ath/ath9k/recv.c
>> @@ -110,7 +110,6 @@ static void ath_setdefantenna(struct ath_softc *sc, u32 antenna)
>> static void ath_opmode_init(struct ath_softc *sc)
>> {
>> struct ath_hw *ah = sc->sc_ah;
>> - struct ath_common *common = ath9k_hw_common(ah);
>>
>> u32 rfilt, mfilt[2];
>>
>> @@ -118,9 +117,15 @@ static void ath_opmode_init(struct ath_softc *sc)
>> rfilt = ath_calcrxfilter(sc);
>> ath9k_hw_setrxfilter(ah, rfilt);
>>
>> - /* configure bssid mask */
>> - if (ah->caps.hw_caps& ATH9K_HW_CAP_BSSIDMASK)
>> - ath_hw_setbssidmask(common);
>> + /* configure bssid mask, if ah->hw is configured.
>> + * it is NOT configured when mac80211 is calling
>> + * ieee80211_do_open, but probably just as well since
>> + * this STA isn't in the list yet.
>> + */
>> + if (ah->hw) {
>
> This seems bogus. why a check for hw at this point??. IIRS hw of
> ah is not initialized at all, in that case this would fail always.
> Did you test with these code?

I did test it, and it worked for me. Maybe we just shouldn't configure
the bssid mask in that method? When using multiple VIFs, we need to do
the mask properly, and from what I can tell, when this method is called,
we do not have enough information to do that properly.

>
>> + int avifs = ieee80211_count_sta_atomic(sc->hw);
>
> If your aim here is to get the number of virtual interfaces
> associated to a hw, sc->nvifs should work.

I'll check to see if this will work.

Thanks,
Ben

> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html


--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com

2010-09-10 21:27:03

by Johannes Berg

[permalink] [raw]
Subject: Re: RFC: v3: Support multiple STA on same AP with ath9k


On Fri, 10 Sep 2010 14:23:17 -0700, Ben Greear <[email protected]>
wrote:
> As for counting, as far as I can tell, ath9k doesn't keep a list of
> interfaces, but rather calls those iterator methods when it wants to
> know them, so one way or another I need to call back into mac80211.

But it can just call the atomic iterator with a callback that
keeps the count.

> I'll break the patches apart for the next posting.
>
> Did you get a chance to think more about this part of the patch?

No, I didn't, and since I'm at the wireless summit now it
seems unlikely that I'll get to it before I get/go back
home on Monday (US time morning).

johannes

2010-09-10 21:12:08

by Johannes Berg

[permalink] [raw]
Subject: Re: RFC: v3: Support multiple STA on same AP with ath9k


On Fri, 10 Sep 2010 13:07:20 -0700, Ben Greear <[email protected]>
wrote:
> It also consolidates some of the util.c iterator logic in
> mac80211.

That really ought to be a different patch.

And I don't think I like the counting in mac80211 -- it's just overhead
(EXPORT_SYMBOL etc) and a very simple implementation in the driver itself.

johannes

Subject: Re: RFC: v3: Support multiple STA on same AP with ath9k

On Tue, Sep 14, 2010 at 08:09:54PM +0530, Ben Greear wrote:
> On 09/14/2010 06:46 AM, Vasanthakumar Thiagarajan wrote:
> > On Tue, Sep 14, 2010 at 12:53:29AM +0530, Ben Greear wrote:
> >> Any suggestions for fixing the bssid mask setting in ath_opmode_init?
> >> My change, appears to work because it's set in ath9k_add_interface, even
> >> if not in the ath_opmode_init method.
> >
> > checking for ah->hw in ath_opmode_init() is buggy. bssid mask
> > configuration from ath9k_add_interface() may not work well when
> > some of the other vifs are in down state, may be this needs to
> > be in ath_opmode_init() without that incorrect check.
>
> It seems we need the ah->hw object to get the list of interfaces, but
> ah->hw is NULL in ath_opmode_init. Is there another way to get the
> list of interfaces so we can iterate over them to build the ssid mask?

common->hw.

2010-09-13 19:23:34

by Ben Greear

[permalink] [raw]
Subject: Re: RFC: v3: Support multiple STA on same AP with ath9k

On 09/13/2010 05:14 AM, Vasanthakumar Thiagarajan wrote:

>> - /* configure bssid mask */
>> - if (ah->caps.hw_caps& ATH9K_HW_CAP_BSSIDMASK)
>> - ath_hw_setbssidmask(common);
>> + /* configure bssid mask, if ah->hw is configured.
>> + * it is NOT configured when mac80211 is calling
>> + * ieee80211_do_open, but probably just as well since
>> + * this STA isn't in the list yet.
>> + */
>> + if (ah->hw) {
>
> This seems bogus. why a check for hw at this point??. IIRS hw of
> ah is not initialized at all, in that case this would fail always.
> Did you test with these code?
>
>> + int avifs = ieee80211_count_sta_atomic(sc->hw);
>
> If your aim here is to get the number of virtual interfaces
> associated to a hw, sc->nvifs should work.

Using nvifs seems to work fine. I can respin that patch using
nvifs.

Any suggestions for fixing the bssid mask setting in ath_opmode_init?
My change, appears to work because it's set in ath9k_add_interface, even
if not in the ath_opmode_init method.

Thanks,
Ben


--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com