2011-01-20 09:15:06

by Alexander Simon

[permalink] [raw]
Subject: [RFC 1/4] mac80211: support for IEEE80211N in IBSS

Ok, here we go.

What do you mean with a "not so refactoring version"? I am adding a new IE.
These are only insertions, no other changes. Or do you mean that dev_alloc_skb?
However, i took the last "try" from Benoit.

I split my patch into 4 sections: Setting channel_type, Building the HT IE when
joining an IBSS, parse the HT IE of a newly joined station and enable
aggregation code for IBSS.

This first patch adds setting nl80211_channel_type for an IBSS. This is mostly
Benoits work.
When a IBSS to connect to is given by iw, there is a new argument to set HT20,
HT40+ or HT40-.
When we create an IBSS, we have that struct params where we can find the channel
type set by iw.
When we join a already existing IBSS, we don't. If we find a HT IE, then we will
distinguish our channel type by that.
Here the problem remains if a legacy station has joined a HT IBSS and we got its
beacon. Then we'll won't have an HT IE... This has to be fixed, maybe something
like "found a HT20 STA, switching to HT20. And now found a HT40-, switching to
HT40-"

diff -Nrup compat-wireless-2011-01-17/include/net/cfg80211.h
compat-wireless-2011-01-17.1//include/net/cfg80211.h
--- compat-wireless-2011-01-17/include/net/cfg80211.h 2011-01-17
21:03:26.000000000 +0100
+++ compat-wireless-2011-01-17.1//include/net/cfg80211.h 2011-01-20
09:56:01.000000000 +0100
@@ -960,6 +960,7 @@ struct cfg80211_ibss_params {
u8 *ssid;
u8 *bssid;
struct ieee80211_channel *channel;
+ enum nl80211_channel_type channel_type;
u8 *ie;
u8 ssid_len, ie_len;
u16 beacon_interval;
diff -Nrup compat-wireless-2011-01-17/net/mac80211/ibss.c
compat-wireless-2011-01-17.1//net/mac80211/ibss.c
--- compat-wireless-2011-01-17/net/mac80211/ibss.c 2011-01-17 21:03:25.000000000
+0100
+++ compat-wireless-2011-01-17.1//net/mac80211/ibss.c 2011-01-20
09:56:01.000000000 +0100
@@ -66,6 +66,7 @@ static void ieee80211_rx_mgmt_auth_ibss(
static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
const u8 *bssid, const int beacon_int,
struct ieee80211_channel *chan,
+ enum nl80211_channel_type channel_type,
const u32 basic_rates,
const u16 capability, u64 tsf)
{
@@ -107,7 +108,7 @@ static void __ieee80211_sta_join_ibss(st
sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;

local->oper_channel = chan;
- WARN_ON(!ieee80211_set_channel_type(local, sdata, NL80211_CHAN_NO_HT));
+ WARN_ON(!ieee80211_set_channel_type(local, sdata, channel_type));
ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);

sband = local->hw.wiphy->bands[chan->band];
@@ -221,6 +222,7 @@ static void ieee80211_sta_join_ibss(stru
u32 basic_rates;
int i, j;
u16 beacon_int = cbss->beacon_interval;
+ enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;

lockdep_assert_held(&sdata->u.ibss.mtx);

@@ -244,9 +246,29 @@ static void ieee80211_sta_join_ibss(stru
}
}

+ /* parse HT Information IE, if present */
+ ht_info_ie = ieee80211_bss_get_ie(cbss, WLAN_EID_HT_INFORMATION);
+ if (ht_info_ie) {
+ const struct ieee80211_ht_info *ht_info =
+ (const struct ieee80211_ht_info *)(ht_info_ie + 2);
+
+ switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
+ case IEEE80211_HT_PARAM_CHA_SEC_NONE:
+ channel_type = NL80211_CHAN_HT20;
+ break;
+ case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
+ channel_type = NL80211_CHAN_HT40PLUS;
+ break;
+ case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
+ channel_type = NL80211_CHAN_HT40MINUS;
+ break;
+ }
+ }
+
__ieee80211_sta_join_ibss(sdata, cbss->bssid,
beacon_int,
cbss->channel,
+ channel_type,
basic_rates,
cbss->capability,
cbss->tsf);
@@ -565,7 +587,7 @@ static void ieee80211_sta_create_ibss(st
sdata->drop_unencrypted = 0;

__ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
- ifibss->channel, ifibss->basic_rates,
+ ifibss->channel, ifibss->channel_type, ifibss->basic_rates,
capability, 0);
}

