linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40
@ 2015-01-16 10:38 Janusz Dziedzic
  2015-01-16 10:38 ` [RFCv2 2/6] cfg80211: add VHT support for IBSS Janusz Dziedzic
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Janusz Dziedzic @ 2015-01-16 10:38 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Janusz Dziedzic

In some cases when used HT40+/HT40-, center_freq1
was configured incorrectly. Next this couse
fall back to HT20.

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

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


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

* [RFCv2 2/6] cfg80211: add VHT support for IBSS
  2015-01-16 10:38 [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40 Janusz Dziedzic
@ 2015-01-16 10:38 ` Janusz Dziedzic
  2015-01-16 10:38 ` [RFCv2 3/6] mac80211: " Janusz Dziedzic
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Janusz Dziedzic @ 2015-01-16 10:38 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Janusz Dziedzic

Add NL80211_FEATURE_VHT_IBSS flag and VHT
support for IBSS.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 include/uapi/linux/nl80211.h |  2 ++
 net/wireless/nl80211.c       | 14 ++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index b6c1a00..8f7422e 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -4308,11 +4308,13 @@ enum nl80211_feature_flags {
 
 /**
  * enum nl80211_ext_feature_index - bit index of extended features.
+ * @NL80211_FEATURE_VHT_IBSS: This driver supports IBSS with VHT datarates.
  *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  */
 enum nl80211_ext_feature_index {
+	NL80211_FEATURE_VHT_IBSS,
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 38078437..4b79340 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7240,8 +7240,18 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
 		break;
 	case NL80211_CHAN_WIDTH_20:
 	case NL80211_CHAN_WIDTH_40:
-		if (rdev->wiphy.features & NL80211_FEATURE_HT_IBSS)
-			break;
+		if (!(rdev->wiphy.features & NL80211_FEATURE_HT_IBSS))
+			return -EINVAL;
+		break;
+	case NL80211_CHAN_WIDTH_80:
+	case NL80211_CHAN_WIDTH_80P80:
+	case NL80211_CHAN_WIDTH_160:
+		if (!(rdev->wiphy.features & NL80211_FEATURE_HT_IBSS))
+			return -EINVAL;
+		if (!wiphy_ext_feature_isset(&rdev->wiphy,
+					     NL80211_FEATURE_VHT_IBSS))
+			return -EINVAL;
+		break;
 	default:
 		return -EINVAL;
 	}
-- 
1.9.1


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

* [RFCv2 3/6] mac80211: add VHT support for IBSS
  2015-01-16 10:38 [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40 Janusz Dziedzic
  2015-01-16 10:38 ` [RFCv2 2/6] cfg80211: add VHT support for IBSS Janusz Dziedzic
