summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLachlan Hodges <lachlan.hodges@morsemicro.com>2026-06-26 16:28:57 +1000
committerJohannes Berg <johannes.berg@intel.com>2026-07-06 12:56:07 +0200
commit1c29c67bc7a9962e2ef91e8c65b7fc4fa227eded (patch)
treefef7c71f75ccc8b01b2ab9acb9a6806e2c7dc6e0
parent5e20d72350df589478691310f0e1c427f35ee4aa (diff)
wifi: cfg80211: introduce helper to get S1G primary width
This is needed for drivers and will be needed for mac80211/cfg80211 in the future so introduce a generic accessor to retrieve the chandefs S1G primary channel width. Signed-off-by: Lachlan Hodges <lachlan.hodges@morsemicro.com> Link: https://patch.msgid.link/20260626063014.1275235-2-lachlan.hodges@morsemicro.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/net/cfg80211.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index d91533a66712..b8e9fbb89e69 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1237,6 +1237,26 @@ ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
}
/**
+ * cfg80211_chandef_s1g_pri_width - return S1G primary width in MHz
+ *
+ * An S1G interface may have a primary channel width of either 1
+ * or 2MHz depending on whether chandef::s1g_primary_2mhz is set.
+ *
+ * Note: There is _always_ a 1MHz primary subchannel, regardless
+ * of the primary width. So chandef::chan always points to this
+ * 1MHz primary channel.
+ *
+ * @chandef: the chandef to use
+ *
+ * Returns: width in MHz of the S1G primary channel in use
+ */
+static inline int
+cfg80211_chandef_s1g_pri_width(struct cfg80211_chan_def *chandef)
+{
+ return chandef->s1g_primary_2mhz ? 2 : 1;
+}
+
+/**
* cfg80211_any_usable_channels - check for usable channels
* @wiphy: the wiphy to check for
* @band_mask: which bands to check on