@@ -925,13 +947,14 @@ int ieee80211_ibss_join(struct ieee80211
sdata->vif.bss_conf.beacon_int = params->beacon_interval;

sdata->u.ibss.channel = params->channel;
+ sdata->u.ibss.channel_type = params->channel_type;
sdata->u.ibss.fixed_channel = params->channel_fixed;

/* fix ourselves to that channel now already */
if (params->channel_fixed) {
sdata->local->oper_channel = params->channel;
WARN_ON(!ieee80211_set_channel_type(sdata->local, sdata,
- NL80211_CHAN_NO_HT));
+ params->channel_type));
}

if (params->ie) {
diff -Nrup compat-wireless-2011-01-17/net/mac80211/ieee80211_i.h
compat-wireless-2011-01-17.1//net/mac80211/ieee80211_i.h
--- compat-wireless-2011-01-17/net/mac80211/ieee80211_i.h 2011-01-17
21:03:26.000000000 +0100
+++ compat-wireless-2011-01-17.1//net/mac80211/ieee80211_i.h 2011-01-20
09:56:01.000000000 +0100
@@ -438,6 +438,7 @@ struct ieee80211_if_ibss {
u8 ssid_len, ie_len;
u8 *ie;
struct ieee80211_channel *channel;
+ enum nl80211_channel_type channel_type;

unsigned long ibss_join_req;
/* probe response/beacon for IBSS */
diff -Nrup compat-wireless-2011-01-17/net/wireless/nl80211.c
compat-wireless-2011-01-17.1//net/wireless/nl80211.c
--- compat-wireless-2011-01-17/net/wireless/nl80211.c 2011-01-17
21:03:26.000000000 +0100
+++ compat-wireless-2011-01-17.1//net/wireless/nl80211.c 2011-01-20
09:56:01.000000000 +0100
@@ -3907,8 +3907,24 @@ static int nl80211_join_ibss(struct sk_b
ibss.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]);
}

- ibss.channel = ieee80211_get_channel(wiphy,
- nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]));
+ if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) {
+ enum nl80211_channel_type channel_type;
+
+ channel_type = nla_get_u32(
+ info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]);
+ if (channel_type != NL80211_CHAN_NO_HT &&
+ channel_type != NL80211_CHAN_HT20 &&
+ channel_type != NL80211_CHAN_HT40PLUS &&
+ channel_type != NL80211_CHAN_HT40MINUS)
+ return -EINVAL;
+ ibss.channel_type = channel_type;
+ } else {
+ ibss.channel_type = NL80211_CHAN_NO_HT;
+ }
+
+ ibss.channel = rdev_freq_to_chan(rdev,
+ nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]),
+ ibss.channel_type);
if (!ibss.channel ||
ibss.channel->flags & IEEE80211_CHAN_NO_IBSS ||
ibss.channel->flags & IEEE80211_CHAN_DISABLED)




2011-01-20 09:24:31

by Johannes Berg

[permalink] [raw]
Subject: Re: [RFC 1/4] mac80211: support for IEEE80211N in IBSS

On Thu, 2011-01-20 at 09:10 +0000, Alexander Simon wrote:

> What do you mean with a "not so refactoring version"? I am adding a new IE.
> These are only insertions, no other changes. Or do you mean that dev_alloc_skb?
> However, i took the last "try" from Benoit.

Well, then maybe I just discussed this with him -- there's similar code
building the HT IEs for stations, that code should be shared.

