diff mbox

[RFCv2,1/6] mac80211: ibss, fix chandef setup for HT40

Message ID 1421404724-32326-1-git-send-email-janusz.dziedzic@tieto.com (mailing list archive)
State RFC
Delegated to: Johannes Berg
Headers show

Commit Message

Janusz.Dziedzic@tieto.com Jan. 16, 2015, 10:38 a.m. UTC
In some cases when used HT40+/HT40-, center_freq1
was configured incorrectly. Next this couse
fall back to HT20.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 net/mac80211/ibss.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Johannes Berg Jan. 16, 2015, 10:49 a.m. UTC | #1
On Fri, 2015-01-16 at 11:38 +0100, Janusz Dziedzic wrote:
> In some cases when used HT40+/HT40-, center_freq1
> was configured incorrectly. Next this couse

couse?

> @@ -407,10 +407,15 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
>  	switch (sdata->u.ibss.chandef.width) {
>  	case NL80211_CHAN_WIDTH_20_NOHT:
>  	case NL80211_CHAN_WIDTH_20:
> -	case NL80211_CHAN_WIDTH_40:
>  		chan_type = cfg80211_get_chandef_type(&sdata->u.ibss.chandef);
>  		cfg80211_chandef_create(&chandef, cbss->channel, chan_type);
>  		break;

Sorry, I don't see the bug. "Sometimes"?

cfg80211_get_chandef_type() will return HT40+/- correctly according to
the chandef, and then you'll use it again to create the chandef - should be OK.

> +       case NL80211_CHAN_WIDTH_40:
> +               cfg80211_chandef_create(&chandef, cbss->channel,
> +                                       NL80211_CHAN_WIDTH_20_NOHT);
> +               chandef.width = sdata->u.ibss.chandef.width;
> +               chandef.center_freq1 =
> sdata->u.ibss.chandef.center_freq1;
> +               break;

Please don't mix chantype stuff and chandef stuff ... just create the
chandef manually if you must. I really think the code above should have
worked though, unless it's using the wrong inputs somehow.

johannes


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Janusz.Dziedzic@tieto.com Jan. 16, 2015, 11:24 a.m. UTC | #2
On 16 January 2015 at 11:49, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Fri, 2015-01-16 at 11:38 +0100, Janusz Dziedzic wrote:
>> In some cases when used HT40+/HT40-, center_freq1
>> was configured incorrectly. Next this couse
>
> couse?
>
>> @@ -407,10 +407,15 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
>>       switch (sdata->u.ibss.chandef.width) {
>>       case NL80211_CHAN_WIDTH_20_NOHT:
>>       case NL80211_CHAN_WIDTH_20:
>> -     case NL80211_CHAN_WIDTH_40:
>>               chan_type = cfg80211_get_chandef_type(&sdata->u.ibss.chandef);
>>               cfg80211_chandef_create(&chandef, cbss->channel, chan_type);
>>               break;
>
> Sorry, I don't see the bug. "Sometimes"?
>
> cfg80211_get_chandef_type() will return HT40+/- correctly according to
> the chandef, and then you'll use it again to create the chandef - should be OK.
>
>> +       case NL80211_CHAN_WIDTH_40:
>> +               cfg80211_chandef_create(&chandef, cbss->channel,
>> +                                       NL80211_CHAN_WIDTH_20_NOHT);
>> +               chandef.width = sdata->u.ibss.chandef.width;
>> +               chandef.center_freq1 =
>> sdata->u.ibss.chandef.center_freq1;
>> +               break;
>
> Please don't mix chantype stuff and chandef stuff ... just create the
> chandef manually if you must. I really think the code above should have
> worked though, unless it's using the wrong inputs somehow.
>
This is scenario:

1) first ibss HT20 run on 5180
2) second ibss configured HT40+ using 36 channel
3) supplicant detect OBSS and decide to switch 40 and HT40-
4) this code confgure chandef->center_freq1 = 5170
5) reg_can_beacon() then fail and we fall back to NOHT_20

So, with patch we will configure center_freq1 connectly and could work
using HT40, no matter we will configure primary/secondary channel as a
control one.
So, we could have same problems when VHT80 will be used - different
control channels configured. With patch even we have different control
channel configured, will fix this and could connect correctly. I am
not sure this is best option here but allow to work.

