linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] cfg80211: Add channel type for IBSS
@ 2011-04-12 10:42 Alexander Simon
  2011-04-12 11:04 ` [PATCH 2/4] nl80211: Add NL80211_ATTR_WIPHY_CHANNEL_TYPE " Alexander Simon
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Alexander Simon @ 2011-04-12 10:42 UTC (permalink / raw)
  To: linux-wireless

Needed for IBSS IEEE802.11N operation

* Add ht channel type for cfg80211 IBSS configuration

Signed-off-by: Alexander Simon <alexander.simon@saxnet.de>
---
 cfg80211.h |    1 +
 1 file changed, 1 insertion(+)

diff -Nrup a/include/net/cfg80211.h b/include/net/cfg80211.h
--- a/include/net/cfg80211.h	2011-03-31 21:04:02.000000000 +0200
+++ b/include/net/cfg80211.h	2011-04-12 08:49:19.000000000 +0200
@@ -964,6 +964,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;



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/4] nl80211: Add NL80211_ATTR_WIPHY_CHANNEL_TYPE for IBSS
  2011-04-12 10:42 [PATCH 1/4] cfg80211: Add channel type for IBSS Alexander Simon
@ 2011-04-12 11:04 ` Alexander Simon
  2011-04-12 11:08   ` Johannes Berg
  2011-04-12 11:06 ` [PATCH 3/4] mac80211: Add function to build HT caps Alexander Simon
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 18+ messages in thread
From: Alexander Simon @ 2011-04-12 11:04 UTC (permalink / raw)
  To: linux-wireless

Needed for IBSS IEEE802.11N operation

* Add a new attribute NL80211_ATTR_WIPHY_CHANNEL_TYPE to specify
    a HT channel type for IBSS

Signed-off-by: Alexander Simon <alexander.simon@saxnet.de>
---
 nl80211.c |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff -Nrup a/net/wireless/nl80211.c b/net/wireless/nl80211.c
