All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Add support for 5 and 10 MHz channels
@ 2013-05-09 18:10 a
  2013-05-09 18:10 ` [PATCH 1/8] nl80211/cfg80211: add 5 and 10 MHz defines and wiphy flag a
                   ` (9 more replies)
  0 siblings, 10 replies; 17+ messages in thread
From: a @ 2013-05-09 18:10 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Mathias Kretschmer, Simon Wunderlich

From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

This patchset adds support for 5 and 10 MHz in nl80211/cfg80211/mac80211
and enables support in ath5k and ath9k, which already support this feature
on the driver side. 5 and 10 MHz wide channels might be useful for:

 * long shot links, as the transmissions are more robust
 * future support for 802.11y which allows some 5 and 10 MHz channels in
   3.6 GHz range
 * future support for 802.11p which uses 10 MHz in 5.9 GHz range
 * ... and more "special" applications.

Note that the transmissions are only defined for the OFDM PHY in the
standard and are therefore limited to 5 GHz, no HT or MIMO here. However,
at least my AR5K and AR9K based chips seem to support this mode on 2.4 GHz
as well. Datarates are halfed or quartered, leaving up to 27 Mbit/s or
13.5 Mbit/s gross rates respectively.

Some benchmark results (IBSS, iperf, ath9k on AR9220, ath5k on AR5213A):

 * ath5k -> ath5k:
	5.23 Mbit/s @ 5 MHz
	10.8 Mbit/s @ 10 MHz
	19.1 Mbit/s @ 20 MHz (NOHT mode)
 * ath9k -> ath9k:
	5.24 Mbit/s @ 5 MHz
	10.9 Mbit/s @ 10 MHz
	16.4 Mbit/s @ 20 MHz (NOHT mode, appears to be a little bit low though)

Comments:
 * Is there any special requirement for handling beacons? For example,
   rates are halfed or quartered, but some rates could not be represented
   in the rate IEs. For example, 2.25 mbit/s can not be represented as
   multiple of 500 kbps.
 * therefore, all rates are handled like the corresponding 20 MHz rates
   internally, which makes a lot of things easier (no changes required
   for rc-algos, beacon creation, etc...). We might consider adjusting the
   output of rates for nl80211 or radiotap, though.

As always, any comments are appreciated!
Cheers,
	Simon



Simon Wunderlich (8):
  nl80211/cfg80211: add 5 and 10 MHz defines and wiphy flag
  mac80211: fix various components for the new 5 and 10 MHz widths
  mac80211: change IBSS channel state to chandef
  mac80211: fix timing for 5 MHz and 10 MHz channels
  nl80211: allow 5 and 10 MHz channels for IBSS
  ath9k: convert to chandef, enable support for 5/10 MHz channels
  ath9k: announce that ath9k supports 5/10 MHz
  ath5k: enable support for 5 MHz and 10 MHz channels

 drivers/net/wireless/ath/ath5k/ath5k.h        |    1 +
 drivers/net/wireless/ath/ath5k/base.c         |   25 +++++++--
 drivers/net/wireless/ath/ath5k/base.h         |    2 +-
 drivers/net/wireless/ath/ath5k/mac80211-ops.c |    2 +-
 drivers/net/wireless/ath/ath9k/common.c       |   67 +++++++++++++++----------
 drivers/net/wireless/ath/ath9k/common.h       |    3 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |    5 +-
 drivers/net/wireless/ath/ath9k/init.c         |    5 +-
 drivers/net/wireless/ath/ath9k/main.c         |    8 ++-
 drivers/net/wireless/ath/ath9k/rc.c           |    4 +-
 include/net/cfg80211.h                        |    2 +
 include/uapi/linux/nl80211.h                  |    4 ++
 net/mac80211/ibss.c                           |   24 +++++----
 net/mac80211/ieee80211_i.h                    |   45 +++++++++++++++--
 net/mac80211/mesh.c                           |    4 +-
 net/mac80211/mesh_plink.c                     |    8 ++-
 net/mac80211/mlme.c                           |   12 +++++
 net/mac80211/rate.c                           |    8 ++-
 net/mac80211/rc80211_minstrel.c               |   14 ++++--
 net/mac80211/rc80211_minstrel_ht.c            |    8 +--
 net/mac80211/tx.c                             |   10 ++--
 net/mac80211/util.c                           |   43 +++++++++++-----
 net/wireless/chan.c                           |   29 +++++++++++
 net/wireless/nl80211.c                        |   23 +++++++--
 24 files changed, 266 insertions(+), 90 deletions(-)

-- 
1.7.10.4


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

* [PATCH 1/8] nl80211/cfg80211: add 5 and 10 MHz defines and wiphy flag
  2013-05-09 18:10 [PATCH 0/8] Add support for 5 and 10 MHz channels a
@ 2013-05-09 18:10 ` a
  2013-05-09 18:10 ` [PATCH 2/8] mac80211: fix various components for the new 5 and 10 MHz widths a
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: a @ 2013-05-09 18:10 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Mathias Kretschmer, Simon Wunderlich

From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

Add defines for 5 and 10 MHz channel width and fix channel
handling functions accordingly.

