diff mbox

[v2,3/4] mac80211: initialize rate control earlier for tdls station

Message ID 1424850911-21017-4-git-send-email-marek.puzyniak@tieto.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Marek Puzyniak Feb. 25, 2015, 7:55 a.m. UTC
Currently when TDLS station in driver goes from assoc
to authorized state it can not use rate control parameters
because rate control is not initialized yet. Some drivers
require parameters already initialized by rate control when
entering authorized state. It can be done by initializing
rate control after station transition to authorized state
but before notifying driver about that.

Signed-off-by: Marek Puzyniak <marek.puzyniak@tieto.com>
---
 net/mac80211/cfg.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

Comments

Johannes Berg Feb. 27, 2015, 12:50 p.m. UTC | #1
+Arik.

It'd be nice (for me anyway) if you didn't send this in a series of
other patches I don't care about - I only ever saw this due to
patchwork.

On Wed, 2015-02-25 at 08:55 +0100, Marek Puzyniak wrote:
> Currently when TDLS station in driver goes from assoc
> to authorized state it can not use rate control parameters
> because rate control is not initialized yet. Some drivers
> require parameters already initialized by rate control when
> entering authorized state. It can be done by initializing
> rate control after station transition to authorized state
> but before notifying driver about that.

Arik, you have a similar patch handling only NSS. Does this one look
fine to you, and would it solve the problem your other patch solved?

johannes
Arik Nemtsov March 1, 2015, 8:21 a.m. UTC | #2
On Fri, Feb 27, 2015 at 2:50 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> +Arik.
>
> It'd be nice (for me anyway) if you didn't send this in a series of
> other patches I don't care about - I only ever saw this due to
> patchwork.
>
> On Wed, 2015-02-25 at 08:55 +0100, Marek Puzyniak wrote:
>> Currently when TDLS station in driver goes from assoc
>> to authorized state it can not use rate control parameters
>> because rate control is not initialized yet. Some drivers
>> require parameters already initialized by rate control when
>> entering authorized state. It can be done by initializing
>> rate control after station transition to authorized state
>> but before notifyiIEEE80211_STA_ASSOCng driver about that.
>
> Arik, you have a similar patch handling only NSS. Does this one look
> fine to you, and would it solve the problem your other patch solved?

Well currently iwlmvm requires the NSS to be set before
IEEE80211_STA_ASSOC (earlier), so this doesn't help directly.
I could change mvm a bit to make it work, but I don't really see a
good reason for it :)

The patch looks good. Shouldn't introduce new issues (at least for iwlwifi).

Arik
Johannes Berg March 3, 2015, 9:18 a.m. UTC | #3
On Sun, 2015-03-01 at 10:21 +0200, Arik Nemtsov wrote:

> > Arik, you have a similar patch handling only NSS. Does this one look
> > fine to you, and would it solve the problem your other patch solved?
> 
> Well currently iwlmvm requires the NSS to be set before
> IEEE80211_STA_ASSOC (earlier), so this doesn't help directly.
> I could change mvm a bit to make it work, but I don't really see a
> good reason for it :)
> 
> The patch looks good. Shouldn't introduce new issues (at least for iwlwifi).

Ok, thanks. Do you think it would be possible to move all of this before
ASSOC?

(if not, why not, and how is it that we have valid NSS if we don't have
the remaining data valid?)

johannes
Arik Nemtsov March 3, 2015, 10:02 a.m. UTC | #4
On Tue, Mar 3, 2015 at 11:18 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Sun, 2015-03-01 at 10:21 +0200, Arik Nemtsov wrote:
>
>> > Arik, you have a similar patch handling only NSS. Does this one look
>> > fine to you, and would it solve the problem your other patch solved?
>>
>> Well currently iwlmvm requires the NSS to be set before
>> IEEE80211_STA_ASSOC (earlier), so this doesn't help directly.
>> I could change mvm a bit to make it work, but I don't really see a
>> good reason for it :)
>>
>> The patch looks good. Shouldn't introduce new issues (at least for iwlwifi).
>
> Ok, thanks. Do you think it would be possible to move all of this before
> ASSOC?

We can probably move his rate_control_rate_init() to assoc, since we have this:

/*
* TDLS -- everything follows authorized, but
* only becoming authorized is possible, not
* going back
*/
if (set & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
set |= BIT(NL80211_STA_FLAG_AUTHENTICATED) |
      BIT(NL80211_STA_FLAG_ASSOCIATED);
mask |= BIT(NL80211_STA_FLAG_AUTHENTICATED) |
BIT(NL80211_STA_FLAG_ASSOCIATED);
}
Johannes Berg March 3, 2015, 10:06 a.m. UTC | #5
On Tue, 2015-03-03 at 12:02 +0200, Arik Nemtsov wrote:
> On Tue, Mar 3, 2015 at 11:18 AM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > On Sun, 2015-03-01 at 10:21 +0200, Arik Nemtsov wrote:
> >
> >> > Arik, you have a similar patch handling only NSS. Does this one look
> >> > fine to you, and would it solve the problem your other patch solved?
> >>
> >> Well currently iwlmvm requires the NSS to be set before
> >> IEEE80211_STA_ASSOC (earlier), so this doesn't help directly.
> >> I could change mvm a bit to make it work, but I don't really see a
> >> good reason for it :)
> >>
> >> The patch looks good. Shouldn't introduce new issues (at least for iwlwifi).
> >
> > Ok, thanks. Do you think it would be possible to move all of this before
> > ASSOC?
> 
> We can probably move his rate_control_rate_init() to assoc, since we have this:

And doing so would also address the nss problem, right? IIRC that's done
in the rate control init inline.

johannes
Arik Nemtsov March 3, 2015, 10:07 a.m. UTC | #6
On Tue, Mar 3, 2015 at 12:06 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2015-03-03 at 12:02 +0200, Arik Nemtsov wrote:
>> On Tue, Mar 3, 2015 at 11:18 AM, Johannes Berg
>> <johannes@sipsolutions.net> wrote:
>> > On Sun, 2015-03-01 at 10:21 +0200, Arik Nemtsov wrote:
>> >
>> >> > Arik, you have a similar patch handling only NSS. Does this one look
>> >> > fine to you, and would it solve the problem your other patch solved?
>> >>
>> >> Well currently iwlmvm requires the NSS to be set before
>> >> IEEE80211_STA_ASSOC (earlier), so this doesn't help directly.
>> >> I could change mvm a bit to make it work, but I don't really see a
>> >> good reason for it :)
>> >>
>> >> The patch looks good. Shouldn't introduce new issues (at least for iwlwifi).
>> >
>> > Ok, thanks. Do you think it would be possible to move all of this before
>> > ASSOC?
>>
>> We can probably move his rate_control_rate_init() to assoc, since we have this:
>
> And doing so would also address the nss problem, right? IIRC that's done
> in the rate control init inline.

Right.

Arik
Johannes Berg March 4, 2015, 8:16 a.m. UTC | #7
On Tue, 2015-03-03 at 12:07 +0200, Arik Nemtsov wrote:

> > And doing so would also address the nss problem, right? IIRC that's done
> > in the rate control init inline.
> 
> Right.

Can one of you (Marek/Arik) send a combined patch then please? :)

johannes
Arik Nemtsov March 4, 2015, 10:04 a.m. UTC | #8
On Wed, Mar 4, 2015 at 10:16 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2015-03-03 at 12:07 +0200, Arik Nemtsov wrote:
>
>> > And doing so would also address the nss problem, right? IIRC that's done
>> > in the rate control init inline.
>>
>> Right.
>
> Can one of you (Marek/Arik) send a combined patch then please? :)

I can do it, but I'll probably only get to it next week.

Arik
Marek Puzyniak March 4, 2015, 10:38 a.m. UTC | #9
On 4 March 2015 at 11:04, Arik Nemtsov <arik@wizery.com> wrote:
> I can do it, but I'll probably only get to it next week.

I will try to prepare patch this week, if not I will wait for Arik's
proposition.

For ath10k rate control need to be initialised before moving to
STA_AUTHORIZED, so initialising rate control before STA_ASSOC is
perfectly fine.

Marek
Kalle Valo March 4, 2015, 3:01 p.m. UTC | #10
Johannes Berg <johannes@sipsolutions.net> writes:

> +Arik.
>
> It'd be nice (for me anyway) if you didn't send this in a series of
> other patches I don't care about - I only ever saw this due to
> patchwork.

Yes, mac80211 and driver patches need to be sent in separate series. I
will drop this series for now, please resend ath10k patches separetely.

AND please clearly document what mac80211 patches the ath10k patches
depend on.
diff mbox

Patch

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index dd4ff36..ae24ed3 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -983,12 +983,21 @@  static int sta_apply_auth_flags(struct ieee80211_local *local,
 	}
 
 	if (mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
-		if (set & BIT(NL80211_STA_FLAG_AUTHORIZED))
+		if (set & BIT(NL80211_STA_FLAG_AUTHORIZED)) {
+			/*
+			 * When peer becomes authorized, init rate control as
+			 * well. Some drivers require rate control initialized
+			 * before drv_sta_state() is called.
+			 */
+			if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
+				rate_control_rate_init(sta);
+
 			ret = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED);
-		else if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
+		} else if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
 			ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
-		else
+		} else {
 			ret = 0;
+		}
 		if (ret)
 			return ret;
 	}
@@ -1377,11 +1386,6 @@  static int ieee80211_change_station(struct wiphy *wiphy,
 	if (err)
 		goto out_err;
 
-	/* When peer becomes authorized, init rate control as well */
-	if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) &&
-	    test_sta_flag(sta, WLAN_STA_AUTHORIZED))
-		rate_control_rate_init(sta);
-
 	mutex_unlock(&local->sta_mtx);
 
 	if ((sdata->vif.type == NL80211_IFTYPE_AP ||