BR
Janusz
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg Jan. 16, 2015, 11:47 a.m. UTC | #3
On Fri, 2015-01-16 at 12:24 +0100, Janusz Dziedzic wrote:
> On 16 January 2015 at 11:49, Johannes Berg <johannes@sipsolutions.net> wrote:
> > On Fri, 2015-01-16 at 11:38 +0100, Janusz Dziedzic wrote:
> >> In some cases when used HT40+/HT40-, center_freq1
> >> was configured incorrectly. Next this couse
> >
> > couse?
> >
> >> @@ -407,10 +407,15 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
> >>       switch (sdata->u.ibss.chandef.width) {
> >>       case NL80211_CHAN_WIDTH_20_NOHT:
> >>       case NL80211_CHAN_WIDTH_20:
> >> -     case NL80211_CHAN_WIDTH_40:
> >>               chan_type = cfg80211_get_chandef_type(&sdata->u.ibss.chandef);
> >>               cfg80211_chandef_create(&chandef, cbss->channel, chan_type);
> >>               break;
> >
> > Sorry, I don't see the bug. "Sometimes"?
> >
> > cfg80211_get_chandef_type() will return HT40+/- correctly according to
> > the chandef, and then you'll use it again to create the chandef - should be OK.
> >
> >> +       case NL80211_CHAN_WIDTH_40:
> >> +               cfg80211_chandef_create(&chandef, cbss->channel,
> >> +                                       NL80211_CHAN_WIDTH_20_NOHT);
> >> +               chandef.width = sdata->u.ibss.chandef.width;
> >> +               chandef.center_freq1 =
> >> sdata->u.ibss.chandef.center_freq1;
> >> +               break;
> >
> > Please don't mix chantype stuff and chandef stuff ... just create the
> > chandef manually if you must. I really think the code above should have
> > worked though, unless it's using the wrong inputs somehow.
> >
> This is scenario:
> 
> 1) first ibss HT20 run on 5180
> 2) second ibss configured HT40+ using 36 channel
> 3) supplicant detect OBSS and decide to switch 40 and HT40-
> 4) this code confgure chandef->center_freq1 = 5170
> 5) reg_can_beacon() then fail and we fall back to NOHT_20

Sounds more like we store and use invalid data?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Janusz.Dziedzic@tieto.com Jan. 16, 2015, 12:18 p.m. UTC | #4
On 16 January 2015 at 12:47, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Fri, 2015-01-16 at 12:24 +0100, Janusz Dziedzic wrote:
>> On 16 January 2015 at 11:49, Johannes Berg <johannes@sipsolutions.net> wrote:
>> > On Fri, 2015-01-16 at 11:38 +0100, Janusz Dziedzic wrote:
>> >> In some cases when used HT40+/HT40-, center_freq1
>> >> was configured incorrectly. Next this couse
>> >
>> > couse?
>> >
>> >> @@ -407,10 +407,15 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
>> >>       switch (sdata->u.ibss.chandef.width) {
>> >>       case NL80211_CHAN_WIDTH_20_NOHT:
>> >>       case NL80211_CHAN_WIDTH_20:
>> >> -     case NL80211_CHAN_WIDTH_40:
>> >>               chan_type = cfg80211_get_chandef_type(&sdata->u.ibss.chandef);
>> >>               cfg80211_chandef_create(&chandef, cbss->channel, chan_type);
>> >>               break;
>> >
>> > Sorry, I don't see the bug. "Sometimes"?
>> >
>> > cfg80211_get_chandef_type() will return HT40+/- correctly according to
>> > the chandef, and then you'll use it again to create the chandef - should be OK.
>> >
>> >> +       case NL80211_CHAN_WIDTH_40:
>> >> +               cfg80211_chandef_create(&chandef, cbss->channel,
>> >> +                                       NL80211_CHAN_WIDTH_20_NOHT);
>> >> +               chandef.width = sdata->u.ibss.chandef.width;
>> >> +               chandef.center_freq1 =
>> >> sdata->u.ibss.chandef.center_freq1;
>> >> +               break;
>> >
>> > Please don't mix chantype stuff and chandef stuff ... just create the
>> > chandef manually if you must. I really think the code above should have
>> > worked though, unless it's using the wrong inputs somehow.
>> >
>> This is scenario:
>>
>> 1) first ibss HT20 run on 5180
>> 2) second ibss configured HT40+ using 36 channel
>> 3) supplicant detect OBSS and decide to switch 40 and HT40-
>> 4) this code confgure chandef->center_freq1 = 5170
>> 5) reg_can_beacon() then fail and we fall back to NOHT_20
>
> Sounds more like we store and use invalid data?
>
I will check supplicant code then, and maybe skip obss scan when IBSS
already exist in scan results.

BR
Janusz
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index b606b53..13b8105 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -407,10 +407,15 @@  static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
 	switch (sdata->u.ibss.chandef.width) {
 	case NL80211_CHAN_WIDTH_20_NOHT:
 	case NL80211_CHAN_WIDTH_20:
-	case NL80211_CHAN_WIDTH_40:
 		chan_type = cfg80211_get_chandef_type(&sdata->u.ibss.chandef);
 		cfg80211_chandef_create(&chandef, cbss->channel, chan_type);
 		break;
+	case NL80211_CHAN_WIDTH_40:
+		cfg80211_chandef_create(&chandef, cbss->channel,
+					NL80211_CHAN_WIDTH_20_NOHT);
+		chandef.width = sdata->u.ibss.chandef.width;
+		chandef.center_freq1 = sdata->u.ibss.chandef.center_freq1;
+		break;
 	case NL80211_CHAN_WIDTH_5:
 	case NL80211_CHAN_WIDTH_10:
 		cfg80211_chandef_create(&chandef, cbss->channel,