Also check for and report the WIPHY_FLAG_SUPPORTS_5_10_MHZ
capability.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 include/net/cfg80211.h       |    2 ++
 include/uapi/linux/nl80211.h |    4 ++++
 net/wireless/chan.c          |   29 +++++++++++++++++++++++++++++
 net/wireless/nl80211.c       |   21 +++++++++++++++++----
 4 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 26e9113..2aeecfa 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2321,6 +2321,7 @@ struct cfg80211_ops {
  *	responds to probe-requests in hardware.
  * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
  * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
+ * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
  */
 enum wiphy_flags {
 	WIPHY_FLAG_CUSTOM_REGULATORY		= BIT(0),
@@ -2344,6 +2345,7 @@ enum wiphy_flags {
 	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
 	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
 	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
+	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
 };
 
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index b484307..ed4f106 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2738,6 +2738,8 @@ enum nl80211_channel_type {
  *	and %NL80211_ATTR_CENTER_FREQ2 attributes must be provided as well
  * @NL80211_CHAN_WIDTH_160: 160 MHz channel, the %NL80211_ATTR_CENTER_FREQ1
  *	attribute must be provided as well
+ * @NL80211_CHAN_WIDTH_5: 5 MHz OFDM channel
+ * @NL80211_CHAN_WIDTH_10: 10 MHz OFDM channel
  */
 enum nl80211_chan_width {
 	NL80211_CHAN_WIDTH_20_NOHT,
@@ -2746,6 +2748,8 @@ enum nl80211_chan_width {
 	NL80211_CHAN_WIDTH_80,
 	NL80211_CHAN_WIDTH_80P80,
 	NL80211_CHAN_WIDTH_160,
+	NL80211_CHAN_WIDTH_5,
+	NL80211_CHAN_WIDTH_10,
 };
 
 /**
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index fd556ac..4052815 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -54,6 +54,8 @@ bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)
 	control_freq = chandef->chan->center_freq;
 
 	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_5:
+	case NL80211_CHAN_WIDTH_10:
 	case NL80211_CHAN_WIDTH_20:
 	case NL80211_CHAN_WIDTH_20_NOHT:
 		if (chandef->center_freq1 != control_freq)
@@ -152,6 +154,12 @@ static int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c)
 	int width;
 
 	switch (c->width) {
+	case NL80211_CHAN_WIDTH_5:
+		width = 5;
+		break;
+	case NL80211_CHAN_WIDTH_10:
+		width = 10;
+		break;
 	case NL80211_CHAN_WIDTH_20:
 	case NL80211_CHAN_WIDTH_20_NOHT:
 		width = 20;
@@ -194,6 +202,16 @@ cfg80211_chandef_compatible(const struct cfg80211_chan_def *c1,
 	if (c1->width == c2->width)
 		return NULL;
 
+	/*
+	 * can't be compatible if one of them are 5 or 10 MHz,
+	 * but they have not the same width.
+	 */
+	if (c1->width == NL80211_CHAN_WIDTH_5 ||
+	    c1->width == NL80211_CHAN_WIDTH_10 ||
+	    c2->width == NL80211_CHAN_WIDTH_5 ||
+	    c2->width == NL80211_CHAN_WIDTH_10)
+		return NULL;
+
 	if (c1->width == NL80211_CHAN_WIDTH_20_NOHT ||
 	    c1->width == NL80211_CHAN_WIDTH_20)
 		return c2;
@@ -349,6 +367,12 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
 	control_freq = chandef->chan->center_freq;
 
 	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_5:
+		width = 5;
+		break;
+	case NL80211_CHAN_WIDTH_10:
+		width = 10;
+		break;
 	case NL80211_CHAN_WIDTH_20:
 		if (!ht_cap->ht_supported)
 			return false;
@@ -405,6 +429,11 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
 	if (width > 20)
 		prohibited_flags |= IEEE80211_CHAN_NO_OFDM;
 
+	/* 5 and 10 MHz are only defined for the OFDM PHY */
+	if (width < 20)
+		prohibited_flags |= IEEE80211_CHAN_NO_OFDM;
+
+
 	if (!cfg80211_secondary_chans_ok(wiphy, chandef->center_freq1,
 					 width, prohibited_flags))
 		return false;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 9cdcd9e..f67d825 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1228,6 +1228,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
 		if ((dev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP) &&
 		    nla_put_flag(msg, NL80211_ATTR_TDLS_EXTERNAL_SETUP))
 			goto nla_put_failure;
+		if ((dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_5_10_MHZ) &&
+		    nla_put_flag(msg, WIPHY_FLAG_SUPPORTS_5_10_MHZ))
+			goto nla_put_failure;
 
 		(*split_start)++;
 		if (split)
@@ -1771,6 +1774,11 @@ static int nl80211_parse_chandef(struct cfg80211_registered_device *rdev,
 				     IEEE80211_CHAN_DISABLED))
 		return -EINVAL;
 
+	if ((chandef->width == NL80211_CHAN_WIDTH_5 ||
+	     chandef->width == NL80211_CHAN_WIDTH_10) &&
+	    !(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_5_10_MHZ))
+		return -EINVAL;
+
 	return 0;
 }
 
@@ -6326,11 +6334,16 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
 	if (!cfg80211_reg_can_beacon(&rdev->wiphy, &ibss.chandef))
 		return -EINVAL;
 
-	if (ibss.chandef.width > NL80211_CHAN_WIDTH_40)
-		return -EINVAL;
-	if (ibss.chandef.width != NL80211_CHAN_WIDTH_20_NOHT &&
-	    !(rdev->wiphy.features & NL80211_FEATURE_HT_IBSS))
+	switch (ibss.chandef.width) {
+	case NL80211_CHAN_WIDTH_20_NOHT:
+		break;
+	case NL80211_CHAN_WIDTH_20:
+	case NL80211_CHAN_WIDTH_40:
+		if (rdev->wiphy.features & NL80211_FEATURE_HT_IBSS)
+			break;
+	default:
 		return -EINVAL;
+	}
 
 	ibss.channel_fixed = !!info->attrs[NL80211_ATTR_FREQ_FIXED];
 	ibss.privacy = !!info->attrs[NL80211_ATTR_PRIVACY];
-- 
1.7.10.4


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

* [PATCH 2/8] mac80211: fix various components for the new 5 and 10 MHz widths
  2013-05-09 18:10 [PATCH 0/8] Add support for 5 and 10 MHz channels a
  2013-05-09 18:10 ` [PATCH 1/8] nl80211/cfg80211: add 5 and 10 MHz defines and wiphy flag a
@ 2013-05-09 18:10 ` a
  2013-05-09 18:31   ` Felix Fietkau
  2013-05-09 18:10 ` [PATCH 3/8] mac80211: change IBSS channel state to chandef a
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: a @ 2013-05-09 18:10 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Mathias Kretschmer, Simon Wunderlich

From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

This is a collection of minor fixes:
 * don't allow HT IEs in IBSS for 5/10 MHz
 * don't allow HT IEs in Mesh for 5/10 MHz
 * consider 5 and 10 MHz channels when downgrading
 * don't try HT rates for 5 and 10 MHz channels when selecting rates

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 net/mac80211/ibss.c       |    2 ++
 net/mac80211/mesh.c       |    4 +++-
 net/mac80211/mesh_plink.c |    8 +++++++-
 net/mac80211/mlme.c       |   12 ++++++++++++
 net/mac80211/rate.c       |    8 +++++++-
 5 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 170f9a7..4e1fb81 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -176,6 +176,8 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
 
 	/* add HT capability and information IEs */
 	if (chandef.width != NL80211_CHAN_WIDTH_20_NOHT &&
+	    chandef.width != NL80211_CHAN_WIDTH_5 &&
+	    chandef.width != NL80211_CHAN_WIDTH_10 &&
 	    sband->ht_cap.ht_supported) {
 		pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap,
 						sband->ht_cap.cap);
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 6952760..5227b73 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -417,7 +417,9 @@ int mesh_add_ht_cap_ie(struct ieee80211_sub_if_data *sdata,
 
 	sband = local->hw.wiphy->bands[band];
 	if (!sband->ht_cap.ht_supported ||
-	    sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT)
+	    sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
+	    sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
+	    sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
 		return 0;
 
 	if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap))
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 09bebed..02c05fa 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -154,8 +154,14 @@ static u32 mesh_set_ht_prot_mode(struct ieee80211_sub_if_data *sdata)
 	u16 ht_opmode;
 	bool non_ht_sta = false, ht20_sta = false;
 
-	if (sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT)
+	switch (sdata->vif.bss_conf.chandef.width) {
+	case NL80211_CHAN_WIDTH_20_NOHT:
+	case NL80211_CHAN_WIDTH_5:
+	case NL80211_CHAN_WIDTH_10:
 		return 0;
+	default:
+		break;
+	}
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(sta, &local->sta_list, list) {
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2bfcdda..07cb2f3 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -224,6 +224,12 @@ static u32 chandef_downgrade(struct cfg80211_chan_def *c)
 		c->width = NL80211_CHAN_WIDTH_20_NOHT;
 		ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT;
 		break;
+	case NL80211_CHAN_WIDTH_5:
+	case NL80211_CHAN_WIDTH_10:
+		WARN_ON_ONCE(1);
+		/* keep c->width */
+		ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT;
+		break;
 	}
 
 	WARN_ON_ONCE(!cfg80211_chandef_valid(c));
@@ -3850,6 +3856,12 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
 	 */
 	ret = ieee80211_vif_use_channel(sdata, &chandef,
 					IEEE80211_CHANCTX_SHARED);
+
+	/* don't downgrade for 5 and 10 MHz channels, though. */
+	if (chandef.width == NL80211_CHAN_WIDTH_5 ||
+	    chandef.width == NL80211_CHAN_WIDTH_10)
+		return ret;
+
 	while (ret && chandef.width != NL80211_CHAN_WIDTH_20_NOHT) {
 		ifmgd->flags |= chandef_downgrade(&chandef);
 		ret = ieee80211_vif_use_channel(sdata, &chandef,
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index d3f414f..dbbcd57 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -397,8 +397,14 @@ static void rate_idx_match_mask(struct ieee80211_tx_rate *rate,
 			return;
 
 		/* if HT BSS, and we handle a data frame, also try HT rates */
-		if (chan_width == NL80211_CHAN_WIDTH_20_NOHT)
+		switch (chan_width) {
+		case NL80211_CHAN_WIDTH_20_NOHT:
+		case NL80211_CHAN_WIDTH_5:
+		case NL80211_CHAN_WIDTH_10:
 			return;
+		default:
+			break;
+		}
 
 		alt_rate.idx = 0;
 		/* keep protection flags */
-- 
1.7.10.4


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

* [PATCH 3/8] mac80211: change IBSS channel state to chandef
  2013-05-09 18:10 [PATCH 0/8] Add support for 5 and 10 MHz channels a
  2013-05-09 18:10 ` [PATCH 1/8] nl80211/cfg80211: add 5 and 10 MHz defines and wiphy flag a
  2013-05-09 18:10 ` [PATCH 2/8] mac80211: fix various components for the new 5 and 10 MHz widths a
@ 2013-05-09 18:10 ` a
  2013-05-09 18:10 ` [PATCH 4/8] mac80211: fix timing for 5 MHz and 10 MHz channels a
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: a @ 2013-05-09 18:10 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Mathias Kretschmer, Simon Wunderlich

From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

This should make some parts cleaner and is also required for handling
5/10 MHz properly.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 net/mac80211/ibss.c        |   22 +++++++++++-----------
 net/mac80211/ieee80211_i.h |    3 +--
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 4e1fb81..ef07b65 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -81,7 +81,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
 
 	sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
 
-	cfg80211_chandef_create(&chandef, chan, ifibss->channel_type);
+	chandef = ifibss->chandef;
 	if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) {
 		chandef.width = NL80211_CHAN_WIDTH_20;
 		chandef.center_freq1 = chan->center_freq;
@@ -514,7 +514,9 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 			set_sta_flag(sta, WLAN_STA_WME);
 
 		if (sta && elems->ht_operation && elems->ht_cap_elem &&
-		    sdata->u.ibss.channel_type != NL80211_CHAN_NO_HT) {
+		    sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_20_NOHT &&
+		    sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_5 &&
+		    sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_10) {
 			/* we both use HT */
 			struct ieee80211_ht_cap htcap_ie;
 			struct cfg80211_chan_def chandef;
@@ -529,8 +531,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 			 * fall back to HT20 if we don't use or use
 			 * the other extension channel
 			 */
-			if (cfg80211_get_chandef_type(&chandef) !=
-						sdata->u.ibss.channel_type)
+			if (chandef.center_freq1 !=
+			    sdata->u.ibss.chandef.center_freq1)
 				htcap_ie.cap_info &=
 					cpu_to_le16(~IEEE80211_HT_CAP_SUP_WIDTH_20_40);
 
@@ -569,7 +571,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 
 	/* different channel */
 	if (sdata->u.ibss.fixed_channel &&
-	    sdata->u.ibss.channel != cbss->channel)
+	    sdata->u.ibss.chandef.chan != cbss->channel)
 		goto put_bss;
 
 	/* different SSID */
@@ -757,7 +759,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
 		sdata->drop_unencrypted = 0;
 
 	__ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int,
-				  ifibss->channel, ifibss->basic_rates,
+				  ifibss->chandef.chan, ifibss->basic_rates,
 				  capability, 0, true);
 }
 
@@ -789,7 +791,7 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
 	if (ifibss->fixed_bssid)
 		bssid = ifibss->bssid;
 	if (ifibss->fixed_channel)
-		chan = ifibss->channel;
+		chan = ifibss->chandef.chan;
 	if (!is_zero_ether_addr(ifibss->bssid))
 		bssid = ifibss->bssid;
 	cbss = cfg80211_get_bss(local->hw.wiphy, chan, bssid,
@@ -1059,9 +1061,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
 
 	sdata->vif.bss_conf.beacon_int = params->beacon_interval;
 
-	sdata->u.ibss.channel = params->chandef.chan;
-	sdata->u.ibss.channel_type =
-		cfg80211_get_chandef_type(&params->chandef);
+	sdata->u.ibss.chandef = params->chandef;
 	sdata->u.ibss.fixed_channel = params->channel_fixed;
 
 	if (params->ie) {
@@ -1124,7 +1124,7 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata)
 		if (ifibss->privacy)
 			capability |= WLAN_CAPABILITY_PRIVACY;
 
-		cbss = cfg80211_get_bss(local->hw.wiphy, ifibss->channel,
+		cbss = cfg80211_get_bss(local->hw.wiphy, ifibss->chandef.chan,
 					ifibss->bssid, ifibss->ssid,
 					ifibss->ssid_len, WLAN_CAPABILITY_IBSS |
 					WLAN_CAPABILITY_PRIVACY,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 44be28c..1079c27 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -505,8 +505,7 @@ struct ieee80211_if_ibss {
 	u8 ssid[IEEE80211_MAX_SSID_LEN];
 	u8 ssid_len, ie_len;
 	u8 *ie;
-	struct ieee80211_channel *channel;
-	enum nl80211_channel_type channel_type;
+	struct cfg80211_chan_def chandef;
 
 	unsigned long ibss_join_req;
 	/* probe response/beacon for IBSS */
-- 
1.7.10.4


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

* [PATCH 4/8] mac80211: fix timing for 5 MHz and 10 MHz channels
  2013-05-09 18:10 [PATCH 0/8] Add support for 5 and 10 MHz channels a
                   ` (2 preceding siblings ...)
  2013-05-09 18:10 ` [PATCH 3/8] mac80211: change IBSS channel state to chandef a
@ 2013-05-09 18:10 ` a
  2013-05-09 18:10 ` [PATCH 5/8] nl80211: allow 5 and 10 MHz channels for IBSS a
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: a @ 2013-05-09 18:10 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Mathias Kretschmer, Simon Wunderlich

From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

according to IEEE 802.11-2012 section 18, various timings change
when using 5 MHz and 10 MHz. Reflect this by using a "divisor" when
calculating durations.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 net/mac80211/ieee80211_i.h         |   42 ++++++++++++++++++++++++++++++++++-
 net/mac80211/rc80211_minstrel.c    |   14 +++++++-----
 net/mac80211/rc80211_minstrel_ht.c |    8 ++++---
 net/mac80211/tx.c                  |   10 ++++++---
 net/mac80211/util.c                |   43 +++++++++++++++++++++++++-----------
 5 files changed, 92 insertions(+), 25 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 1079c27..e9d3da9 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -792,6 +792,45 @@ ieee80211_get_sdata_band(struct ieee80211_sub_if_data *sdata)
 	return band;
 }
 
+static inline int
+ieee80211_vif_get_divisor(struct ieee80211_vif *vif)
+{
+	struct ieee80211_chanctx_conf *chanctx_conf;
+	int divisor = 1;
+
+	rcu_read_lock();
+	chanctx_conf = rcu_dereference(vif->chanctx_conf);
+	if (chanctx_conf) {
+		switch (chanctx_conf->def.width) {
+		case NL80211_CHAN_WIDTH_5:
+			divisor = 4;
+			break;
+		case NL80211_CHAN_WIDTH_10:
+			divisor = 2;
+			break;
+		default:
+			divisor = 1;
+			break;
+		}
+	}
+	rcu_read_unlock();
+
+	return divisor;
+}
+
+static inline int
+ieee80211_hw_get_divisor(struct ieee80211_hw *hw)
+{
+	switch (hw->conf.chandef.width) {
+	case NL80211_CHAN_WIDTH_5:
+		return 4;
+	case NL80211_CHAN_WIDTH_10:
+		return 2;
+	default:
+		return 1;
+	}
+}
+
 enum sdata_queue_type {
 	IEEE80211_SDATA_QUEUE_TYPE_FRAME	= 0,
 	IEEE80211_SDATA_QUEUE_AGG_START		= 1,
@@ -1448,7 +1487,8 @@ extern void *mac80211_wiphy_privid; /* for wiphy privid */
 u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
 			enum nl80211_iftype type);
 int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
-			     int rate, int erp, int short_preamble);
+			     int rate, int erp, int short_preamble,
+			     int divisor);
 void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
 				     struct ieee80211_hdr *hdr, const u8 *tsc,
 				     gfp_t gfp);
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index ac7ef54..3fe134a 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -382,14 +382,17 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
 static void
 calc_rate_durations(enum ieee80211_band band,
 		    struct minstrel_rate *d,
-		    struct ieee80211_rate *rate)
+		    struct ieee80211_rate *rate,
+		    struct minstrel_priv *mp)
 {
 	int erp = !!(rate->flags & IEEE80211_RATE_ERP_G);
 
 	d->perfect_tx_time = ieee80211_frame_duration(band, 1200,
-			rate->bitrate, erp, 1);
+			rate->bitrate, erp, 1,
+			ieee80211_hw_get_divisor(mp->hw));
 	d->ack_time = ieee80211_frame_duration(band, 10,
-			rate->bitrate, erp, 1);
+			rate->bitrate, erp, 1,
+			ieee80211_hw_get_divisor(mp->hw));
 }
 
 static void
