mac80211: support for IEEE80211N in IBSS
Subsystems (2)
RFC 1/1 mac80211: support for IEEE80211N in IBSS
Hey list,
finally i got my (in ath9ks list announced) patch for HT rates in ad-hoc networks ready that has been requested quite often.
I took the initial patches from Benoît Papillault and worked on them. Benoît already implemented setting the HT mode with iw, building and receiving IEs.
I added processing of the IEs when a new station joins the network into the internal station capabilities (struct sta_cap). This is necessary for eg. the rate algo to choose HT rates.
I had to change packet aggretation code to also work in ADHOC iftype.
As already said, the interface mode is set with iw. That mode will also be advertised in the IEs, the additional HT capabilities are taken from the interface capabilities. So there is no option to disable single capabilities as in hostapd yet.
If a station is added through main receive path (ie. a third station sending data to another station), HT is not threat yet. So there may be a initial delay of maximum 100ms (beacon interval) running in legacy. It would require disproportionally much work to implement this.
I tested this with with ath9k and iwlagn cards. Note that for ath9k i worked with minstrel_ht.
You will also need Benoît's patch for iw to set HT mode.
http://ns3.spinics.net/lists/linux-wireless/msg50200.html
You would then be able to setup an IBSS with eg.:
iw wlan0 ibss join my_ht_ibss 2412 HT40+
Alex
include/net/cfg80211.h renamed from /include/net/cfg80211.h +1 -0
@@ -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;
net/mac80211/agg-rx.c renamed from /net/mac80211/agg-rx.c +2 -0
@@ -160,6 +160,8 @@ static void ieee80211_send_addba_resp(stmemcpy (mgmt->bssid, sdata->vif.addr,ETH_ALEN ); else if (sdata->vif.type == NL80211_IFTYPE_STATION) memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) + memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); mgmt->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_ACTION );
net/mac80211/agg-tx.c renamed from /net/mac80211/agg-tx.c +4 -1
@@ -83,6 +83,8 @@ static void ieee80211_send_addba_requestmemcpy (mgmt->bssid, sdata->vif.addr,ETH_ALEN ); else if (sdata->vif.type == NL80211_IFTYPE_STATION) memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) + memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); mgmt->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_ACTION );
@@ -376,7 +378,8 @@ int ieee80211_start_tx_ba_session(struct*/ if (sdata->vif.type !=NL80211_IFTYPE_STATION && sdata->vif.type !=NL80211_IFTYPE_AP_VLAN && - sdata->vif.type !=NL80211_IFTYPE_AP ) + sdata->vif.type !=NL80211_IFTYPE_AP && + sdata->vif.type !=NL80211_IFTYPE_ADHOC )return -EINVAL ;if (test_sta_flags (sta,WLAN_STA_BLOCK_BA )) {
net/mac80211/ht.c renamed from /net/mac80211/ht.c +2 -0
@@ -179,6 +179,8 @@ void ieee80211_send_delba(struct ieee802memcpy (mgmt->bssid, sdata->vif.addr,ETH_ALEN ); else if (sdata->vif.type == NL80211_IFTYPE_STATION) memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); + else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) + memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); mgmt->frame_control =cpu_to_le16 (IEEE80211_FTYPE_MGMT |IEEE80211_STYPE_ACTION );
net/mac80211/ibss.c renamed from /net/mac80211/ibss.c +104 -12
197 lines not on this page · raw message
net/mac80211/ieee80211_i.h renamed from /net/mac80211/ieee80211_i.h +2 -1
@@ -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 */
@@ -1110,7 +1111,7 @@ void ieee80211_ibss_notify_scan_completevoid ieee80211_ibss_setup_sdata (struct ieee80211_sub_if_data *sdata);struct sta_info *ieee80211_ibss_add_sta (struct ieee80211_sub_if_data *sdata,u8 *bssid,u8 *addr,u32 supp_rates, -gfp_t gfp); +struct ieee80211_ht_cap *ht_cap,gfp_t gfp);int ieee80211_ibss_join (struct ieee80211_sub_if_data *sdata,struct cfg80211_ibss_params *params);int ieee80211_ibss_leave (struct ieee80211_sub_if_data *sdata);
net/mac80211/rx.c renamed from /net/mac80211/rx.c +3 -2
@@ -2063,7 +2063,8 @@ ieee80211_rx_h_action(struct ieee80211_r*/ if (sdata->vif.type !=NL80211_IFTYPE_STATION && sdata->vif.type !=NL80211_IFTYPE_AP_VLAN && - sdata->vif.type !=NL80211_IFTYPE_AP ) + sdata->vif.type !=NL80211_IFTYPE_AP && + sdata->vif.type !=NL80211_IFTYPE_ADHOC )break ;/* verify action_code is present */
@@ -2618,7 +2619,7 @@ static int prepare_for_handlers(struct ielse rate_idx = status->rate_idx; rx->sta =ieee80211_ibss_add_sta (sdata, bssid, - hdr->addr2,BIT (rate_idx),GFP_ATOMIC ); + hdr->addr2,BIT (rate_idx),NULL ,GFP_ATOMIC ); }break ;case NL80211_IFTYPE_MESH_POINT :
net/wireless/nl80211.c renamed from /net/wireless/nl80211.c +18 -2
@@ -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 )
Johannes Berg
maintainerQuoted 5 lines · Alexander Simon
Hey list,
finally i got my (in ath9ks list announced) patch for HT rates in ad-hoc networks ready that has been requested quite often.
I took the initial patches from Benoît Papillault and worked on them.
Didn't he have versions that refactored more, like the IE building? That'd be good in any case.
Can you split this up into a few patches and repost inline (not attached) so we can review it more easily?
johannes
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)
RFC 2/4 mac80211: support for IEEE80211N in IBSS
In reply to Johannes BergBuilding the HT IE when we join an IBSS.
I think this patch is rather simple to understand. It takes the configured channel_type and all other else from the interface capabilities (like AMPDU, SGIs). Beamforming is disabled.
This was adopted from ieee80211_build_preq_ies in util.c.
Yeah and you could ease the last changeset.
diff -Nrup compat-wireless-2011-01-17.1//net/mac80211/ibss.c compat-wireless-2011-01-17.2//net/mac80211/ibss.c
--- compat-wireless-2011-01-17.1//net/mac80211/ibss.c 2011-01-20
10:01:56.000000000 +0100
+++ compat-wireless-2011-01-17.2//net/mac80211/ibss.c 2011-01-20
10:02:16.000000000 +0100
@@ -174,6 +174,64 @@ static void __ieee80211_sta_join_ibss(st
memcpy(skb_put(skb, ifibss->ie_len),
ifibss->ie, ifibss->ie_len);
+ if (channel_type != NL80211_CHAN_NO_HT && sband->ht_cap.ht_supported) {
+ u16 cap = sband->ht_cap.cap;
+ struct ieee80211_ht_cap *ht_cap;
+ struct ieee80211_ht_info *ht_info;
+
+ /* Build HT Capabilities */
+ if (ieee80211_disable_40mhz_24ghz &&
+ sband->band == IEEE80211_BAND_2GHZ) {
+ cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
+ cap &= ~IEEE80211_HT_CAP_SGI_40;
+ }
+
+ pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_cap));
+ *pos++ = WLAN_EID_HT_CAPABILITY;
+ *pos++ = sizeof(struct ieee80211_ht_cap);
+ ht_cap = (struct ieee80211_ht_cap *)pos;
+
+ ht_cap->cap_info = cpu_to_le16(cap);
+ ht_cap->ampdu_params_info = sband->ht_cap.ampdu_factor |
+ (sband->ht_cap.ampdu_density <<
+ IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
+ memcpy(&ht_cap->mcs, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
+ ht_cap->extended_ht_cap_info = 0x0000;
+ ht_cap->tx_BF_cap_info = 0x00000000;
+ ht_cap->antenna_selection_info = 0x00;
+
+ /* Build HT Information */
+ pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_info));
+ *pos++ = WLAN_EID_HT_INFORMATION;
+ *pos++ = sizeof(struct ieee80211_ht_info);
+ ht_info = (struct ieee80211_ht_info *)pos;
+
+ ht_info->control_chan =
+ ieee80211_frequency_to_channel(chan->center_freq);
+ ht_info->ht_param = 0x00;
+ switch (local->_oper_channel_type) {
+ case NL80211_CHAN_HT40MINUS:
+ ht_info->ht_param |= IEEE80211_HT_PARAM_CHA_SEC_BELOW;
+ break;
+ case NL80211_CHAN_HT40PLUS:
+ ht_info->ht_param |= IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
+ break;
+ case NL80211_CHAN_HT20:
+ default:
+ ht_info->ht_param |= IEEE80211_HT_PARAM_CHA_SEC_NONE;
+ break;
+ }
+ if (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)
+ ht_info->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY;
+ ht_info->operation_mode = 0x0000;
+ ht_info->stbc_param = 0x0000;
+
+ /* It seems that Basic MCS set and Supported MCS set
+ are identical for the first 10 bytes */
+ memset(&ht_info->basic_set, 0, 16);
+ memcpy(&ht_info->basic_set, &sband->ht_cap.mcs, 10);
+ }
+
if (local->hw.queues >= 4) {
pos = skb_put(skb, 9);
*pos++ = WLAN_EID_VENDOR_SPECIFIC;
@@ -223,6 +281,7 @@ static void ieee80211_sta_join_ibss(stru
int i, j;
u16 beacon_int = cbss->beacon_interval;
enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
+ const u8 *ht_info_ie;
lockdep_assert_held(&sdata->u.ibss.mtx);
@@ -923,11 +982,16 @@ int ieee80211_ibss_join(struct ieee80211
struct sk_buff *skb;
skb = dev_alloc_skb(sdata->local->hw.extra_tx_headroom +
- 36 /* bitrates */ + - 34 /* SSID */ + - 3 /* DS params */ + - 4 /* IBSS params */ + - params->ie_len);
+ sizeof(struct ieee80211_hdr_3addr) +
+ 12 /* struct ieee80211_mgmt.u.beacon */ +
+ 2 + IEEE80211_MAX_SSID_LEN /* max SSID */ +
+ 2 + 8 /* max Supported Rates */ +
+ 3 /* max DS params */ +
+ 4 /* IBSS params */ +
+ 2 + (IEEE80211_MAX_SUPP_RATES - 8) /* max Ext Rates */ +
+ 2 + sizeof(struct ieee80211_ht_cap) +
+ 2 + sizeof(struct ieee80211_ht_info) +
+ params->ie_len);
if (!skb)
return -ENOMEM;
Johannes Berg
maintainerQuoted 3 lines · Alexander Simon
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.
Quoted 4 lines
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.
Quoted 12 lines
This first patch adds setting
nl80211_channel_typefor 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
RFC 3/4 mac80211: support for IEEE80211N in IBSS
In reply to Johannes BergParse a new stations HT IE.ieee80211_ibss_add_sta is called with a new argument, ht capabilities of that new station.
Luckily there was that function ieee80211_ht_cap_ie_to_sta_ht_cap that is called. This inserts these HT capabilities into the sta_info struct that is eg used by the rate algorithm.
As mentioned before, this parameter will be NULL when called from rx.c (main receive path).
diff -Nrup compat-wireless-2011-01-17.2/net/mac80211/ibss.c compat-wireless-2011-01-17.3//net/mac80211/ibss.c
--- compat-wireless-2011-01-17.2/net/mac80211/ibss.c 2011-01-20
10:02:16.000000000 +0100
+++ compat-wireless-2011-01-17.3//net/mac80211/ibss.c 2011-01-20
10:03:11.000000000 +0100
@@ -391,7 +391,7 @@ static void ieee80211_rx_bss_info(struct
}
} else
sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid,
- mgmt->sa, supp_rates,
+ mgmt->sa, supp_rates, elems->ht_cap_elem,
GFP_ATOMIC);
}
@@ -490,7 +490,7 @@ static void ieee80211_rx_bss_info(struct
ieee80211_sta_join_ibss(sdata, bss); supp_rates = ieee80211_sta_get_rates(local, elems, band); ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa,
- supp_rates, GFP_KERNEL);
+ supp_rates, elems->ht_cap_elem, GFP_KERNEL);
}
put_bss:
@@ -503,8 +503,8 @@ static void ieee80211_rx_bss_info(struct
* must be callable in atomic context.
*/
struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
- u8 *bssid,u8 *addr, u32 supp_rates,
- gfp_t gfp)
+ u8 *bssid, u8 *addr, u32 supp_rates,
+ struct ieee80211_ht_cap *ht_cap, gfp_t gfp)
{
struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
struct ieee80211_local *local = sdata->local;
@@ -544,6 +544,10 @@ struct sta_info *ieee80211_ibss_add_sta(
sta->sta.supp_rates[band] = supp_rates |
ieee80211_mandatory_rates(local, band);
+ if (ht_cap)
+ ieee80211_ht_cap_ie_to_sta_ht_cap(local->hw.wiphy->bands[band],
+ ht_cap, &sta->sta.ht_cap);
+
rate_control_rate_init(sta);
/* If it fails, maybe we raced another insertion? */
diff -Nrup compat-wireless-2011-01-17.2/net/mac80211/ieee80211_i.h compat-wireless-2011-01-17.3//net/mac80211/ieee80211_i.h
--- compat-wireless-2011-01-17.2/net/mac80211/ieee80211_i.h 2011-01-20
10:01:56.000000000 +0100
+++ compat-wireless-2011-01-17.3//net/mac80211/ieee80211_i.h 2011-01-20
10:03:11.000000000 +0100
@@ -1111,7 +1111,7 @@ void ieee80211_ibss_notify_scan_complete
void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata); struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
u8 *bssid, u8 *addr, u32 supp_rates,
- gfp_t gfp);
+ struct ieee80211_ht_cap *ht_cap, gfp_t gfp);
int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
struct cfg80211_ibss_params *params);
int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
diff -Nrup compat-wireless-2011-01-17.2/net/mac80211/rx.c compat-wireless-2011-01-17.3//net/mac80211/rx.c
--- compat-wireless-2011-01-17.2/net/mac80211/rx.c 2011-01-17 21:03:26.000000000
+0100
+++ compat-wireless-2011-01-17.3//net/mac80211/rx.c 2011-01-20
10:03:11.000000000 +0100
@@ -2618,7 +2618,7 @@ static int prepare_for_handlers(struct i
else
rate_idx = status->rate_idx;
rx->sta = ieee80211_ibss_add_sta(sdata, bssid,
- hdr->addr2, BIT(rate_idx), GFP_ATOMIC);
+ hdr->addr2, BIT(rate_idx), NULL, GFP_ATOMIC);
}
break;
case NL80211_IFTYPE_MESH_POINT:
RFC 4/4 mac80211: support for IEEE80211N in IBSS
In reply to Johannes BergThis adds some ifs to let the packet aggregation also work while being in IBSS mode.
diff -Nrup compat-wireless-2011-01-17.1/net/mac80211/agg-rx.c compat-wireless-2011-01-17/net/mac80211/agg-rx.c
--- compat-wireless-2011-01-17.1/net/mac80211/agg-rx.c 2011-01-17
21:03:25.000000000 +0100
+++ compat-wireless-2011-01-17/net/mac80211/agg-rx.c 2011-01-19
17:40:36.000000000 +0100
@@ -160,6 +160,8 @@ static void ieee80211_send_addba_resp(st
memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
else if (sdata->vif.type == NL80211_IFTYPE_STATION)
memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
+ else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
+ memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_ACTION);
diff -Nrup compat-wireless-2011-01-17.1/net/mac80211/agg-tx.c compat-wireless-2011-01-17/net/mac80211/agg-tx.c
--- compat-wireless-2011-01-17.1/net/mac80211/agg-tx.c 2011-01-17
21:03:25.000000000 +0100
+++ compat-wireless-2011-01-17/net/mac80211/agg-tx.c 2011-01-19
17:40:36.000000000 +0100
@@ -83,6 +83,8 @@ static void ieee80211_send_addba_request
memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
else if (sdata->vif.type == NL80211_IFTYPE_STATION)
memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
+ else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
+ memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_ACTION);
@@ -376,7 +378,8 @@ int ieee80211_start_tx_ba_session(struct
*/
if (sdata->vif.type != NL80211_IFTYPE_STATION &&
sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
- sdata->vif.type != NL80211_IFTYPE_AP) + sdata->vif.type != NL80211_IFTYPE_AP && + sdata->vif.type != NL80211_IFTYPE_ADHOC)
return -EINVAL;
if (test_sta_flags(sta, WLAN_STA_BLOCK_BA)) {
diff -Nrup compat-wireless-2011-01-17.1/net/mac80211/ht.c compat-wireless-2011-01-17/net/mac80211/ht.c
--- compat-wireless-2011-01-17.1/net/mac80211/ht.c
2011-01-17 21:03:25.000000000 +0100 +++ compat-wireless-2011-01-17/net/mac80211/ht.c 2011-01-19 17:40:36.000000000 +0100
@@ -179,6 +179,8 @@ void ieee80211_send_delba(struct ieee802
memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
else if (sdata->vif.type == NL80211_IFTYPE_STATION)
memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
+ else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
+ memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
IEEE80211_STYPE_ACTION);
diff -Nrup compat-wireless-2011-01-17.1/net/mac80211/rx.c compat-wireless-2011-01-17/net/mac80211/rx.c
--- compat-wireless-2011-01-17.1/net/mac80211/rx.c
2011-01-17 21:03:26.000000000 +0100 +++ compat-wireless-2011-01-17/net/mac80211/rx.c 2011-01-19 17:40:36.000000000 +0100
@@ -2063,7 +2063,8 @@ ieee80211_rx_h_action(struct ieee80211_r
*/
if (sdata->vif.type != NL80211_IFTYPE_STATION &&
sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
- sdata->vif.type != NL80211_IFTYPE_AP) + sdata->vif.type != NL80211_IFTYPE_AP && + sdata->vif.type != NL80211_IFTYPE_ADHOC)
break;
/* verify action_code is present */
Quoted 5 lines · Johannes Berg
Quoted 2 lines · Alexander Simon
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?
Quoted 4 lines
Quoted 1 line
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.
Quoted 9 lines
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
Johannes Berg
maintainerQuoted 3 lines · Alexander Simon
This adds some ifs to let the packet aggregation also work while being in IBSS mode.
Ok this one's a pretty well-split up patch, but
* the subject should be more specific, like "mac80211: allow aggregation in IBSS mode"
* the description should be more results-oriented, for example: "Allow aggregation sessions to be started in IBSS mode." The stuff about "add ifs" really isn't necessary we can all look at the code :-)
* you missed Signed-off-by
* your patch was line-wrapped, so it can't be applied
As for the other three patches, I don't think they were split up well -- the first one should be cfg80211 specific, and 2/3 should probably be just one patch? Also for patches 1-3 the line wrapping in the commit log was very awkward, try to stay < 72 characters per line.
However, if you combine 2 and 3, I still think you need a preliminary patch to do the refactoring between the code that builds the HT IEs for IBSS and ieee80211_add_ht_ie(). In fact, I notice there's similar code in ieee80211_build_preq_ies() so a really good refactoring would take code from both and replace it with a shared version that IBSS becomes the third user of.
Have you seen
http://wireless.kernel.org/en/developers/Documentation/SubmittingPatches?
Thanks for your effort!
johannes
Johannes Berg
maintainerQuoted 5 lines · Alexander Simon
Quoted 2 lines
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.cof 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.
Quoted 2 lines
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.
Quoted 5 lines
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_typeisn't necessary. You could also tell by iw whether to use HT or not. Or no option at all, a module optionibss_htetc. 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
Quoted 3 lines
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.
Ok give me some time and I'll have a look at util.c.
Quoted 4 lines
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.
Actually I don't like git, but when this is getting something bigger,I'll agree to use it :)
Quoted 1 line
Quoted 1 line
But i would appreciate if you could comment on the design of the patch
itself.
Quoted 1 line
Quoted 1 line
Basically i just took Benoits approach and made it running. A separate
option
Quoted 1 line
Quoted 1 line
for setting
channel_typeisn't necessary. You could also tell by iw whether
to
Quoted 1 line
Quoted 1 line
use HT or not. Or no option at all, a module option
ibss_htetc. Or even
setting
Quoted 5 lines
Quoted 1 line
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?
What i mean is, right now there's just one option - setting the HT channel. There could be less (the card automatically enables HT and uses it for a station that advertises HT), or even more (as in hostapd.confs HT section). Or there could be a module option to switch ht for ibss on or off. So, i'm asking about the "ideal" interface...
Johannes Berg
maintainerQuoted 5 lines · Alexander Simon
Quoted 3 lines
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.
Ok give me some time and I'll have a look at
util.c.
Thanks.
Quoted 6 lines
Quoted 3 lines
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.
Actually I don't like git, but when this is getting something bigger,I'll agree to use it :)
I personally rarely use it for the kernel (even if I know how to very well), mostly because rebasing is slow for me ... quilt helps a lot too. If you intend to submit more patches than this series I suggest you learn at least one of them, it'll make your life easier :-)
Quoted 9 lines
Quoted 3 lines
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?
What i mean is, right now there's just one option - setting the HT channel. There could be less (the card automatically enables HT and uses it for a station that advertises HT), or even more (as in hostapd.confs HT section). Or there could be a module option to switch ht for ibss on or off. So, i'm asking about the "ideal" interface...
Hmm, I guess you have a point there -- restricting it to HT40- doesn't make much sense since then you can't merge with another IBSS that is using HT40+. I guess just enable/disable HT makes more sense?
johannes
Hello,
I've already test this patch, but I'm not pretty sure if I'm doing something wrong.
I've applied the patch on the compact-wireless-2-.6.37-4.tar.bz2.
When I create the ibss network and set the channel 1 HT20 It seems that all is going right.
How could i know if the wireless interface is really configured in HT mode? I have transmitted a large file between two laptops and It's not possible to appreciate performance differences with the simple channel 1.
Baldo
I have sacesfully installed the IBSS HT support patches [1] [2], but something wrong happends when the network is created. Any idea why this happens?
[1]
# iw --debug dev wlan0 ibss join "uwicoreHT" 2412 HT20
-- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 36
.nlmsg_type = 2 <ERROR>
.nlmsg_flags = 0 <>
.nlmsg_seq = 1296727732
.nlmsg_pid = 2350
[ERRORMSG] 20 octets
.error = 0 "Success"
[ORIGINAL MESSAGE] 16 octets
.nlmsg_len = 16
.nlmsg_type = 23 <0x17>
.nlmsg_flags = 5 <REQUEST,ACK>
.nlmsg_seq = 1296727732
.nlmsg_pid = 2350
--------------------------- END NETLINK MESSAGE ---------------------------[2]
iw --debug dev wlan0 ibss join "uwicoreHT" 2412 HT40- -- Debug: Received Message:
-------------------------- BEGIN NETLINK MESSAGE ---------------------------
[HEADER] 16 octets
.nlmsg_len = 36
.nlmsg_type = 2 <ERROR>
.nlmsg_flags = 0 <>
.nlmsg_seq = 1296727811
.nlmsg_pid = 2354
[ERRORMSG] 20 octets
.error = 0 "Success"
[ORIGINAL MESSAGE] 16 octets
.nlmsg_len = 16
.nlmsg_type = 23 <0x17>
.nlmsg_flags = 5 <REQUEST,ACK>
.nlmsg_seq = 1296727811
.nlmsg_pid = 2354--------------------------- END NETLINK MESSAGE ---------------------------
[3]
As a result, the iwconfig shows the following:
wlan0 IEEE 802.11abgn ESSID:"uwicoreHT"
Mode:Ad-Hoc Frequency:2.412 GHz Cell: Not-Associated Tx-Power=30 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
(After few seconds the ESSID disappear)
wlan0 IEEE 802.11abgn Mode:Ad-Hoc Frequency:2.412 GHz
Cell: Not-Associated Tx-Power=27 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
1)When I join/create the HT IBSS network (iw dev wlan0 ibss join baldoHT 2412 HT20),my wireless card tries to scan and create several network with different BSSID. [1]
This command [*] should create it.
2)And if I join/create the HT IBSS network adding fixed-freq and fixed-BSSID it happends the same! [2].
Based on the command [*], why it tries to create new BSSIDs?
[*]
Join the IBSS cell with the given SSID, if it doesn't exist create it on the given frequency. When fixed frequency is requested, don't join/create a cell on a different frequency. When a fixed BSSID is requested use that BSSID and do not adopt another cell's BSSID even if it has higher TSF and the same SSID.
[1]
Feb 4 17:47:29 uwicore-desktop kernel: [ 3618.354382] wlan0: Creating new IBSS network, BSSID 5a:48:a7:db:3d:e5 Feb 4 17:47:30 uwicore-desktop wpa_supplicant[900]: No network configuration found for the current AP ... Feb 4 17:49:31 uwicore-desktop kernel: [ 3739.988024] wlan0: Trigger new scan to find an IBSS to join Feb 4 17:49:41 uwicore-desktop kernel: [ 3750.263484] wlan0: Creating new IBSS network, BSSID 52:89:c5:d0:53:19 Feb 4 17:49:42 uwicore-desktop wpa_supplicant[900]: No network configuration found for the current AP Feb 4 17:49:44 uwicore-desktop kernel: [ 3753.000025] wlan0: Trigger new scan
to find an IBSS to join
[2]
Feb 4 17:55:17 uwicore-desktop kernel: [ 4085.420015] wlan0: Creating new IBSS network, BSSID 11:11:11:11:11:11 Feb 4 17:55:17 uwicore-desktop wpa_supplicant[900]: No network configuration found for the current AP Feb 4 17:55:19 uwicore-desktop kernel: [ 4087.988026] wlan0: Trigger new scan to find an IBSS to join Feb 4 17:55:29 uwicore-desktop kernel: [ 4098.274430] wlan0: Creating new IBSS network, BSSID 8a:28:f2:8f:0f:b4 Feb 4 17:55:30 uwicore-desktop wpa_supplicant[900]: No network configuration found for the current AP Feb 4 17:55:32 uwicore-desktop kernel: [ 4101.000037] wlan0: Trigger new scan to find an IBSS to join Feb 4 17:55:42 uwicore-desktop kernel: [ 4111.282690] wlan0: Creating new IBSS
network, BSSID ee:35:37:46:4c:66
Baldomero Coll
Quoted 50 lines · Baldomero Coll
1)When I join/create the HT IBSS network (iw dev wlan0 ibss join baldoHT 2412 HT20),my wireless card tries to scan and create several network with different BSSID. [1]
This command [*] should create it.
2)And if I join/create the HT IBSS network adding fixed-freq and fixed-BSSID it happends the same! [2].
Based on the command [*], why it tries to create new BSSIDs?
[*]
Join the IBSS cell with the given SSID, if it doesn't exist create it on the given frequency. When fixed frequency is requested, don't join/create a cell on a different frequency. When a fixed BSSID is requested use that BSSID and do not adopt another cell's BSSID even if it has higher TSF and the same SSID.[1]
Feb 4 17:47:29 uwicore-desktop kernel: [ 3618.354382] wlan0: Creating new IBSS network, BSSID 5a:48:a7:db:3d:e5
Feb 4 17:47:30 uwicore-desktop wpa_supplicant[900]: No network configuration found for the current AP
...
Feb 4 17:49:31 uwicore-desktop kernel: [ 3739.988024] wlan0: Trigger new scan to find an IBSS to join
Feb 4 17:49:41 uwicore-desktop kernel: [ 3750.263484] wlan0: Creating new IBSS network, BSSID 52:89:c5:d0:53:19
Feb 4 17:49:42 uwicore-desktop wpa_supplicant[900]: No network configuration found for the current AP
Feb 4 17:49:44 uwicore-desktop kernel: [ 3753.000025] wlan0: Trigger new scan to find an IBSS to join[2]
Feb 4 17:55:17 uwicore-desktop kernel: [ 4085.420015] wlan0: Creating new IBSS network, BSSID 11:11:11:11:11:11
Feb 4 17:55:17 uwicore-desktop wpa_supplicant[900]: No network configuration found for the current AP
Feb 4 17:55:19 uwicore-desktop kernel: [ 4087.988026] wlan0: Trigger new scan to find an IBSS to join
Feb 4 17:55:29 uwicore-desktop kernel: [ 4098.274430] wlan0: Creating new IBSS network, BSSID 8a:28:f2:8f:0f:b4
Feb 4 17:55:30 uwicore-desktop wpa_supplicant[900]: No network configuration found for the current AP
Feb 4 17:55:32 uwicore-desktop kernel: [ 4101.000037] wlan0: Trigger new scan to find an IBSS to join
Feb 4 17:55:42 uwicore-desktop kernel: [ 4111.282690] wlan0: Creating new IBSS network, BSSID ee:35:37:46:4c:66
Quoted 1 line
Baldomero Coll
So, are you using iw, or are you using wpa_supplicant? Your previous email had the iw command, but now this email has a warning message coming out of wpa_supplicant. Do you have NetworkManager running? I have no problems setting up an 802.11n IBSS network using iw.
-Brian