--- a/net/wireless/nl80211.c	2011-03-31 21:04:02.000000000 +0200
+++ b/net/wireless/nl80211.c	2011-04-12 08:49:19.000000000 +0200
@@ -3927,8 +3927,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)




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/4] mac80211: Add function to build HT caps
  2011-04-12 10:42 [PATCH 1/4] cfg80211: Add channel type for IBSS Alexander Simon
  2011-04-12 11:04 ` [PATCH 2/4] nl80211: Add NL80211_ATTR_WIPHY_CHANNEL_TYPE " Alexander Simon
@ 2011-04-12 11:06 ` Alexander Simon
  2011-04-12 11:16   ` Johannes Berg
  2011-04-12 11:07 ` [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS Alexander Simon
  2011-04-26 19:11 ` [PATCH 1/4] cfg80211: Add channel type " John W. Linville
  3 siblings, 1 reply; 18+ messages in thread
From: Alexander Simon @ 2011-04-12 11:06 UTC (permalink / raw)
  To: linux-wireless

Some refracturing work.

Add a new function ieee80211_ie_build_ht_cap in util.c.
Use this shared code from ieee80211_build_preq_ies (util.c) and
ieee80211_add_ht_ie (work.c)

This will be used from ibss.c also.

Signed-off-by: Alexander Simon <alexander.simon@saxnet.de>
---
 ieee80211_i.h |    2 ++
 util.c        |   54 +++++++++++++++++++++++++++++++++++++-----------------
 work.c        |   29 +----------------------------
 3 files changed, 40 insertions(+), 45 deletions(-)

diff -Nrup a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
--- a/net/mac80211/ieee80211_i.h	2011-03-31 21:04:02.000000000 +0200
+++ b/net/mac80211/ieee80211_i.h	2011-04-12 09:55:16.000000000 +0200
@@ -1351,6 +1352,8 @@ void ieee80211_recalc_smps(struct ieee80
 size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
 			  const u8 *ids, int n_ids, size_t offset);
 size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
+u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_supported_band *sband,
+                              u16 cap);
 
 /* internal work items */
 void ieee80211_work_init(struct ieee80211_local *local);
diff -Nrup a/net/mac80211/util.c b/net/mac80211/util.c
--- a/net/mac80211/util.c	2011-03-31 21:04:02.000000000 +0200
+++ b/net/mac80211/util.c	2011-04-12 09:55:48.000000000 +0200
@@ -1007,23 +1007,8 @@ int ieee80211_build_preq_ies(struct ieee
 		offset = noffset;
 	}
 
-	if (sband->ht_cap.ht_supported) {
-		u16 cap = sband->ht_cap.cap;
-		__le16 tmp;
-
-		*pos++ = WLAN_EID_HT_CAPABILITY;
-		*pos++ = sizeof(struct ieee80211_ht_cap);
-		memset(pos, 0, sizeof(struct ieee80211_ht_cap));
-		tmp = cpu_to_le16(cap);
-		memcpy(pos, &tmp, sizeof(u16));
-		pos += sizeof(u16);
-		*pos++ = sband->ht_cap.ampdu_factor |
-			 (sband->ht_cap.ampdu_density <<
-				IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
-		memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
-		pos += sizeof(sband->ht_cap.mcs);
-		pos += 2 + 4 + 1; /* ext info, BF cap, antsel */
-	}
+	if (sband->ht_cap.ht_supported)
+		pos = ieee80211_ie_build_ht_cap(pos, sband, sband->ht_cap.cap);
 
 	/*
 	 * If adding more here, adjust code in main.c
@@ -1443,3 +1428,38 @@ size_t ieee80211_ie_split_vendor(const u
 
 	return pos;
 }
+
+u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_supported_band *sband,
+                              u16 cap)
+{
+	__le16 tmp;
+
+	*pos++ = WLAN_EID_HT_CAPABILITY;
+	*pos++ = sizeof(struct ieee80211_ht_cap);
+	memset(pos, 0, sizeof(struct ieee80211_ht_cap));
+
+	/* capability flags */
+	tmp = cpu_to_le16(cap);
+	memcpy(pos, &tmp, sizeof(u16));
+	pos += sizeof(u16);
+
+	/* AMPDU parameters */
+	*pos++ = sband->ht_cap.ampdu_factor |
+		 (sband->ht_cap.ampdu_density <<
+			IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
+
+	/* MCS set */
+	memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
+	pos += sizeof(sband->ht_cap.mcs);
+
+	/* extended capabilities */
+	pos += sizeof(__le16);
+
+	/* BF capabilities */
+	pos += sizeof(__le32);
+
+	/* antenna selection */
+	pos += sizeof(u8);
+
+	return pos;
+}
diff -Nrup a/net/mac80211/work.c b/net/mac80211/work.c
--- a/net/mac80211/work.c	2011-03-31 21:04:01.000000000 +0200
+++ b/net/mac80211/work.c	2011-04-12 09:43:30.000000000 +0200
@@ -110,7 +110,6 @@ static void ieee80211_add_ht_ie(struct s
 	u8 *pos;
 	u32 flags = channel->flags;
 	u16 cap = sband->ht_cap.cap;
-	__le16 tmp;
 
 	if (!sband->ht_cap.ht_supported)
 		return;
@@ -161,34 +160,8 @@ static void ieee80211_add_ht_ie(struct s
 	}
 
 	/* reserve and fill IE */
-
 	pos = skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2);
-	*pos++ = WLAN_EID_HT_CAPABILITY;
-	*pos++ = sizeof(struct ieee80211_ht_cap);
-	memset(pos, 0, sizeof(struct ieee80211_ht_cap));
-
-	/* capability flags */
-	tmp = cpu_to_le16(cap);
-	memcpy(pos, &tmp, sizeof(u16));
-	pos += sizeof(u16);
-
-	/* AMPDU parameters */
-	*pos++ = sband->ht_cap.ampdu_factor |
-		 (sband->ht_cap.ampdu_density <<
-			IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
-
-	/* MCS set */
-	memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
-	pos += sizeof(sband->ht_cap.mcs);
-
-	/* extended capabilities */
-	pos += sizeof(__le16);
-
-	/* BF capabilities */
-	pos += sizeof(__le32);
-
-	/* antenna selection */
-	pos += sizeof(u8);
+	ieee80211_ie_build_ht_cap(pos, sband, cap);
 }
 
 static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS
  2011-04-12 10:42 [PATCH 1/4] cfg80211: Add channel type for IBSS Alexander Simon
  2011-04-12 11:04 ` [PATCH 2/4] nl80211: Add NL80211_ATTR_WIPHY_CHANNEL_TYPE " Alexander Simon
  2011-04-12 11:06 ` [PATCH 3/4] mac80211: Add function to build HT caps Alexander Simon
@ 2011-04-12 11:07 ` Alexander Simon
  2011-04-12 11:19   ` Johannes Berg
  2011-04-26 19:11 ` [PATCH 1/4] cfg80211: Add channel type " John W. Linville
  3 siblings, 1 reply; 18+ messages in thread
From: Alexander Simon @ 2011-04-12 11:07 UTC (permalink / raw)
  To: linux-wireless

Okay, here we go. Hopefully this meets your requirements.

* Use HT IEs from other stations for rate algo
* Parameter to set HT channel type for IBSS join
* Build HT IEs when joining an IBSS
* Allow frame aggregation sessions for IBSS

HT operation will only be started for a station after receiving a beacon.
So there may be a delay running in legacy when adding a station from a data
packet to a third station (prepare_for_handlers).

Signed-off-by: Alexander Simon <alexander.simon@saxnet.de>
---
 agg-rx.c      |    2 +
 agg-tx.c      |    5 ++-
 ht.c          |    2 +
 ibss.c        |   94 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
 ieee80211_i.h |    3 +
 rx.c          |    5 +--
 6 files changed, 95 insertions(+), 16 deletions(-)

diff -Nrup a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
--- a/net/mac80211/agg-rx.c	2011-03-31 21:04:01.000000000 +0200
+++ b/net/mac80211/agg-rx.c	2011-04-12 08:49:19.000000000 +0200
@@ -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 a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
--- a/net/mac80211/agg-tx.c	2011-03-31 21:04:01.000000000 +0200
+++ b/net/mac80211/agg-tx.c	2011-04-12 08:49:19.000000000 +0200
@@ -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);
@@ -377,7 +379,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 a/net/mac80211/ht.c b/net/mac80211/ht.c
--- a/net/mac80211/ht.c	2011-03-31 21:04:01.000000000 +0200
+++ b/net/mac80211/ht.c	2011-04-12 08:49:19.000000000 +0200
@@ -182,6 +182,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 a/net/mac80211/ibss.c b/net/mac80211/ibss.c
--- a/net/mac80211/ibss.c	2011-03-31 21:04:01.000000000 +0200
+++ b/net/mac80211/ibss.c	2011-04-12 10:23:09.000000000 +0200
@@ -65,6 +65,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)
 {
@@ -78,6 +79,7 @@ static void __ieee80211_sta_join_ibss(st
 	struct cfg80211_bss *bss;
 	u32 bss_change;
 	u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
+	struct ieee80211_ht_info *ht_info;
 
 	lockdep_assert_held(&ifibss->mtx);
 
@@ -106,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];
@@ -172,6 +174,42 @@ 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) {
+		pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_cap));
+		ieee80211_ie_build_ht_cap(pos, sband, sband->ht_cap.cap);
+
+		/* 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;
@@ -220,6 +258,8 @@ 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;
+	const u8 *ht_info_ie;
 
 	lockdep_assert_held(&sdata->u.ibss.mtx);
 
@@ -243,9 +283,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);
@@ -310,7 +370,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);
 		}
 
@@ -405,7 +465,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:
@@ -418,8 +478,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;
@@ -459,6 +519,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? */
@@ -561,7 +625,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);
 }
 