@@ -430,7 +433,8 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband,
 	ctl_rate = &sband->bitrates[mi->lowest_rix];
 	mi->sp_ack_dur = ieee80211_frame_duration(sband->band, 10,
 				ctl_rate->bitrate,
-				!!(ctl_rate->flags & IEEE80211_RATE_ERP_G), 1);
+				!!(ctl_rate->flags & IEEE80211_RATE_ERP_G), 1,
+				ieee80211_hw_get_divisor(mp->hw));
 
 	memset(mi->max_tp_rate, 0, sizeof(mi->max_tp_rate));
 	mi->max_prob_rate = 0;
@@ -448,7 +452,7 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband,
 
 		mr->rix = i;
 		mr->bitrate = sband->bitrates[i].bitrate / 5;
-		calc_rate_durations(sband->band, mr, &sband->bitrates[i]);
+		calc_rate_durations(sband->band, mr, &sband->bitrates[i], mp);
 
 		/* calculate maximum number of retransmissions before
 		 * fallback (based on maximum segment size) */
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 5b2d301..f05eeff 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -844,7 +844,7 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
 	struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
 	u16 sta_cap = sta->ht_cap.cap;
 	int n_supported = 0;
-	int ack_dur;
+	int ack_dur, divisor;
 	int stbc;
 	int i;
 
