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>
This commit is contained in:
Lachlan Hodges
2026-06-26 16:28:57 +10:00
committed by Johannes Berg
parent 5e20d72350
commit 1c29c67bc7

View File

@@ -1236,6 +1236,26 @@ ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
return chandef->chan->max_power;
}
/**
* 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