@ 2015-01-16 10:38 ` Janusz Dziedzic
  2015-01-16 10:52   ` Johannes Berg
  2015-01-16 10:38 ` [RFCv2 4/6] mac80211: IBSS fix scan request Janusz Dziedzic
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Janusz Dziedzic @ 2015-01-16 10:38 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Janusz Dziedzic

Add VHT80/VHT160 support for IBSS.
Drivers could activate this feature by
setting NL80211_FEATURE_VHT_IBSS flag.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 net/mac80211/ibss.c        | 11 +++++++++++
 net/mac80211/ieee80211_i.h |  2 ++
 net/mac80211/util.c        | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 13b8105..1ffcfab 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -188,6 +188,15 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata,
 		 */
 		pos = ieee80211_ie_build_ht_oper(pos, &sband->ht_cap,
 						 chandef, 0);
+
+		if (chandef->width != NL80211_CHAN_WIDTH_20 &&
+		    chandef->width != NL80211_CHAN_WIDTH_40 &&
+		    sband->vht_cap.vht_supported) {
+			pos = ieee80211_ie_build_vht_cap(pos, &sband->vht_cap,
+							 sband->vht_cap.cap);
+			pos = ieee80211_ie_build_vht_oper(pos, &sband->vht_cap,
+							  chandef);
+		}
 	}
 
 	if (local->hw.queues >= IEEE80211_NUM_ACS)
@@ -411,6 +420,8 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
 		cfg80211_chandef_create(&chandef, cbss->channel, chan_type);
 		break;
 	case NL80211_CHAN_WIDTH_40:
+	case NL80211_CHAN_WIDTH_80:
+	case NL80211_CHAN_WIDTH_160:
 		cfg80211_chandef_create(&chandef, cbss->channel,
 					NL80211_CHAN_WIDTH_20_NOHT);
 		chandef.width = sdata->u.ibss.chandef.width;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 156ea79..95ce152 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1935,6 +1935,8 @@ u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
 			       u16 prot_mode);
 u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
 			       u32 cap);
+u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
+				const struct cfg80211_chan_def *chandef);
 int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef,
 			     const struct ieee80211_supported_band *sband,
 			     const u8 *srates, int srates_len, u32 *rates);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 83ba6cd..ee6a601 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2329,6 +2329,41 @@ u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
 	return pos + sizeof(struct ieee80211_ht_operation);
 }
 
+u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
+				const struct cfg80211_chan_def *chandef)
+{
+	struct ieee80211_vht_operation *vht_oper;
+
+	/* Build VHT Operation */
+	*pos++ = WLAN_EID_VHT_OPERATION;
+	*pos++ = sizeof(struct ieee80211_vht_operation);
+
+	vht_oper = (struct ieee80211_vht_operation *)pos;
+
+	vht_oper->center_freq_seg1_idx =
+			ieee80211_frequency_to_channel(chandef->center_freq1);
+	vht_oper->center_freq_seg2_idx = 0;
+	vht_oper->basic_mcs_set = vht_cap->vht_mcs.rx_mcs_map;
+
+	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_80:
+		vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80MHZ;
+		break;
+	case NL80211_CHAN_WIDTH_80P80:
+		vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_80P80MHZ;
+		vht_oper->center_freq_seg2_idx =
+			ieee80211_frequency_to_channel(chandef->center_freq2);
+		break;
+	case NL80211_CHAN_WIDTH_160:
+		vht_oper->chan_width = IEEE80211_VHT_CHANWIDTH_160MHZ;
+		break;
+	default:
+		return pos;
+	}
+
+	return pos + sizeof(struct ieee80211_vht_operation);
+}
+
 void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan,
 				  const struct ieee80211_ht_operation *ht_oper,
 				  struct cfg80211_chan_def *chandef)
-- 
1.9.1


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

* [RFCv2 4/6] mac80211: IBSS fix scan request
  2015-01-16 10:38 [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40 Janusz Dziedzic
  2015-01-16 10:38 ` [RFCv2 2/6] cfg80211: add VHT support for IBSS Janusz Dziedzic
  2015-01-16 10:38 ` [RFCv2 3/6] mac80211: " Janusz Dziedzic
@ 2015-01-16 10:38 ` Janusz Dziedzic
  2015-01-16 10:38 ` [RFCv2 5/6] mac80211: ibss/mesh move bw checking Janusz Dziedzic
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Janusz Dziedzic @ 2015-01-16 10:38 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Janusz Dziedzic

In case of wide bandwidth (HT40/VHT80/VHT160) scan
all channels we have in chandef, not only control one.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 net/mac80211/ibss.c        | 61 ++++++++++++++++++++++++++++++++++++++++++++--
 net/mac80211/ieee80211_i.h |  3 ++-
 net/mac80211/scan.c        | 25 ++++++++++++-------
 3 files changed, 77 insertions(+), 12 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 1ffcfab..b1e9e9b 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1289,7 +1289,7 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata)
 
 	scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
 	ieee80211_request_ibss_scan(sdata, ifibss->ssid, ifibss->ssid_len,
-				    NULL, scan_width);
+				    NULL, 0, scan_width);
 }
 
 static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
@@ -1328,6 +1328,56 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
 				  capability, 0, true);
 }
 
+static unsigned int
+ieee80211_ibss_setup_scan_channels(struct wiphy *wiphy,
+				   const struct cfg80211_chan_def *chandef,
+				   struct ieee80211_channel **channels,
+				   unsigned int channels_max)
+{
+	struct ieee80211_channel *chan = NULL;
+	unsigned int n_chan = 0;
+	u32 start_freq, end_freq, width, center_freq, freq;
+
+	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_40:
+		width = 40;
+		break;
+	case NL80211_CHAN_WIDTH_80P80:
+	case NL80211_CHAN_WIDTH_80:
+		width = 80;
+		break;
+	case NL80211_CHAN_WIDTH_160:
+		width = 160;
+		break;
+	default:
+		width = 20;
+		break;
+	}
+
+	center_freq = chandef->center_freq1;
+
+	if (width <= 20) {
+		start_freq = center_freq;
+		end_freq = center_freq;
+	} else {
+		start_freq = center_freq - width/2 + 10;
+		end_freq = center_freq + width/2 - 10;
+	}
+
+	for (freq = start_freq; freq <= end_freq; freq += 20) {
+		chan = ieee80211_get_channel(wiphy, freq);
+		if (!chan)
+			continue;
+		if (n_chan >= channels_max)
+			return n_chan;
+
+		channels[n_chan] = chan;
+		n_chan++;
+	}
+
+	return n_chan;
+}
+
 /*
  * This function is called with state == IEEE80211_IBSS_MLME_SEARCH
  */
@@ -1397,11 +1447,18 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
 	/* Selected IBSS not found in current scan results - try to scan */
 	if (time_after(jiffies, ifibss->last_scan_completed +
 					IEEE80211_SCAN_INTERVAL)) {
+		struct ieee80211_channel *channels[8];
+		unsigned int num = 0;
+
 		sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
 
+		num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
+							 &ifibss->chandef,
+							 channels,
+							 ARRAY_SIZE(channels));
 		scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
 		ieee80211_request_ibss_scan(sdata, ifibss->ssid,
-					    ifibss->ssid_len, chan,
+					    ifibss->ssid_len, channels, num,
 					    scan_width);
 	} else {
 		int interval = IEEE80211_SCAN_INTERVAL;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 95ce152..05d3af5 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1556,7 +1556,8 @@ int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata);
 void ieee80211_scan_work(struct work_struct *work);
 int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
 				const u8 *ssid, u8 ssid_len,
-				struct ieee80211_channel *chan,
+				struct ieee80211_channel **channels,
+				unsigned int n_channels,
 				enum nl80211_bss_scan_width scan_width);
 int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
 			   struct cfg80211_scan_request *req);
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 7807fa4..18730b97 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -923,11 +923,12 @@ int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
 
 int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
 				const u8 *ssid, u8 ssid_len,
-				struct ieee80211_channel *chan,
+				struct ieee80211_channel **channels,
+				unsigned int n_channels,
 				enum nl80211_bss_scan_width scan_width)
 {
 	struct ieee80211_local *local = sdata->local;
-	int ret = -EBUSY;
+	int ret = -EBUSY, i, n_ch = 0;
 	enum ieee80211_band band;
 
 	mutex_lock(&local->mtx);
@@ -937,9 +938,8 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
 		goto unlock;
 
 	/* fill internal scan request */
-	if (!chan) {
-		int i, max_n;
-		int n_ch = 0;
+	if (!channels) {
+		int max_n;
 
 		for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
 			if (!local->hw.wiphy->bands[band])
@@ -964,12 +964,19 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
 
 		local->int_scan_req->n_channels = n_ch;
 	} else {
-		if (WARN_ON_ONCE(chan->flags & (IEEE80211_CHAN_NO_IR |
-						IEEE80211_CHAN_DISABLED)))
+		for (i = 0; i < n_channels; i++) {
+			if (channels[i]->flags & (IEEE80211_CHAN_NO_IR |
+						  IEEE80211_CHAN_DISABLED))
+				continue;
+
+			local->int_scan_req->channels[n_ch] = channels[i];
+			n_ch++;
+		}
+
+		if (WARN_ON_ONCE(n_ch == 0))
 			goto unlock;
 
-		local->int_scan_req->channels[0] = chan;
-		local->int_scan_req->n_channels = 1;
+		local->int_scan_req->n_channels = n_ch;
 	}
 
 	local->int_scan_req->ssids = &local->scan_ssid;
-- 
1.9.1


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

* [RFCv2 5/6] mac80211: ibss/mesh move bw checking
  2015-01-16 10:38 [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40 Janusz Dziedzic
                   ` (2 preceding siblings ...)
  2015-01-16 10:38 ` [RFCv2 4/6] mac80211: IBSS fix scan request Janusz Dziedzic
@ 2015-01-16 10:38 ` Janusz Dziedzic
  2015-01-16 10:38 ` [RFCv2 6/6] mac80211: IBSS setup correctly BW for VHT Janusz Dziedzic
  2015-01-16 10:49 ` [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40 Johannes Berg
  5 siblings, 0 replies; 15+ messages in thread
From: Janusz Dziedzic @ 2015-01-16 10:38 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Janusz Dziedzic

We will need this as a preparetion for VHT.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 net/mac80211/ht.c         | 2 --
 net/mac80211/ibss.c       | 4 ++++
 net/mac80211/mesh_plink.c | 4 ++++
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index ff630be..7a76ce6 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -252,8 +252,6 @@ bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
 		break;
 	}
 