@@ -861,8 +861,10 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
 	mi->sta = sta;
 	mi->stats_update = jiffies;
 
-	ack_dur = ieee80211_frame_duration(sband->band, 10, 60, 1, 1);
-	mi->overhead = ieee80211_frame_duration(sband->band, 0, 60, 1, 1) + ack_dur;
+	divisor = ieee80211_hw_get_divisor(mp->hw);
+	ack_dur = ieee80211_frame_duration(sband->band, 10, 60, 1, 1, divisor);
+	mi->overhead = ieee80211_frame_duration(sband->band, 0, 60, 1, 1,
+						divisor) + ack_dur;
 	mi->overhead_rtscts = mi->overhead + 2 * ack_dur;
 
 	mi->avg_ampdu_len = MINSTREL_FRAC(1, 1);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 4a5fbf8..4bed9fd 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -40,7 +40,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
 				 struct sk_buff *skb, int group_addr,
 				 int next_frag_len)
 {
-	int rate, mrate, erp, dur, i;
+	int rate, mrate, erp, dur, i, divisor;
 	struct ieee80211_rate *txrate;
 	struct ieee80211_local *local = tx->local;
 	struct ieee80211_supported_band *sband;
@@ -153,6 +153,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
 		rate = mrate;
 	}
 
+	divisor = ieee80211_vif_get_divisor(&tx->sdata->vif);
+
 	/* Don't calculate ACKs for QoS Frames with NoAck Policy set */
 	if (ieee80211_is_data_qos(hdr->frame_control) &&
 	    *(ieee80211_get_qos_ctl(hdr)) & IEEE80211_QOS_CTL_ACK_POLICY_NOACK)
@@ -162,7 +164,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
 		 * (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up
 		 * to closest integer */
 		dur = ieee80211_frame_duration(sband->band, 10, rate, erp,
-				tx->sdata->vif.bss_conf.use_short_preamble);
+				tx->sdata->vif.bss_conf.use_short_preamble,
+				divisor);
 
 	if (next_frag_len) {
 		/* Frame is fragmented: duration increases with time needed to
@@ -171,7 +174,8 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
 		/* next fragment */
 		dur += ieee80211_frame_duration(sband->band, next_frag_len,
 				txrate->bitrate, erp,
-				tx->sdata->vif.bss_conf.use_short_preamble);
+				tx->sdata->vif.bss_conf.use_short_preamble,
+				divisor);
 	}
 
 	return cpu_to_le16(dur);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 27e0715..ad03800 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -107,7 +107,8 @@ void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx)
 }
 
 int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
-			     int rate, int erp, int short_preamble)
+			     int rate, int erp, int short_preamble,
+			     int divisor)
 {
 	int dur;
 
@@ -118,6 +119,13 @@ int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
 	 *
 	 * rate is in 100 kbps, so divident is multiplied by 10 in the
 	 * DIV_ROUND_UP() operations.
+	 *
+	 * divisor may be 4 for 5 MHz channels or 2 for 1 MHz channels, and
+	 * is assumed to be 1 otherwise. For 5 and 10 MHz channels, the
+	 * according 20 MHz rates are assumed. For example, a datarate of
+	 * 1.5mbps in a 5 MHz channel would be reported as rate == 60,
+	 * because the corresponding datarate in 20mbps with the same
+	 * modulation would be 6 mbps.
 	 */
 
 	if (band == IEEE80211_BAND_5GHZ || erp) {
@@ -130,15 +138,21 @@ int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
 		 * TXTIME = T_PREAMBLE + T_SIGNAL + T_SYM x N_SYM + Signal Ext
 		 *
 		 * T_SYM = 4 usec
-		 * 802.11a - 17.5.2: aSIFSTime = 16 usec
+		 * 802.11a - 18.5.2: aSIFSTime = 16 usec
 		 * 802.11g - 19.8.4: aSIFSTime = 10 usec +
 		 *	signal ext = 6 usec
 		 */
 		dur = 16; /* SIFS + signal ext */
-		dur += 16; /* 17.3.2.3: T_PREAMBLE = 16 usec */
-		dur += 4; /* 17.3.2.3: T_SIGNAL = 4 usec */
+		dur += 16; /* IEEE 802.11-2012 18.3.2.4: T_PREAMBLE = 16 usec */
+		dur += 4; /* IEEE 802.11-2012 18.3.2.4: T_SIGNAL = 4 usec */
 		dur += 4 * DIV_ROUND_UP((16 + 8 * (len + 4) + 6) * 10,
 					4 * rate); /* T_SYM x N_SYM */
+
+		/* IEEE 802.11-2012 18.3.2.4: all values above are:
+		 *  * times 4 for 5 MHz
+		 *  * times 2 for 10 MHz
+		 */
+		dur *= divisor;
 	} else {
 		/*
 		 * 802.11b or 802.11g with 802.11b compatibility:
@@ -168,7 +182,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
 {
 	struct ieee80211_sub_if_data *sdata;
 	u16 dur;
-	int erp;
+	int erp, divisor = 1;
 	bool short_preamble = false;
 
 	erp = 0;
@@ -177,10 +191,11 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
 		short_preamble = sdata->vif.bss_conf.use_short_preamble;
 		if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
 			erp = rate->flags & IEEE80211_RATE_ERP_G;
+		divisor = ieee80211_vif_get_divisor(vif);
 	}
 
 	dur = ieee80211_frame_duration(band, frame_len, rate->bitrate, erp,
-				       short_preamble);
+				       short_preamble, divisor);
 
 	return cpu_to_le16(dur);
 }
@@ -194,7 +209,7 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
 	struct ieee80211_rate *rate;
 	struct ieee80211_sub_if_data *sdata;
 	bool short_preamble;
-	int erp;
+	int erp, divisor = 1;
 	u16 dur;
 	struct ieee80211_supported_band *sband;
 
@@ -210,17 +225,18 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
 		short_preamble = sdata->vif.bss_conf.use_short_preamble;
 		if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
 			erp = rate->flags & IEEE80211_RATE_ERP_G;
+		divisor = ieee80211_vif_get_divisor(vif);
 	}
 
 	/* CTS duration */
 	dur = ieee80211_frame_duration(sband->band, 10, rate->bitrate,
-				       erp, short_preamble);
+				       erp, short_preamble, divisor);
 	/* Data frame duration */
 	dur += ieee80211_frame_duration(sband->band, frame_len, rate->bitrate,
-					erp, short_preamble);
+					erp, short_preamble, divisor);
 	/* ACK duration */
 	dur += ieee80211_frame_duration(sband->band, 10, rate->bitrate,
-					erp, short_preamble);
+					erp, short_preamble, divisor);
 
 	return cpu_to_le16(dur);
 }
@@ -235,7 +251,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
 	struct ieee80211_rate *rate;
 	struct ieee80211_sub_if_data *sdata;
 	bool short_preamble;
-	int erp;
+	int erp, divisor = 1;
 	u16 dur;
 	struct ieee80211_supported_band *sband;
 