@@ -898,11 +962,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;
 
@@ -922,13 +991,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 a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
--- a/net/mac80211/ieee80211_i.h	2011-03-31 21:04:02.000000000 +0200
+++ b/net/mac80211/ieee80211_i.h	2011-04-12 09:55:16.000000000 +0200
@@ -439,6 +439,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 */
@@ -1107,7 +1108,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 a/net/mac80211/rx.c b/net/mac80211/rx.c
--- a/net/mac80211/rx.c	2011-03-31 21:04:01.000000000 +0200
+++ b/net/mac80211/rx.c	2011-04-12 08:49:19.000000000 +0200
@@ -2118,7 +2118,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 */
@@ -2674,7 +2675,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:



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/4] nl80211: Add NL80211_ATTR_WIPHY_CHANNEL_TYPE for IBSS
  2011-04-12 11:04 ` [PATCH 2/4] nl80211: Add NL80211_ATTR_WIPHY_CHANNEL_TYPE " Alexander Simon
@ 2011-04-12 11:08   ` Johannes Berg
  0 siblings, 0 replies; 18+ messages in thread
From: Johannes Berg @ 2011-04-12 11:08 UTC (permalink / raw)
  To: Alexander Simon; +Cc: linux-wireless

On Tue, 2011-04-12 at 11:04 +0000, Alexander Simon wrote:
> Needed for IBSS IEEE802.11N operation
> 
> * Add a new attribute NL80211_ATTR_WIPHY_CHANNEL_TYPE to specify
>     a HT channel type for IBSS

