All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH-v2] mac80211:  Let VHT work on 2.4Ghz
@ 2016-03-10 18:08 greearb
  2016-03-15 14:10 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: greearb @ 2016-03-10 18:08 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Ben Greear

From: Ben Greear <greearb@candelatech.com>

ath10k supports VHT on 2.4Ghz band.
If supplicant and hostapd and radio think
VHT should be allowed, then kernel should let them
try, as long as at least one band can do 80Mhz.

If no bands can do 80Mhz, then that is an indication that
VHT is not enabled in this regulatory domain.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
v2:  Only allow VHT on 2.4 if 80Mhz is available on at least one band.

 net/mac80211/ieee80211_i.h |  1 +
 net/mac80211/mlme.c        | 15 +--------------
 net/mac80211/util.c        | 33 +++++++++++++++++++++++----------
 net/mac80211/vht.c         | 15 ++-------------
 4 files changed, 27 insertions(+), 37 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 19de36f..c0dc0e2 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1800,6 +1800,7 @@ static inline int __ieee80211_resume(struct ieee80211_hw *hw)
 }
 
 /* utility functions/constants */
+bool ieee80211_any_band_supports_80mhz(struct ieee80211_local *local);
 extern const void *const mac80211_wiphy_privid; /* for wiphy privid */
 int ieee80211_frame_duration(enum ieee80211_band band, size_t len,
 			     int rate, int erp, int short_preamble,
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index b63cd7d..d6e9bdc 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -4228,8 +4228,6 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
 	struct ieee80211_supported_band *sband;
 	struct cfg80211_chan_def chandef;
 	int ret;
-	u32 i;
-	bool have_80mhz;
 
 	sband = local->hw.wiphy->bands[cbss->channel->band];
 
@@ -4280,18 +4278,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
 		}
 	}
 
-	/* Allow VHT if at least one channel on the sband supports 80 MHz */
-	have_80mhz = false;
-	for (i = 0; i < sband->n_channels; i++) {
-		if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED |
-						IEEE80211_CHAN_NO_80MHZ))
-			continue;
-
-		have_80mhz = true;
-		break;
-	}
-
-	if (!have_80mhz)
+	if (!ieee80211_any_band_supports_80mhz(local))
 		ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
 
 	ifmgd->flags |= ieee80211_determine_chantype(sdata, sband,
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 56b2c27..ae90c4f 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -762,6 +762,27 @@ void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL(ieee80211_queue_delayed_work);
 
+bool ieee80211_any_band_supports_80mhz(struct ieee80211_local *local)
+{
+	int i;
+	struct ieee80211_supported_band *sband;
+
+	for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+		int q;
+		sband = local->hw.wiphy->bands[i];
+		if (!sband)
+			continue;
+		for (q = 0; q < sband->n_channels; q++) {
+			if (sband->channels[q].flags &
+			    (IEEE80211_CHAN_DISABLED | IEEE80211_CHAN_NO_80MHZ))
+				continue;
+
+			return true;
+		}
+	}
+	return false;
+}
+
 u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
 			       struct ieee802_11_elems *elems,
 			       u64 filter, u32 crc)
@@ -1375,7 +1396,7 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_local *local,
 	int ext_rates_len;
 	int shift;
 	u32 rate_flags;
-	bool have_80mhz = false;
+	bool have_80mhz;
 
 	*offset = 0;
 
@@ -1504,15 +1525,7 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_local *local,
 		*offset = noffset;
 	}
 
-	/* Check if any channel in this sband supports at least 80 MHz */
-	for (i = 0; i < sband->n_channels; i++) {
-		if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED |
-						IEEE80211_CHAN_NO_80MHZ))
-			continue;
-
-		have_80mhz = true;
-		break;
-	}
+	have_80mhz = ieee80211_any_band_supports_80mhz(local);
 
 	if (sband->vht_cap.vht_supported && have_80mhz) {
 		if (end - pos < 2 + sizeof(struct ieee80211_vht_cap))
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index c38b2f0..a08a77f 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -120,7 +120,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
 	struct ieee80211_sta_vht_cap *vht_cap = &sta->sta.vht_cap;
 	struct ieee80211_sta_vht_cap own_cap;
 	u32 cap_info, i;
-	bool have_80mhz;
+	struct ieee80211_local *local = sdata->local;
 
 	memset(vht_cap, 0, sizeof(*vht_cap));
 
@@ -130,18 +130,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
 	if (!vht_cap_ie || !sband->vht_cap.vht_supported)
 		return;
 
-	/* Allow VHT if at least one channel on the sband supports 80 MHz */
-	have_80mhz = false;
-	for (i = 0; i < sband->n_channels; i++) {
-		if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED |
-						IEEE80211_CHAN_NO_80MHZ))
-			continue;
-
-		have_80mhz = true;
-		break;
-	}
-
-	if (!have_80mhz)
+	if (!ieee80211_any_band_supports_80mhz(local))
 		return;
 
 	/*
-- 
2.4.3


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

* Re: [PATCH-v2] mac80211:  Let VHT work on 2.4Ghz
  2016-03-10 18:08 [PATCH-v2] mac80211: Let VHT work on 2.4Ghz greearb
@ 2016-03-15 14:10 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2016-03-15 14:10 UTC (permalink / raw)
  To: greearb, linux-wireless

On Thu, 2016-03-10 at 10:08 -0800, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> ath10k supports VHT on 2.4Ghz band.

I still don't think this is the right thing to do.

Most implementations seem to use the BRCM vendor IE to advertise "VHT"
features on 2.4 GHz, since the spec requires 5 GHz for the real ones.

The combination of ath10k with mac80211 seems to be broken in that
regard right now, since mac80211 didn't expect drivers to set the
capabilities for 2.4 GHz band.

I guess we can get away with using the regular capabilities towards
userspace, but as far as the IEs are concerned we should probably use
the BRCM ones.

johannes

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

end of thread, other threads:[~2016-03-15 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-10 18:08 [PATCH-v2] mac80211: Let VHT work on 2.4Ghz greearb
2016-03-15 14:10 ` 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.