@@ -250,15 +266,16 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
 		short_preamble = sdata->vif.bss_conf.use_short_preamble;
 		if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
 			erp = rate->flags & IEEE80211_RATE_ERP_G;
+		divisor = ieee80211_vif_get_divisor(vif);
 	}
 
 	/* Data frame duration */
 	dur = ieee80211_frame_duration(sband->band, frame_len, rate->bitrate,
-				       erp, short_preamble);
+				       erp, short_preamble, divisor);
 	if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) {
 		/* ACK duration */
 		dur += ieee80211_frame_duration(sband->band, 10, rate->bitrate,
-						erp, short_preamble);
+						erp, short_preamble, divisor);
 	}
 
 	return cpu_to_le16(dur);
-- 
1.7.10.4


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

* [PATCH 5/8] nl80211: allow 5 and 10 MHz channels for IBSS
  2013-05-09 18:10 [PATCH 0/8] Add support for 5 and 10 MHz channels a
                   ` (3 preceding siblings ...)
  2013-05-09 18:10 ` [PATCH 4/8] mac80211: fix timing for 5 MHz and 10 MHz channels a
@ 2013-05-09 18:10 ` a
  2013-05-09 18:10 ` [PATCH 6/8] ath9k: convert to chandef, enable support for 5/10 MHz channels a
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: a @ 2013-05-09 18:10 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Mathias Kretschmer, Simon Wunderlich

From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

Whether the wiphy supports it or not is already checked, so what is left
is to enable these channel types.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 net/wireless/nl80211.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f67d825..fbbb639 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6335,6 +6335,8 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
 		return -EINVAL;
 
 	switch (ibss.chandef.width) {
+	case NL80211_CHAN_WIDTH_5:
+	case NL80211_CHAN_WIDTH_10:
 	case NL80211_CHAN_WIDTH_20_NOHT:
 		break;
 	case NL80211_CHAN_WIDTH_20:
-- 
1.7.10.4


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

* [PATCH 6/8] ath9k: convert to chandef, enable support for 5/10 MHz channels
  2013-05-09 18:10 [PATCH 0/8] Add support for 5 and 10 MHz channels a
                   ` (4 preceding siblings ...)
  2013-05-09 18:10 ` [PATCH 5/8] nl80211: allow 5 and 10 MHz channels for IBSS a
@ 2013-05-09 18:10 ` a
  2013-05-09 18:10 ` [PATCH 7/8] ath9k: announce that ath9k supports 5/10 MHz a
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: a @ 2013-05-09 18:10 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Mathias Kretschmer, Simon Wunderlich

From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

To enable support for 5/10 MHz, also some internal functions must be
converted from using the (old) channel_type to chandef. This is a good
chance to change all remaining occurences.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 drivers/net/wireless/ath/ath9k/common.c       |   67 +++++++++++++++----------
 drivers/net/wireless/ath/ath9k/common.h       |    3 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |    5 +-
 drivers/net/wireless/ath/ath9k/init.c         |    4 +-
 drivers/net/wireless/ath/ath9k/main.c         |    8 ++-
 drivers/net/wireless/ath/ath9k/rc.c           |    4 +-
 6 files changed, 51 insertions(+), 40 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index 344fdde..d3063c2 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -49,37 +49,40 @@ int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb)
 }
 EXPORT_SYMBOL(ath9k_cmn_get_hw_crypto_keytype);
 
-static u32 ath9k_get_extchanmode(struct ieee80211_channel *chan,
-				 enum nl80211_channel_type channel_type)
+static u32 ath9k_get_extchanmode(struct cfg80211_chan_def *chandef)
 {
 	u32 chanmode = 0;
 
-	switch (chan->band) {
+	switch (chandef->chan->band) {
 	case IEEE80211_BAND_2GHZ:
-		switch (channel_type) {
-		case NL80211_CHAN_NO_HT:
-		case NL80211_CHAN_HT20:
+		switch (chandef->width) {
+		case NL80211_CHAN_WIDTH_20_NOHT:
+		case NL80211_CHAN_WIDTH_20:
 			chanmode = CHANNEL_G_HT20;
 			break;
-		case NL80211_CHAN_HT40PLUS:
-			chanmode = CHANNEL_G_HT40PLUS;
+		case NL80211_CHAN_WIDTH_40:
+			if (chandef->center_freq1 > chandef->chan->center_freq)
+				chanmode = CHANNEL_G_HT40PLUS;
+			else
+				chanmode = CHANNEL_G_HT40MINUS;
 			break;
-		case NL80211_CHAN_HT40MINUS:
-			chanmode = CHANNEL_G_HT40MINUS;
+		default:
 			break;
 		}
 		break;
 	case IEEE80211_BAND_5GHZ:
-		switch (channel_type) {
-		case NL80211_CHAN_NO_HT:
-		case NL80211_CHAN_HT20:
+		switch (chandef->width) {
+		case NL80211_CHAN_WIDTH_20_NOHT:
+		case NL80211_CHAN_WIDTH_20:
 			chanmode = CHANNEL_A_HT20;
 			break;
-		case NL80211_CHAN_HT40PLUS:
-			chanmode = CHANNEL_A_HT40PLUS;
+		case NL80211_CHAN_WIDTH_40:
+			if (chandef->center_freq1 > chandef->chan->center_freq)
+				chanmode = CHANNEL_A_HT40PLUS;
+			else
+				chanmode = CHANNEL_A_HT40MINUS;
 			break;
-		case NL80211_CHAN_HT40MINUS:
-			chanmode = CHANNEL_A_HT40MINUS;
+		default:
 			break;
 		}
 		break;
@@ -94,13 +97,12 @@ static u32 ath9k_get_extchanmode(struct ieee80211_channel *chan,
  * Update internal channel flags.
  */
 void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
-			       struct ieee80211_channel *chan,
-			       enum nl80211_channel_type channel_type)
+			       struct cfg80211_chan_def *chandef)
 {
-	ichan->channel = chan->center_freq;
-	ichan->chan = chan;
+	ichan->channel = chandef->chan->center_freq;
+	ichan->chan = chandef->chan;
 
-	if (chan->band == IEEE80211_BAND_2GHZ) {
+	if (chandef->chan->band == IEEE80211_BAND_2GHZ) {
 		ichan->chanmode = CHANNEL_G;
 		ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM;
 	} else {
@@ -108,8 +110,22 @@ void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
 		ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM;
 	}
 
-	if (channel_type != NL80211_CHAN_NO_HT)
-		ichan->chanmode = ath9k_get_extchanmode(chan, channel_type);
+	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_5:
+		ichan->channelFlags |= CHANNEL_QUARTER;
+		break;
+	case NL80211_CHAN_WIDTH_10:
+		ichan->channelFlags |= CHANNEL_HALF;
+		break;
+	case NL80211_CHAN_WIDTH_20_NOHT:
+		break;
+	case NL80211_CHAN_WIDTH_20:
+	case NL80211_CHAN_WIDTH_40:
+		ichan->chanmode = ath9k_get_extchanmode(chandef);
+		break;
+	default:
+		WARN_ON(1);
+	}
 }
 EXPORT_SYMBOL(ath9k_cmn_update_ichannel);
 
@@ -125,8 +141,7 @@ struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw,
 
 	chan_idx = curchan->hw_value;
 	channel = &ah->channels[chan_idx];
-	ath9k_cmn_update_ichannel(channel, curchan,
-				  cfg80211_get_chandef_type(&hw->conf.chandef));
+	ath9k_cmn_update_ichannel(channel, &hw->conf.chandef);
 
 	return channel;
 }
diff --git a/drivers/net/wireless/ath/ath9k/common.h b/drivers/net/wireless/ath/ath9k/common.h
index 207d069..e039bcb 100644
--- a/drivers/net/wireless/ath/ath9k/common.h
+++ b/drivers/net/wireless/ath/ath9k/common.h
@@ -44,8 +44,7 @@
 
 int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb);
 void ath9k_cmn_update_ichannel(struct ath9k_channel *ichan,
-			       struct ieee80211_channel *chan,
-			       enum nl80211_channel_type channel_type);
+			       struct cfg80211_chan_def *chandef);
 struct ath9k_channel *ath9k_cmn_get_curchannel(struct ieee80211_hw *hw,
 					       struct ath_hw *ah);
 int ath9k_cmn_count_streams(unsigned int chainmask, int max);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 0743a47..8c25c7a 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1194,16 +1194,13 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
 
 	if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) {
 		struct ieee80211_channel *curchan = hw->conf.chandef.chan;
-		enum nl80211_channel_type channel_type =
-			cfg80211_get_chandef_type(&hw->conf.chandef);
 		int pos = curchan->hw_value;
 
 		ath_dbg(common, CONFIG, "Set channel: %d MHz\n",
 			curchan->center_freq);
 
 		ath9k_cmn_update_ichannel(&priv->ah->channels[pos],
-					  hw->conf.chandef.chan,
-					  channel_type);
+					  &hw->conf.chandef);
 
 		if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) {
 			ath_err(common, "Unable to set channel\n");
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 3be2eb0..0959729 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -684,13 +684,15 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band)
 	struct ieee80211_supported_band *sband;
 	struct ieee80211_channel *chan;
 	struct ath_hw *ah = sc->sc_ah;