> -	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;

Please use Linux coding style.

> +	ibss.channel = rdev_freq_to_chan(rdev,
> +		nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]),
> +		ibss.channel_type);

I don't think that is sufficient. Need to check that IBSS is allowed on
both channels, maybe with a function like can_beacon_sec_chan.

johannes


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/4] mac80211: Add function to build HT caps
  2011-04-12 11:06 ` [PATCH 3/4] mac80211: Add function to build HT caps Alexander Simon
@ 2011-04-12 11:16   ` Johannes Berg
  2011-04-12 11:22     ` Alexander Simon
  0 siblings, 1 reply; 18+ messages in thread
From: Johannes Berg @ 2011-04-12 11:16 UTC (permalink / raw)
  To: Alexander Simon; +Cc: linux-wireless

On Tue, 2011-04-12 at 11:06 +0000, Alexander Simon wrote:

> +u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_supported_band *sband,
> +                              u16 cap)

It makes no sense to pass cap as an argument since it's taken from the
sband.

johannes


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS
  2011-04-12 11:07 ` [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS Alexander Simon
@ 2011-04-12 11:19   ` Johannes Berg
  2011-04-28 12:13     ` Alexander Simon
  0 siblings, 1 reply; 18+ messages in thread
From: Johannes Berg @ 2011-04-12 11:19 UTC (permalink / raw)
  To: Alexander Simon; +Cc: linux-wireless

On Tue, 2011-04-12 at 11:07 +0000, Alexander Simon wrote:

>  	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 */ +

You have a tendency to mess up the coding style.

Also what if the IBSS is created with HT40+ and then joins, can it join
HT40-? Is the channel type "advisory" like the frequency? Can it join
HT20 IBSS as well?

johannes


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 3/4] mac80211: Add function to build HT caps
  2011-04-12 11:16   ` Johannes Berg
@ 2011-04-12 11:22     ` Alexander Simon
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Simon @ 2011-04-12 11:22 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

Am Dienstag, den 12.04.2011, 13:16 +0200 schrieb Johannes Berg:
> On Tue, 2011-04-12 at 11:06 +0000, Alexander Simon wrote:
> 
> > +u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_supported_band *sband,
> > +                              u16 cap)
> 
> It makes no sense to pass cap as an argument since it's taken from the
> sband.
> 
> johannes
> 
Not true, in ieee80211_add_ht_ie in work.c cap is modified before.

Alex


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] cfg80211: Add channel type for IBSS
  2011-04-12 10:42 [PATCH 1/4] cfg80211: Add channel type for IBSS Alexander Simon
                   ` (2 preceding siblings ...)
  2011-04-12 11:07 ` [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS Alexander Simon
@ 2011-04-26 19:11 ` John W. Linville
  2011-04-28 12:15   ` Alexander Simon
  3 siblings, 1 reply; 18+ messages in thread
From: John W. Linville @ 2011-04-26 19:11 UTC (permalink / raw)
  To: Alexander Simon; +Cc: linux-wireless

On Tue, Apr 12, 2011 at 12:42:44PM +0200, Alexander Simon wrote:
> Needed for IBSS IEEE802.11N operation
> 
> * Add ht channel type for cfg80211 IBSS configuration
> 
> Signed-off-by: Alexander Simon <alexander.simon@saxnet.de>

Are you going to resubmit this series after addressing Johannes's comments?

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS
  2011-04-12 11:19   ` Johannes Berg
@ 2011-04-28 12:13     ` Alexander Simon
  2011-04-28 12:56       ` Johannes Berg
  0 siblings, 1 reply; 18+ messages in thread
From: Alexander Simon @ 2011-04-28 12:13 UTC (permalink / raw)
  To: linux-wireless

> Also what if the IBSS is created with HT40+ and then joins, can it join
> HT40-? Is the channel type "advisory" like the frequency? Can it join
> HT20 IBSS as well?
HT type can`t be advisory, as there may be stations without n.

Our card is set to HT40+/- if set by iw.
Some other station is added into our internal station list by its HT beacons.
E.g. if we have configured HT40- and there is someone with HT40+, minstrel_ht
should use HT20 only. But i admit it seems cleaner to AND both caps.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/4] cfg80211: Add channel type for IBSS
  2011-04-26 19:11 ` [PATCH 1/4] cfg80211: Add channel type " John W. Linville
@ 2011-04-28 12:15   ` Alexander Simon
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Simon @ 2011-04-28 12:15 UTC (permalink / raw)
  To: linux-wireless

