[PATCH 150/379][SRU][OEM-5.6] cfg80211: add a helper to identify 6 GHz PSCs

You-Sheng Yang vicamo.yang at canonical.com
Wed Dec 23 08:48:03 UTC 2020


From: Johannes Berg <johannes.berg at intel.com>

BugLink: https://bugs.launchpad.net/bugs/1879633

This allows identifying whether or not a channel is a PSC
(preferred scanning channel).

Link: https://lore.kernel.org/r/20200528213443.414363ecf62c.Ic15e681a0e249eab7350a06ceb582cca8bb9a080@changeid
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
(cherry picked from commit afbc9c9e8bfe71e8bd12a8c01bedd969fbab8f0e)
Signed-off-by: You-Sheng Yang <vicamo.yang at canonical.com>
---
 include/net/cfg80211.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 436ad383e040..000dc0f9e665 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5077,6 +5077,21 @@ int ieee80211_frequency_to_channel(int freq);
  */
 struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq);
 
+/**
+ * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
+ * @chan: control channel to check
+ *
+ * The Preferred Scanning Channels (PSC) are defined in
+ * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
+ */
+static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
+{
+	if (chan->band != NL80211_BAND_6GHZ)
+		return false;
+
+	return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
+}
+
 /**
  * ieee80211_get_response_rate - get basic rate for a given rate
  *
-- 
2.29.2




More information about the kernel-team mailing list