+	struct cfg80211_chan_def chandef;
 	int i;
 
 	sband = &sc->sbands[band];
 	for (i = 0; i < sband->n_channels; i++) {
 		chan = &sband->channels[i];
 		ah->curchan = &ah->channels[chan->hw_value];
-		ath9k_cmn_update_ichannel(ah->curchan, chan, NL80211_CHAN_HT20);
+		cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_HT20);
+		ath9k_cmn_update_ichannel(ah->curchan, &chandef);
 		ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true);
 	}
 }
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index a383483..6804f4f 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1189,8 +1189,6 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 
 	if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) {
 		struct ieee80211_channel *curchan = hw->conf.chandef.chan;
-		enum nl80211_channel_type channel_type =
-			cfg80211_get_chandef_type(&conf->chandef);
 		int pos = curchan->hw_value;
 		int old_pos = -1;
 		unsigned long flags;
@@ -1198,8 +1196,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 		if (ah->curchan)
 			old_pos = ah->curchan - &ah->channels[0];
 
-		ath_dbg(common, CONFIG, "Set channel: %d MHz type: %d\n",
-			curchan->center_freq, channel_type);
+		ath_dbg(common, CONFIG, "Set channel: %d MHz width: %d\n",
+			curchan->center_freq, hw->conf.chandef.width);
 
 		/* update survey stats for the old channel before switching */
 		spin_lock_irqsave(&common->cc_lock, flags);
@@ -1214,7 +1212,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 			ath9k_hw_getnf(ah, ah->curchan);
 
 		ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos],
-					  curchan, channel_type);
+					  &conf->chandef);
 
 		/*
 		 * If the operating channel changes, change the survey in-use flags
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index aa4d368..ed57d57 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1327,8 +1327,8 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
 		ath_rc_init(sc, priv_sta);
 
 		ath_dbg(ath9k_hw_common(sc->sc_ah), CONFIG,
-			"Operating HT Bandwidth changed to: %d\n",
-			cfg80211_get_chandef_type(&sc->hw->conf.chandef));
+			"Operating Bandwidth changed to: %d\n",
+			&sc->hw->conf.chandef->width);
 	}
 }
 
-- 
1.7.10.4


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

* [PATCH 7/8] ath9k: announce that ath9k supports 5/10 MHz
  2013-05-09 18:10 [PATCH 0/8] Add support for 5 and 10 MHz channels a
                   ` (5 preceding siblings ...)
  2013-05-09 18:10 ` [PATCH 6/8] ath9k: convert to chandef, enable support for 5/10 MHz channels a
@ 2013-05-09 18:10 ` a
  2013-05-09 18:10 ` [PATCH 8/8] ath5k: enable support for 5 MHz and 10 MHz channels a
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: a @ 2013-05-09 18:10 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Mathias Kretschmer, Simon Wunderlich

From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 drivers/net/wireless/ath/ath9k/init.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 0959729..30c3ddf 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -794,6 +794,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 	hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
 	hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
 	hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
+	hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_5_10_MHZ;
 
 #ifdef CONFIG_PM_SLEEP
 
-- 
1.7.10.4


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

* [PATCH 8/8] ath5k: enable support for 5 MHz and 10 MHz channels
  2013-05-09 18:10 [PATCH 0/8] Add support for 5 and 10 MHz channels a
                   ` (6 preceding siblings ...)
  2013-05-09 18:10 ` [PATCH 7/8] ath9k: announce that ath9k supports 5/10 MHz a
@ 2013-05-09 18:10 ` a
  2013-05-09 18:20 ` [PATCH 0/8] Add support for 5 " Simon Wunderlich
  2013-05-10  7:26 ` Johannes Berg
  9 siblings, 0 replies; 17+ messages in thread
From: a @ 2013-05-09 18:10 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Mathias Kretschmer, Simon Wunderlich

From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 drivers/net/wireless/ath/ath5k/ath5k.h        |    1 +
 drivers/net/wireless/ath/ath5k/base.c         |   25 ++++++++++++++++++++++---
 drivers/net/wireless/ath/ath5k/base.h         |    2 +-
 drivers/net/wireless/ath/ath5k/mac80211-ops.c |    2 +-
 4 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 2d691b8..74bd54d 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -29,6 +29,7 @@
 #include <linux/average.h>
 #include <linux/leds.h>
 #include <net/mac80211.h>
+#include <net/cfg80211.h>
 
 /* RX/TX descriptor hw structs
  * TODO: Driver part should only see sw structs */
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 9b20d9e..e7a5708 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -56,6 +56,7 @@
 #include <linux/etherdevice.h>
 #include <linux/nl80211.h>
 
+#include <net/cfg80211.h>
 #include <net/ieee80211_radiotap.h>
 
 #include <asm/unaligned.h>
@@ -434,11 +435,27 @@ ath5k_setup_bands(struct ieee80211_hw *hw)
  * Called with ah->lock.
  */
 int
-ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan)
+ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef)
 {
 	ATH5K_DBG(ah, ATH5K_DEBUG_RESET,
 		  "channel set, resetting (%u -> %u MHz)\n",
-		  ah->curchan->center_freq, chan->center_freq);
+		  ah->curchan->center_freq, chandef->chan->center_freq);
+
+	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_20:
+	case NL80211_CHAN_WIDTH_20_NOHT:
+		ah->ah_bwmode = AR5K_BWMODE_DEFAULT;
+		break;
+	case NL80211_CHAN_WIDTH_5:
+		ah->ah_bwmode = AR5K_BWMODE_5MHZ;
+		break;
+	case NL80211_CHAN_WIDTH_10:
+		ah->ah_bwmode = AR5K_BWMODE_10MHZ;
+		break;
+	default:
+		WARN_ON(1);
+		return -EINVAL;
+	}
 
 	/*
 	 * To switch channels clear any pending DMA operations;
@@ -446,7 +463,7 @@ ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan)
 	 * hardware at the new frequency, and then re-enable
 	 * the relevant bits of the h/w.
 	 */
-	return ath5k_reset(ah, chan, true);
+	return ath5k_reset(ah, chandef->chan, true);
 }
 
 void ath5k_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
@@ -2453,6 +2470,8 @@ ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
 	/* SW support for IBSS_RSN is provided by mac80211 */
 	hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
 
+	hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_5_10_MHZ;
+
 	/* both antennas can be configured as RX or TX */
 	hw->wiphy->available_antennas_tx = 0x3;
 	hw->wiphy->available_antennas_rx = 0x3;
diff --git a/drivers/net/wireless/ath/ath5k/base.h b/drivers/net/wireless/ath/ath5k/base.h
index 6c94c7f..130075b 100644
--- a/drivers/net/wireless/ath/ath5k/base.h
+++ b/drivers/net/wireless/ath/ath5k/base.h
@@ -99,7 +99,7 @@ void ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable);
 
 void ath5k_update_bssid_mask_and_opmode(struct ath5k_hw *ah,
 					struct ieee80211_vif *vif);
-int ath5k_chan_set(struct ath5k_hw *ah, struct ieee80211_channel *chan);
+int ath5k_chan_set(struct ath5k_hw *ah, struct cfg80211_chan_def *chandef);
 void ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf);
 void ath5k_rxbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf);
 void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb,
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
index 06f86f4..2129330 100644
--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
@@ -202,7 +202,7 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
 	mutex_lock(&ah->lock);
 
 	if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