Yes, i am.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS
  2011-04-28 12:13     ` Alexander Simon
@ 2011-04-28 12:56       ` Johannes Berg
  2011-04-29  6:54         ` Alexander Simon
  0 siblings, 1 reply; 18+ messages in thread
From: Johannes Berg @ 2011-04-28 12:56 UTC (permalink / raw)
  To: Alexander Simon; +Cc: linux-wireless

On Thu, 2011-04-28 at 12:13 +0000, Alexander Simon wrote:
> > Also what if the IBSS is created with HT40+ and then joins, can it join
> > HT40-? Is the channel type "advisory" like the frequency? Can it join
> > HT20 IBSS as well?
> HT type can`t be advisory, as there may be stations without n.

Yeah, but it's possible to still communicate with them.

> Our card is set to HT40+/- if set by iw.
> Some other station is added into our internal station list by its HT beacons.
> E.g. if we have configured HT40- and there is someone with HT40+, minstrel_ht
> should use HT20 only. But i admit it seems cleaner to AND both caps.

Well. You need to consider more than just this. I have a feeling you're
only considering fixed channel use cases. But if we configure HT40+, and
then find a peer on a channel that may only use HT40-, then what?

johannes


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS
  2011-04-28 12:56       ` Johannes Berg
@ 2011-04-29  6:54         ` Alexander Simon
  2011-04-29  7:21           ` Johannes Berg
  0 siblings, 1 reply; 18+ messages in thread
From: Alexander Simon @ 2011-04-29  6:54 UTC (permalink / raw)
  To: linux-wireless

> Well. You need to consider more than just this. I have a feeling you're
> only considering fixed channel use cases. But if we configure HT40+, and
> then find a peer on a channel that may only use HT40-, then what?

Good point. But still i think this is the same case. Right now, the card would
still be set into HT40+, regardless of the frequency. Then, minstrel_ht would
just use HT20, i suppose.

My proposal would be making the HT iw argument non-advisory: Use it when
creating a network, discard it when joining one.

I also will do some refactoring in nl80211.c in order to check main and
extension channel.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS
  2011-04-29  6:54         ` Alexander Simon
@ 2011-04-29  7:21           ` Johannes Berg
  2011-04-29  8:37             ` Alexander Simon
  0 siblings, 1 reply; 18+ messages in thread
From: Johannes Berg @ 2011-04-29  7:21 UTC (permalink / raw)
  To: Alexander Simon; +Cc: linux-wireless

On Fri, 2011-04-29 at 06:54 +0000, Alexander Simon wrote:
> > Well. You need to consider more than just this. I have a feeling you're
> > only considering fixed channel use cases. But if we configure HT40+, and
> > then find a peer on a channel that may only use HT40-, then what?
> 
> Good point. But still i think this is the same case. Right now, the card would
> still be set into HT40+, regardless of the frequency. Then, minstrel_ht would
> just use HT20, i suppose.
> 
> My proposal would be making the HT iw argument non-advisory: Use it when
> creating a network, discard it when joining one.

Yeah it would be an option to just always join as HT if HT is available,
but not create as HT unless asked.