-	if (bw != sta->sta.bandwidth)
-		changed = true;
 	sta->sta.bandwidth = bw;
 
 	sta->cur_max_bandwidth =
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index b1e9e9b..3c6df2b 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1064,6 +1064,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 			/* we both use HT */
 			struct ieee80211_ht_cap htcap_ie;
 			struct cfg80211_chan_def chandef;
+			enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth;
 
 			ieee80211_ht_oper_to_chandef(channel,
 						     elems->ht_operation,
@@ -1082,6 +1083,9 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 
 			rates_updated |= ieee80211_ht_cap_ie_to_sta_ht_cap(
 						sdata, sband, &htcap_ie, sta);
+
+			if (bw != sta->sta.bandwidth)
+				rates_updated |= true;
 		}
 
 		if (sta && rates_updated) {
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index fa94ca1..de5b8ac 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -382,6 +382,7 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,
 	enum ieee80211_band band = ieee80211_get_sdata_band(sdata);
 	struct ieee80211_supported_band *sband;
 	u32 rates, basic_rates = 0, changed = 0;
+	enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth;
 
 	sband = local->hw.wiphy->bands[band];
 	rates = ieee80211_sta_get_rates(sdata, elems, band, &basic_rates);
@@ -401,6 +402,9 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata,
 					      elems->ht_cap_elem, sta))
 		changed |= IEEE80211_RC_BW_CHANGED;
 