-		ret = ath5k_chan_set(ah, conf->chandef.chan);
+		ret = ath5k_chan_set(ah, &conf->chandef);
 		if (ret < 0)
 			goto unlock;
 	}
-- 
1.7.10.4


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

* Re: [PATCH 0/8] Add support for 5 and 10 MHz channels
  2013-05-09 18:10 [PATCH 0/8] Add support for 5 and 10 MHz channels a
                   ` (7 preceding siblings ...)
  2013-05-09 18:10 ` [PATCH 8/8] ath5k: enable support for 5 MHz and 10 MHz channels a
@ 2013-05-09 18:20 ` Simon Wunderlich
  2013-05-10  7:26 ` Johannes Berg
  9 siblings, 0 replies; 17+ messages in thread
From: Simon Wunderlich @ 2013-05-09 18:20 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Mathias Kretschmer, Simon Wunderlich

[-- Attachment #1: Type: text/plain, Size: 265 bytes --]

On Thu, May 09, 2013 at 08:10:28PM +0200, a@pandem0nium wrote:
> [...]

I wonder if I'll ever learn to use send git send-email properly ... please
consider this as sent "From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>"
and sorry for the confusion.

Thanks!
	Simon

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 2/8] mac80211: fix various components for the new 5 and 10 MHz widths
  2013-05-09 18:10 ` [PATCH 2/8] mac80211: fix various components for the new 5 and 10 MHz widths a
@ 2013-05-09 18:31   ` Felix Fietkau
  2013-05-09 19:46     ` Simon Wunderlich
  0 siblings, 1 reply; 17+ messages in thread
From: Felix Fietkau @ 2013-05-09 18:31 UTC (permalink / raw)
  Cc: linux-wireless, Johannes Berg, Mathias Kretschmer, Simon Wunderlich

On 2013-05-09 8:10 PM, a@pandem0nium wrote:
> From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> 
> This is a collection of minor fixes:
>  * don't allow HT IEs in IBSS for 5/10 MHz
>  * don't allow HT IEs in Mesh for 5/10 MHz
>  * consider 5 and 10 MHz channels when downgrading
>  * don't try HT rates for 5 and 10 MHz channels when selecting rates
Why? HT rates work with 5/10 MHz just fine.

- Felix


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

* Re: [PATCH 2/8] mac80211: fix various components for the new 5 and 10 MHz widths
  2013-05-09 18:31   ` Felix Fietkau
@ 2013-05-09 19:46     ` Simon Wunderlich
  2013-05-09 20:32       ` Felix Fietkau
  0 siblings, 1 reply; 17+ messages in thread
From: Simon Wunderlich @ 2013-05-09 19:46 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: linux-wireless, Johannes Berg, Mathias Kretschmer, Simon Wunderlich

[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]

Hello Felix,

On Thu, May 09, 2013 at 08:31:36PM +0200, Felix Fietkau wrote:
> On 2013-05-09 8:10 PM, a@pandem0nium wrote:
> > From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> > 
> > This is a collection of minor fixes:
> >  * don't allow HT IEs in IBSS for 5/10 MHz
> >  * don't allow HT IEs in Mesh for 5/10 MHz
> >  * consider 5 and 10 MHz channels when downgrading
> >  * don't try HT rates for 5 and 10 MHz channels when selecting rates
> Why? HT rates work with 5/10 MHz just fine.

Hm, to be honest I did not try - IEEE 802.11-2012 only mentions 5 and
10 MHz channels in section 18 (OFDM PHY) according with timing and other
parameters, but nothing like this (as far as I see) is mentioned in
Section 20 (High Throughput PHY).

On the other hand, it appears that AR9xxx based chipsets also support
2.4 GHz rates (DSSS, ERP-OFDM), so I can imagine also HT rates can
be supported as well.

The question is, how would we handle that? Allow HT IEs also for 5 and
10 MHz, and behave like it would be a 20 MHz channel? Are there any
other WiFi chipsets which support 5/10 MHz, should we consider them
(maybe they don't support that)? And what do others think about deviate
from standard? Personally, I don't mind, it would be cool to use HT rates
on these bandwidths too. :)

Cheers,
	Simon

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 2/8] mac80211: fix various components for the new 5 and 10 MHz widths
  2013-05-09 19:46     ` Simon Wunderlich
@ 2013-05-09 20:32       ` Felix Fietkau
  0 siblings, 0 replies; 17+ messages in thread
From: Felix Fietkau @ 2013-05-09 20:32 UTC (permalink / raw)
  To: Simon Wunderlich
  Cc: linux-wireless, Johannes Berg, Mathias Kretschmer, Simon Wunderlich

On 2013-05-09 9:46 PM, Simon Wunderlich wrote:
> Hello Felix,
> 
> On Thu, May 09, 2013 at 08:31:36PM +0200, Felix Fietkau wrote:
>> On 2013-05-09 8:10 PM, a@pandem0nium wrote:
>> > From: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
>> > 
>> > This is a collection of minor fixes:
>> >  * don't allow HT IEs in IBSS for 5/10 MHz
>> >  * don't allow HT IEs in Mesh for 5/10 MHz
>> >  * consider 5 and 10 MHz channels when downgrading
>> >  * don't try HT rates for 5 and 10 MHz channels when selecting rates
>> Why? HT rates work with 5/10 MHz just fine.
> 
> Hm, to be honest I did not try - IEEE 802.11-2012 only mentions 5 and
> 10 MHz channels in section 18 (OFDM PHY) according with timing and other
> parameters, but nothing like this (as far as I see) is mentioned in
> Section 20 (High Throughput PHY).
> 
> On the other hand, it appears that AR9xxx based chipsets also support
> 2.4 GHz rates (DSSS, ERP-OFDM), so I can imagine also HT rates can
> be supported as well.
> 
> The question is, how would we handle that? Allow HT IEs also for 5 and
> 10 MHz, and behave like it would be a 20 MHz channel?
Yes, I had 5/10 MHz running that way with a debugfs hack just fine.

> Are there any
> other WiFi chipsets which support 5/10 MHz, should we consider them
> (maybe they don't support that)?
No idea.

- Felix

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

* Re: [PATCH 0/8] Add support for 5 and 10 MHz channels
  2013-05-09 18:10 [PATCH 0/8] Add support for 5 and 10 MHz channels a
                   ` (8 preceding siblings ...)
  2013-05-09 18:20 ` [PATCH 0/8] Add support for 5 " Simon Wunderlich
@ 2013-05-10  7:26 ` Johannes Berg
  2013-05-10  9:12   ` Adrian Chadd
  9 siblings, 1 reply; 17+ messages in thread
From: Johannes Berg @ 2013-05-10  7:26 UTC (permalink / raw)
  To: a; +Cc: linux-wireless, Mathias Kretschmer, Simon Wunderlich

On Thu, 2013-05-09 at 20:10 +0200, a@pandem0nium wrote:

> Comments:
>  * Is there any special requirement for handling beacons? For example,
>    rates are halfed or quartered, but some rates could not be represented
>    in the rate IEs. For example, 2.25 mbit/s can not be represented as
>    multiple of 500 kbps.
>  * therefore, all rates are handled like the corresponding 20 MHz
> rates
>    internally, which makes a lot of things easier (no changes required
>    for rc-algos, beacon creation, etc...). We might consider adjusting
> the
>    output of rates for nl80211 or radiotap, though.

This seems completely wrong, since Clause 18 says:

        The OFDM system also provides a “half-clocked” operation using
        10 MHz channel spacings with data communications capabilities of
        3, 4.5, 6, 9, 12, 18, 24, and 27 Mb/s. The support of
        transmitting and receiving at data rates of 3, 6, and 12 Mb/s is
        mandatory when using 10 MHz channel spacing. The half-clocked
        operation doubles symbol times and clear channel assessment
        (CCA) times when using 10 MHz channel spacing. The regulatory
        requirements and information regarding use of this OFDM PHY are
        in Annex D and Annex E.

IOW, it treats the rates as actually the rate they should be. Besides,
what's so hard about rounding up? (8.4.2.4)

        and bits 6 to 0 are set to the data rate, if necessary rounded
        up to the next 500kb/s, in units of 500 kb/s.


I also think you really need to handle this. If you just want a hack for
5/10 MHz, you can put it into drivers' debugfs, if not, then it should
be done properly :-)