> I split my patch into 4 sections: Setting channel_type, Building the HT IE when
> joining an IBSS, parse the HT IE of a newly joined station and enable
> aggregation code for IBSS.
>
> This first patch adds setting nl80211_channel_type for an IBSS. This is mostly
> Benoits work.
> When a IBSS to connect to is given by iw, there is a new argument to set HT20,
> HT40+ or HT40-.
> When we create an IBSS, we have that struct params where we can find the channel
> type set by iw.
> When we join a already existing IBSS, we don't. If we find a HT IE, then we will
> distinguish our channel type by that.
> Here the problem remains if a legacy station has joined a HT IBSS and we got its
> beacon. Then we'll won't have an HT IE... This has to be fixed, maybe something
> like "found a HT20 STA, switching to HT20. And now found a HT40-, switching to
> HT40-"


Yes all of that might be necessary, but can you post patches that do one
thing at a time? Like at least one cfg80211/nl80211 patch that adds the
configurability, and then a mac80211 patch that will use it.

Also, I think cfg80211 should support advertising to userspace that it's
supported.

Yes, I sometimes accept combined cfg80211/mac80211 patches, but I think
this feature is bigger than that.

johannes



2011-01-20 09:54:45

by Johannes Berg

[permalink] [raw]
Subject: Re: [RFC 1/4] mac80211: support for IEEE80211N in IBSS

On Thu, 2011-01-20 at 09:48 +0000, Alexander Simon wrote:

> > Well, then maybe I just discussed this with him -- there's similar code
> > building the HT IEs for stations, that code should be shared.

> So you mean my patch 2/4? It could work but you would have to change util.c of
> course. I was pretty sure you wouldn't have accepted that.

Of course I'd accept that :-) Reducing duplicated code is good, and I
can deal with patches touching many files. Though it'd be nice to do the
necessary refactoring first.

A nice touch, btw, would be if you included a diffstat. Maybe you should
look at using quilt or git to submit patches which help you automate a
lot of things.


> Ok, separating cfg from mac. No big deal. I'll have to look how to advertise
> something...

Look at WIPHY_FLAG_IBSS_RSN in net/wireless and net/mac80211 -- that's
how things can be advertised. Also, for this one of course you have
NL80211_ATTR_SUPPORT_IBSS_RSN.

> But i would appreciate if you could comment on the design of the patch itself.
> Basically i just took Benoits approach and made it running. A separate option
> for setting channel_type isn't necessary. You could also tell by iw whether to
> use HT or not. Or no option at all, a module option ibss_ht etc. Or even setting
> full options as hostapd does via iw.

I'm sorry, I don't understand what you mean by "a separate option"? With
the approach that you've posted patches for you need to tell iw whether
you want HT or not, right?

johannes


2011-01-20 09:49:12

by Alexander Simon

[permalink] [raw]
Subject: Re: [RFC 1/4] mac80211: support for IEEE80211N in IBSS

Johannes Berg <johannes@...> writes:

>
> On Thu, 2011-01-20 at 09:10 +0000, Alexander Simon wrote:
>
> > What do you mean with a "not so refactoring version"? I am adding a new IE.
> > These are only insertions, no other changes. Or do you mean that
dev_alloc_skb?
> > However, i took the last "try" from Benoit.
>
> Well, then maybe I just discussed this with him -- there's similar code
> building the HT IEs for stations, that code should be shared.
So you mean my patch 2/4? It could work but you would have to change util.c of
course. I was pretty sure you wouldn't have accepted that.

> Yes all of that might be necessary, but can you post patches that do one
> thing at a time? Like at least one cfg80211/nl80211 patch that adds the
> configurability, and then a mac80211 patch that will use it.
>
> Also, I think cfg80211 should support advertising to userspace that it's
> supported.
>
> Yes, I sometimes accept combined cfg80211/mac80211 patches, but I think
> this feature is bigger than that.

Ok, separating cfg from mac. No big deal. I'll have to look how to advertise
something...

But i would appreciate if you could comment on the design of the patch itself.
Basically i just took Benoits approach and made it running. A separate option
for setting channel_type isn't necessary. You could also tell by iw whether to
use HT or not. Or no option at all, a module option ibss_ht etc. Or even setting
full options as hostapd does via iw.

Thanks, Alex