+	if (bw != sta->sta.bandwidth)
+		changed |= IEEE80211_RC_BW_CHANGED;
+
 	/* HT peer is operating 20MHz-only */
 	if (elems->ht_operation &&
 	    !(elems->ht_operation->ht_param &
-- 
1.9.1


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

* [RFCv2 6/6] mac80211: IBSS setup correctly BW for VHT
  2015-01-16 10:38 [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40 Janusz Dziedzic
                   ` (3 preceding siblings ...)
  2015-01-16 10:38 ` [RFCv2 5/6] mac80211: ibss/mesh move bw checking Janusz Dziedzic
@ 2015-01-16 10:38 ` Janusz Dziedzic
  2015-01-16 10:55   ` Johannes Berg
  2015-01-16 10:49 ` [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40 Johannes Berg
  5 siblings, 1 reply; 15+ messages in thread
From: Janusz Dziedzic @ 2015-01-16 10:38 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Janusz Dziedzic

Setup correctly BW in case of STA using VHT.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 net/mac80211/ibss.c        | 25 ++++++++++++++++---------
 net/mac80211/ieee80211_i.h |  3 +++
 net/mac80211/util.c        | 31 +++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 3c6df2b..b4263b5 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -1072,18 +1072,25 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 
 			memcpy(&htcap_ie, elems->ht_cap_elem, sizeof(htcap_ie));
 
-			/*
-			 * fall back to HT20 if we don't use or use
-			 * the other extension channel
-			 */
-			if (chandef.center_freq1 !=
-			    sdata->u.ibss.chandef.center_freq1)
-				htcap_ie.cap_info &=
-					cpu_to_le16(~IEEE80211_HT_CAP_SUP_WIDTH_20_40);
-
 			rates_updated |= ieee80211_ht_cap_ie_to_sta_ht_cap(
 						sdata, sband, &htcap_ie, sta);
 
+			if (elems->vht_operation && elems->vht_cap_elem &&
+			    sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_20 &&
+			    sdata->u.ibss.chandef.width != NL80211_CHAN_WIDTH_40) {
+				/* we both use VHT */
+				struct ieee80211_vht_cap vhtcap_ie;
+				struct ieee80211_sta_vht_cap vht_cap = sta->sta.vht_cap;
+
+				ieee80211_vht_oper_to_chandef(channel,
+							      elems->vht_operation,
+							      &chandef);
+				memcpy(&vhtcap_ie, elems->vht_cap_elem, sizeof(vhtcap_ie));
+				ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband, &vhtcap_ie, sta);
+				if (memcmp(&vht_cap, &sta->sta.vht_cap, sizeof(vht_cap)))
+						rates_updated |= true;
+			}
+
 			if (bw != sta->sta.bandwidth)
 				rates_updated |= true;
 		}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 05d3af5..a3e93ad 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1953,6 +1953,9 @@ u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo);
 void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan,
 				  const struct ieee80211_ht_operation *ht_oper,
 				  struct cfg80211_chan_def *chandef);
+void ieee80211_vht_oper_to_chandef(struct ieee80211_channel *control_chan,
+				   const struct ieee80211_vht_operation *oper,
+				   struct cfg80211_chan_def *chandef);
 u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c);
 
 int __must_check
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index ee6a601..f5599ac 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2393,6 +2393,37 @@ void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan,
 	cfg80211_chandef_create(chandef, control_chan, channel_type);
 }
 
+void ieee80211_vht_oper_to_chandef(struct ieee80211_channel *control_chan,
+				   const struct ieee80211_vht_operation *oper,
+				   struct cfg80211_chan_def *chandef)
+{
+	if (!oper)
+		return;
+
+	chandef->chan = control_chan;
+
+	switch (oper->chan_width) {
+	case IEEE80211_VHT_CHANWIDTH_USE_HT:
+		break;
+	case IEEE80211_VHT_CHANWIDTH_80MHZ:
+		chandef->width = NL80211_CHAN_WIDTH_80;
+		break;
+	case IEEE80211_VHT_CHANWIDTH_160MHZ:
+		chandef->width = NL80211_CHAN_WIDTH_160;
+		break;
+	case IEEE80211_VHT_CHANWIDTH_80P80MHZ:
+		chandef->width = NL80211_CHAN_WIDTH_80P80;
+		break;
+	}
+
+	chandef->center_freq1 = ieee80211_channel_to_frequency(
+						oper->center_freq_seg1_idx,
+						control_chan->band);
+	chandef->center_freq2 = ieee80211_channel_to_frequency(
+						oper->center_freq_seg2_idx,
+						control_chan->band);
+}
+
 int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef,
 			     const struct ieee80211_supported_band *sband,
 			     const u8 *srates, int srates_len, u32 *rates)
-- 
1.9.1


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

* Re: [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40
  2015-01-16 10:38 [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40 Janusz Dziedzic
                   ` (4 preceding siblings ...)
  2015-01-16 10:38 ` [RFCv2 6/6] mac80211: IBSS setup correctly BW for VHT Janusz Dziedzic
@ 2015-01-16 10:49 ` Johannes Berg
  2015-01-16 11:24   ` Janusz Dziedzic
  5 siblings, 1 reply; 15+ messages in thread
From: Johannes Berg @ 2015-01-16 10:49 UTC (permalink / raw)
  To: Janusz Dziedzic; +Cc: linux-wireless

On Fri, 2015-01-16 at 11:38 +0100, Janusz Dziedzic wrote:
> In some cases when used HT40+/HT40-, center_freq1
> was configured incorrectly. Next this couse

couse?

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

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

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

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

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

johannes



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

* Re: [RFCv2 3/6] mac80211: add VHT support for IBSS
  2015-01-16 10:38 ` [RFCv2 3/6] mac80211: " Janusz Dziedzic
@ 2015-01-16 10:52   ` Johannes Berg
  0 siblings, 0 replies; 15+ messages in thread
From: Johannes Berg @ 2015-01-16 10:52 UTC (permalink / raw)
  To: Janusz Dziedzic; +Cc: linux-wireless

On Fri, 2015-01-16 at 11:38 +0100, Janusz Dziedzic wrote:
> Add VHT80/VHT160 support for IBSS.
> Drivers could activate this feature by
> setting NL80211_FEATURE_VHT_IBSS flag.
> 
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
> ---
>  net/mac80211/ibss.c        | 11 +++++++++++
>  net/mac80211/ieee80211_i.h |  2 ++
>  net/mac80211/util.c        | 35 +++++++++++++++++++++++++++++++++++
>  3 files changed, 48 insertions(+)
> 
> diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
> index 13b8105..1ffcfab 100644
> --- a/net/mac80211/ibss.c
> +++ b/net/mac80211/ibss.c
> @@ -188,6 +188,15 @@ ieee80211_ibss_build_presp(struct ieee80211_sub_if_data *sdata,
>  		 */
>  		pos = ieee80211_ie_build_ht_oper(pos, &sband->ht_cap,
>  						 chandef, 0);
> +
> +		if (chandef->width != NL80211_CHAN_WIDTH_20 &&
> +		    chandef->width != NL80211_CHAN_WIDTH_40 &&
> +		    sband->vht_cap.vht_supported) {
> +			pos = ieee80211_ie_build_vht_cap(pos, &sband->vht_cap,
> +							 sband->vht_cap.cap);
> +			pos = ieee80211_ie_build_vht_oper(pos, &sband->vht_cap,
> +							  chandef);
> +		}
>  	}
>  
>  	if (local->hw.queues >= IEEE80211_NUM_ACS)
> @@ -411,6 +420,8 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
>  		cfg80211_chandef_create(&chandef, cbss->channel, chan_type);
>  		break;
>  	case NL80211_CHAN_WIDTH_40:
> +	case NL80211_CHAN_WIDTH_80:
> +	case NL80211_CHAN_WIDTH_160:
>  		cfg80211_chandef_create(&chandef, cbss->channel,
>  					NL80211_CHAN_WIDTH_20_NOHT);
>  		chandef.width = sdata->u.ibss.chandef.width;

Hmm. Must you not get a chandef from cfg80211 so you don't need this
weird roundtrip through chandef_create()?

Anyway this is more of the discussion on patch 1.

johannes


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

* Re: [RFCv2 6/6] mac80211: IBSS setup correctly BW for VHT
  2015-01-16 10:38 ` [RFCv2 6/6] mac80211: IBSS setup correctly BW for VHT Janusz Dziedzic
@ 2015-01-16 10:55   ` Johannes Berg
  2015-01-16 12:08     ` Janusz Dziedzic
  0 siblings, 1 reply; 15+ messages in thread
From: Johannes Berg @ 2015-01-16 10:55 UTC (permalink / raw)
  To: Janusz Dziedzic; +Cc: linux-wireless

On Fri, 2015-01-16 at 11:38 +0100, Janusz Dziedzic wrote:

> +				/* we both use VHT */
> +				struct ieee80211_vht_cap vhtcap_ie;
> +				struct ieee80211_sta_vht_cap vht_cap = sta->sta.vht_cap;
> +
> +				ieee80211_vht_oper_to_chandef(channel,
> +							      elems->vht_operation,
> +							      &chandef);

Ok maybe I'm missing something - but can't this erroneously configure
the local HW to 160 MHz when it doesn't even support it, or so?

> +				memcpy(&vhtcap_ie, elems->vht_cap_elem, sizeof(vhtcap_ie));
> +				ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband, &vhtcap_ie, sta);
> +				if (memcmp(&vht_cap, &sta->sta.vht_cap, sizeof(vht_cap)))
> +						rates_updated |= true;

Indentation is wrong here.

johannes


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

* Re: [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40
  2015-01-16 10:49 ` [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40 Johannes Berg
@ 2015-01-16 11:24   ` Janusz Dziedzic
  2015-01-16 11:47     ` Johannes Berg
  0 siblings, 1 reply; 15+ messages in thread
From: Janusz Dziedzic @ 2015-01-16 11:24 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

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

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

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

BR
Janusz

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

* Re: [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40
  2015-01-16 11:24   ` Janusz Dziedzic
@ 2015-01-16 11:47     ` Johannes Berg
  2015-01-16 12:18       ` Janusz Dziedzic
  0 siblings, 1 reply; 15+ messages in thread
From: Johannes Berg @ 2015-01-16 11:47 UTC (permalink / raw)
  To: Janusz Dziedzic; +Cc: linux-wireless

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

Sounds more like we store and use invalid data?

johannes


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

* Re: [RFCv2 6/6] mac80211: IBSS setup correctly BW for VHT
  2015-01-16 10:55   ` Johannes Berg
@ 2015-01-16 12:08     ` Janusz Dziedzic
  2015-01-16 12:18       ` Johannes Berg
  0 siblings, 1 reply; 15+ messages in thread
From: Janusz Dziedzic @ 2015-01-16 12:08 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On 16 January 2015 at 11:55, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Fri, 2015-01-16 at 11:38 +0100, Janusz Dziedzic wrote:
>
>> +                             /* we both use VHT */
>> +                             struct ieee80211_vht_cap vhtcap_ie;
>> +                             struct ieee80211_sta_vht_cap vht_cap = sta->sta.vht_cap;
>> +
>> +                             ieee80211_vht_oper_to_chandef(channel,
>> +                                                           elems->vht_operation,
>> +                                                           &chandef);
>
> Ok maybe I'm missing something - but can't this erroneously configure
> the local HW to 160 MHz when it doesn't even support it, or so?
>
I will check this more. But seems chandef (sta chandef) is a local
variable here, not used by the way.
So, our chandef is form cfg80211 (sdata->u.ibss.chandef) and we don't
change this.
Orginaly this sta chandef was used to compare with ibss->chandef.

-                       if (chandef.center_freq1 !=
-                           sdata->u.ibss.chandef.center_freq1)
-                               htcap_ie.cap_info &=
-
cpu_to_le16(~IEEE80211_HT_CAP_SUP_WIDTH_20_40);

But for me this check seems as not needed, eg.
We support VHT80 and other ibss have only HT40 support - so we will
have different center_freq1 - but still could operate, while sta_add
and correct rates for sta configured.
One I think we could check here is, if our chandef and sta chandef overlap.

Anyway, I am not sure I understand your question correctly, you mean eg.
we work in VHT80 mode and other ibss join in VHT160 mode? Does it
really matter while we will use sta_add for this new V160 "station"
and configure supported rates for this station?

BR
Janusz

>> +                             memcpy(&vhtcap_ie, elems->vht_cap_elem, sizeof(vhtcap_ie));
>> +                             ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband, &vhtcap_ie, sta);
>> +                             if (memcmp(&vht_cap, &sta->sta.vht_cap, sizeof(vht_cap)))
>> +                                             rates_updated |= true;
>
> Indentation is wrong here.
>
> johannes
>

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

* Re: [RFCv2 6/6] mac80211: IBSS setup correctly BW for VHT
  2015-01-16 12:08     ` Janusz Dziedzic
@ 2015-01-16 12:18       ` Johannes Berg
  2015-01-16 12:48         ` Janusz Dziedzic
  0 siblings, 1 reply; 15+ messages in thread
From: Johannes Berg @ 2015-01-16 12:18 UTC (permalink / raw)
  To: Janusz Dziedzic; +Cc: linux-wireless

On Fri, 2015-01-16 at 13:08 +0100, Janusz Dziedzic wrote:
> On 16 January 2015 at 11:55, Johannes Berg <johannes@sipsolutions.net> wrote:
> > On Fri, 2015-01-16 at 11:38 +0100, Janusz Dziedzic wrote:
> >
> >> +                             /* we both use VHT */
> >> +                             struct ieee80211_vht_cap vhtcap_ie;
> >> +                             struct ieee80211_sta_vht_cap vht_cap = sta->sta.vht_cap;
> >> +
> >> +                             ieee80211_vht_oper_to_chandef(channel,
> >> +                                                           elems->vht_operation,
> >> +                                                           &chandef);
> >
> > Ok maybe I'm missing something - but can't this erroneously configure
> > the local HW to 160 MHz when it doesn't even support it, or so?
> >
> I will check this more. But seems chandef (sta chandef) is a local
> variable here, not used by the way.
> So, our chandef is form cfg80211 (sdata->u.ibss.chandef) and we don't
> change this.
> Orginaly this sta chandef was used to compare with ibss->chandef.
> 
> -                       if (chandef.center_freq1 !=
> -                           sdata->u.ibss.chandef.center_freq1)
> -                               htcap_ie.cap_info &=
> -
> cpu_to_le16(~IEEE80211_HT_CAP_SUP_WIDTH_20_40);
> 
> But for me this check seems as not needed, eg.
> We support VHT80 and other ibss have only HT40 support - so we will
> have different center_freq1 - but still could operate, while sta_add
> and correct rates for sta configured.
> One I think we could check here is, if our chandef and sta chandef overlap.
> 
> Anyway, I am not sure I understand your question correctly, you mean eg.
> we work in VHT80 mode and other ibss join in VHT160 mode? Does it
> really matter while we will use sta_add for this new V160 "station"
> and configure supported rates for this station?

Well like I said - I might not understand this correctly. But the
ieee80211_vht_oper_to_chandef() function doesn't - iirc - take into
account local capabilities. As a consequence, if a VHT160 station joins
the chandef might be 160 while we're only supporting 80?

But anyway - I see that at least what I originally thought was wrong -
this code isn't concerned with picking up the channel from the peer to
join the networks together, I guess. That's what I was worried about.
That code I haven't seen and checked though - so perhaps you can look
there if it correctly handles trying to form a network when the peer has
higher capabilities than the local hw.

johannes


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

* Re: [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40
  2015-01-16 11:47     ` Johannes Berg
@ 2015-01-16 12:18       ` Janusz Dziedzic
  0 siblings, 0 replies; 15+ messages in thread
From: Janusz Dziedzic @ 2015-01-16 12:18 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

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

BR
Janusz

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

* Re: [RFCv2 6/6] mac80211: IBSS setup correctly BW for VHT
  2015-01-16 12:18       ` Johannes Berg
@ 2015-01-16 12:48         ` Janusz Dziedzic
  0 siblings, 0 replies; 15+ messages in thread
From: Janusz Dziedzic @ 2015-01-16 12:48 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On 16 January 2015 at 13:18, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Fri, 2015-01-16 at 13:08 +0100, Janusz Dziedzic wrote:
>> On 16 January 2015 at 11:55, Johannes Berg <johannes@sipsolutions.net> wrote:
>> > On Fri, 2015-01-16 at 11:38 +0100, Janusz Dziedzic wrote:
>> >
>> >> +                             /* we both use VHT */
>> >> +                             struct ieee80211_vht_cap vhtcap_ie;
>> >> +                             struct ieee80211_sta_vht_cap vht_cap = sta->sta.vht_cap;
>> >> +
>> >> +                             ieee80211_vht_oper_to_chandef(channel,
>> >> +                                                           elems->vht_operation,
>> >> +                                                           &chandef);
>> >
>> > Ok maybe I'm missing something - but can't this erroneously configure
>> > the local HW to 160 MHz when it doesn't even support it, or so?
>> >
>> I will check this more. But seems chandef (sta chandef) is a local
>> variable here, not used by the way.
>> So, our chandef is form cfg80211 (sdata->u.ibss.chandef) and we don't
>> change this.
>> Orginaly this sta chandef was used to compare with ibss->chandef.
>>
>> -                       if (chandef.center_freq1 !=
>> -                           sdata->u.ibss.chandef.center_freq1)
>> -                               htcap_ie.cap_info &=
>> -
>> cpu_to_le16(~IEEE80211_HT_CAP_SUP_WIDTH_20_40);
>>
>> But for me this check seems as not needed, eg.
>> We support VHT80 and other ibss have only HT40 support - so we will
>> have different center_freq1 - but still could operate, while sta_add
>> and correct rates for sta configured.
>> One I think we could check here is, if our chandef and sta chandef overlap.
>>
>> Anyway, I am not sure I understand your question correctly, you mean eg.
>> we work in VHT80 mode and other ibss join in VHT160 mode? Does it
>> really matter while we will use sta_add for this new V160 "station"
>> and configure supported rates for this station?
>
> Well like I said - I might not understand this correctly. But the
> ieee80211_vht_oper_to_chandef() function doesn't - iirc - take into
> account local capabilities. As a consequence, if a VHT160 station joins
> the chandef might be 160 while we're only supporting 80?
>
> But anyway - I see that at least what I originally thought was wrong -
> this code isn't concerned with picking up the channel from the peer to
> join the networks together, I guess. That's what I was worried about.
> That code I haven't seen and checked though - so perhaps you can look
> there if it correctly handles trying to form a network when the peer has
> higher capabilities than the local hw.
>
I am testing different combinations and TP

HT20 <-> HT40
HT20 <-> VHT80
HT40 <-> VHT80
HT40 <-> VHT80
VHT80 <-> HT20
VHT80 <-> HT40

using ath9k and ath10k. What I see using iw wlan0 info, we always
using chandef we pass from cfg80211.
We also update nss/rates/bw correctly in sta_rc_update().
But anyway will do more tests.

BR
Janusz

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

end of thread, other threads:[~2015-01-16 12:48 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-16 10:38 [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40 Janusz Dziedzic
2015-01-16 10:38 ` [RFCv2 2/6] cfg80211: add VHT support for IBSS Janusz Dziedzic
2015-01-16 10:38 ` [RFCv2 3/6] mac80211: " Janusz Dziedzic
2015-01-16 10:52   ` Johannes Berg
2015-01-16 10:38 ` [RFCv2 4/6] mac80211: IBSS fix scan request Janusz Dziedzic
2015-01-16 10:38 ` [RFCv2 5/6] mac80211: ibss/mesh move bw checking Janusz Dziedzic
2015-01-16 10:38 ` [RFCv2 6/6] mac80211: IBSS setup correctly BW for VHT Janusz Dziedzic
2015-01-16 10:55   ` Johannes Berg
2015-01-16 12:08     ` Janusz Dziedzic
2015-01-16 12:18       ` Johannes Berg
2015-01-16 12:48         ` Janusz Dziedzic
2015-01-16 10:49 ` [RFCv2 1/6] mac80211: ibss, fix chandef setup for HT40 Johannes Berg
2015-01-16 11:24   ` Janusz Dziedzic
2015-01-16 11:47     ` Johannes Berg
2015-01-16 12:18       ` Janusz Dziedzic

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).