johannes


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

* Re: [PATCH 0/8] Add support for 5 and 10 MHz channels
  2013-05-10  7:26 ` Johannes Berg
@ 2013-05-10  9:12   ` Adrian Chadd
  2013-05-10  9:32     ` Simon Wunderlich
  0 siblings, 1 reply; 17+ messages in thread
From: Adrian Chadd @ 2013-05-10  9:12 UTC (permalink / raw)
  To: Johannes Berg; +Cc: a, linux-wireless, Mathias Kretschmer, Simon Wunderlich

On 10 May 2013 00:26, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Thu, 2013-05-09 at 20:10 +0200, a@pandem0nium wrote:
>
>> Comments:
>>  * Is there any special requirement for handling beacons? For example,
>>    rates are halfed or quartered, but some rates could not be represented
>>    in the rate IEs. For example, 2.25 mbit/s can not be represented as
>>    multiple of 500 kbps.
>>  * therefore, all rates are handled like the corresponding 20 MHz
>> rates
>>    internally, which makes a lot of things easier (no changes required
>>    for rc-algos, beacon creation, etc...). We might consider adjusting
>> the
>>    output of rates for nl80211 or radiotap, though.
>
> This seems completely wrong, since Clause 18 says:
>
>         The OFDM system also provides a “half-clocked” operation using
>         10 MHz channel spacings with data communications capabilities of
>         3, 4.5, 6, 9, 12, 18, 24, and 27 Mb/s. The support of
>         transmitting and receiving at data rates of 3, 6, and 12 Mb/s is
>         mandatory when using 10 MHz channel spacing. The half-clocked
>         operation doubles symbol times and clear channel assessment
>         (CCA) times when using 10 MHz channel spacing. The regulatory
>         requirements and information regarding use of this OFDM PHY are
>         in Annex D and Annex E.
>
> IOW, it treats the rates as actually the rate they should be. Besides,
> what's so hard about rounding up? (8.4.2.4)
>
>         and bits 6 to 0 are set to the data rate, if necessary rounded
>         up to the next 500kb/s, in units of 500 kb/s.
>
>
> I also think you really need to handle this. If you just want a hack for
> 5/10 MHz, you can put it into drivers' debugfs, if not, then it should
> be done properly :-)

I think net80211 from FreeBSD and madwifi do this. Ie, they advertise
the half and quarter rate speeds as their real speeds at half/quarter
rate.

If anything, interoperability would be nice.




Adrian

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

* Re: [PATCH 0/8] Add support for 5 and 10 MHz channels
  2013-05-10  9:12   ` Adrian Chadd
@ 2013-05-10  9:32     ` Simon Wunderlich
  2013-05-10  9:34       ` Johannes Berg
  0 siblings, 1 reply; 17+ messages in thread
From: Simon Wunderlich @ 2013-05-10  9:32 UTC (permalink / raw)
  To: Adrian Chadd
  Cc: Johannes Berg, linux-wireless, Mathias Kretschmer, Simon Wunderlich

[-- Attachment #1: Type: text/plain, Size: 2413 bytes --]

Hey,

On Fri, May 10, 2013 at 02:12:00AM -0700, Adrian Chadd wrote:
> On 10 May 2013 00:26, Johannes Berg <johannes@sipsolutions.net> wrote:
> > On Thu, 2013-05-09 at 20:10 +0200, a@pandem0nium wrote:
> >
> >> Comments:
> >>  * Is there any special requirement for handling beacons? For example,
> >>    rates are halfed or quartered, but some rates could not be represented
> >>    in the rate IEs. For example, 2.25 mbit/s can not be represented as
> >>    multiple of 500 kbps.
> >>  * therefore, all rates are handled like the corresponding 20 MHz
> >> rates
> >>    internally, which makes a lot of things easier (no changes required
> >>    for rc-algos, beacon creation, etc...). We might consider adjusting
> >> the
> >>    output of rates for nl80211 or radiotap, though.
> >
> > This seems completely wrong, since Clause 18 says:
> >
> >         The OFDM system also provides a “half-clocked” operation using
> >         10 MHz channel spacings with data communications capabilities of
> >         3, 4.5, 6, 9, 12, 18, 24, and 27 Mb/s. The support of
> >         transmitting and receiving at data rates of 3, 6, and 12 Mb/s is
> >         mandatory when using 10 MHz channel spacing. The half-clocked
> >         operation doubles symbol times and clear channel assessment
> >         (CCA) times when using 10 MHz channel spacing. The regulatory
> >         requirements and information regarding use of this OFDM PHY are
> >         in Annex D and Annex E.
> >
> > IOW, it treats the rates as actually the rate they should be. Besides,
> > what's so hard about rounding up? (8.4.2.4)
> >
> >         and bits 6 to 0 are set to the data rate, if necessary rounded
> >         up to the next 500kb/s, in units of 500 kb/s.
> >
> >
> > I also think you really need to handle this. If you just want a hack for
> > 5/10 MHz, you can put it into drivers' debugfs, if not, then it should
> > be done properly :-)
> 
> I think net80211 from FreeBSD and madwifi do this. Ie, they advertise
> the half and quarter rate speeds as their real speeds at half/quarter
> rate.

Ah, OK.

> 
> If anything, interoperability would be nice.

Yes interoperability would be nice of course - I'll re-work the patchset
to use the according half and quarter rates. Meanwhile, what do you guys think
about enabling HT too?

Cheers,
	Simon
> 
> 
> 
> 
> Adrian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH 0/8] Add support for 5 and 10 MHz channels
  2013-05-10  9:32     ` Simon Wunderlich
@ 2013-05-10  9:34       ` Johannes Berg
  0 siblings, 0 replies; 17+ messages in thread
From: Johannes Berg @ 2013-05-10  9:34 UTC (permalink / raw)
  To: Simon Wunderlich
  Cc: Adrian Chadd, linux-wireless, Mathias Kretschmer, Simon Wunderlich

On Fri, 2013-05-10 at 11:32 +0200, Simon Wunderlich wrote:

> Yes interoperability would be nice of course - I'll re-work the patchset
> to use the according half and quarter rates. Meanwhile, what do you guys think
> about enabling HT too?

I'd like to stick to the standard first. Enabling HT is nice for us, but
I'd like to see it done in a way that doesn't clash with a possible
future amendment doing it officially.

johannes


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

end of thread, other threads:[~2013-05-10  9:34 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-09 18:10 [PATCH 0/8] Add support for 5 and 10 MHz channels a
2013-05-09 18:10 ` [PATCH 1/8] nl80211/cfg80211: add 5 and 10 MHz defines and wiphy flag a
2013-05-09 18:10 ` [PATCH 2/8] mac80211: fix various components for the new 5 and 10 MHz widths a
2013-05-09 18:31   ` Felix Fietkau
2013-05-09 19:46     ` Simon Wunderlich
2013-05-09 20:32       ` Felix Fietkau
2013-05-09 18:10 ` [PATCH 3/8] mac80211: change IBSS channel state to chandef a
2013-05-09 18:10 ` [PATCH 4/8] mac80211: fix timing for 5 MHz and 10 MHz channels a
2013-05-09 18:10 ` [PATCH 5/8] nl80211: allow 5 and 10 MHz channels for IBSS a
2013-05-09 18:10 ` [PATCH 6/8] ath9k: convert to chandef, enable support for 5/10 MHz channels a
2013-05-09 18:10 ` [PATCH 7/8] ath9k: announce that ath9k supports 5/10 MHz a
2013-05-09 18:10 ` [PATCH 8/8] ath5k: enable support for 5 MHz and 10 MHz channels a
2013-05-09 18:20 ` [PATCH 0/8] Add support for 5 " Simon Wunderlich
2013-05-10  7:26 ` Johannes Berg
2013-05-10  9:12   ` Adrian Chadd
2013-05-10  9:32     ` Simon Wunderlich
2013-05-10  9:34       ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.