johannes


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS
  2011-04-29  7:21           ` Johannes Berg
@ 2011-04-29  8:37             ` Alexander Simon
  2011-04-29 12:36               ` Alexander Simon
  0 siblings, 1 reply; 18+ messages in thread
From: Alexander Simon @ 2011-04-29  8:37 UTC (permalink / raw)
  To: linux-wireless

> Yeah it would be an option to just always join as HT if HT is available,
> but not create as HT unless asked.
Ok. I just had a few thoughts about this:
This way an ht ibss has to be created from a (patched) mac80211 HT
hardware. There would be no way to "convert" an existing g network into
n.
Additionally, if a non-ht implementation joins the network, it will
advertise it as non-ht. If a second ht-station joins from one of these
beacons, it won't use ht.

This way a single non-ht station could destroy a ht ibss.


I Think the best way to go would be to obey HT information when joining
HT but using the HT iw parameter when joining non-ht.

Then we could have the following scenario: Non-HT station A creates
non-HT.
HT station B joins and sets HT- (from iw). HT station C joins from A but
doesn't see B. It's iw parameter says ht+.
But when B comes closer to C do a "HT merge", comparing TSFs.

Conclusion:
- Create an ibss with the iw parameter
- When joining a ht ibss, use its parameters
- When joining non-ht, add ht from iw parameter
- When encounter a different ht config, do a ht merge.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS
  2011-04-29  8:37             ` Alexander Simon
@ 2011-04-29 12:36               ` Alexander Simon
  2011-04-29 12:39                 ` Johannes Berg
  0 siblings, 1 reply; 18+ messages in thread
From: Alexander Simon @ 2011-04-29 12:36 UTC (permalink / raw)
  To: linux-wireless

Sorry for replying to myself but i'll try to explain this a little bit
easier:

- If the channel is not *fixed*, the channel type is only advisory.
This means that a merge of two HT40 networks with fixed channels will
only take place if the HT40 configuration equals.

- When merging, the looser will obey the winner's HT configuration if
there is one. If not, keep the old one.

- If HT has been configured through iw and a non-HT network is to be
joined, iw's HT setting is used and announced.

HT configuration within an IBSS may get inhomogeneous as a HT station
may join from a non-HT beacon but there are other HT members.

- When receiving a different HT configuration from another member of our
BSSID, use this configuration (first beacon wins)

Alex



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS
  2011-04-29 12:36               ` Alexander Simon
@ 2011-04-29 12:39                 ` Johannes Berg
  2011-04-29 12:50                   ` Alexander Simon
  0 siblings, 1 reply; 18+ messages in thread
From: Johannes Berg @ 2011-04-29 12:39 UTC (permalink / raw)
  To: Alexander Simon; +Cc: linux-wireless

On Fri, 2011-04-29 at 14:36 +0200, Alexander Simon wrote:


> - If HT has been configured through iw and a non-HT network is to be
> joined, iw's HT setting is used and announced.

This isn't possible, you might join a network on a channel that doesn't
allow HT40+ for example.

johannes


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS
  2011-04-29 12:39                 ` Johannes Berg
@ 2011-04-29 12:50                   ` Alexander Simon
  0 siblings, 0 replies; 18+ messages in thread
From: Alexander Simon @ 2011-04-29 12:50 UTC (permalink / raw)
  To: linux-wireless

> > - If HT has been configured through iw and a non-HT network is to be
> > joined, iw's HT setting is used and announced.
> 
> This isn't possible, you might join a network on a channel that doesn't
> allow HT40+ for example.
Of course it must be checked.
It has to be checked even when joining HT networks.
E.g. a european user travels to America and opens an HT+ Network on
channel 9. The american card should disable HT40+.



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-04-29 12:50 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-12 10:42 [PATCH 1/4] cfg80211: Add channel type for IBSS Alexander Simon
2011-04-12 11:04 ` [PATCH 2/4] nl80211: Add NL80211_ATTR_WIPHY_CHANNEL_TYPE " Alexander Simon
2011-04-12 11:08   ` Johannes Berg
2011-04-12 11:06 ` [PATCH 3/4] mac80211: Add function to build HT caps Alexander Simon
2011-04-12 11:16   ` Johannes Berg
2011-04-12 11:22     ` Alexander Simon
2011-04-12 11:07 ` [PATCH 4/4] mac80211: Add IEEE802.11n for IBSS Alexander Simon
2011-04-12 11:19   ` Johannes Berg
2011-04-28 12:13     ` Alexander Simon
2011-04-28 12:56       ` Johannes Berg
2011-04-29  6:54         ` Alexander Simon
2011-04-29  7:21           ` Johannes Berg
2011-04-29  8:37             ` Alexander Simon
2011-04-29 12:36               ` Alexander Simon
2011-04-29 12:39                 ` Johannes Berg
2011-04-29 12:50                   ` Alexander Simon
2011-04-26 19:11 ` [PATCH 1/4] cfg80211: Add channel type " John W. Linville
2011-04-28 12:15   ` Alexander Simon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).