Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4971063a authored by Johannes Berg's avatar Johannes Berg Committed by Gerrit - the friendly Code Review server
Browse files

cfg80211: add a helper to identify 6 GHz PSCs

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: default avatarJohannes Berg <johannes.berg@intel.com>
Git-commit: afbc9c9e8bfe71e8bd12a8c01bedd969fbab8f0e
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git


CRs-Fixed: 2743684
Change-Id: Idfaa06479f9812bd1243c06f257b3253e83c8134
Signed-off-by: default avatarVinita S. Maloo <vmaloo@codeaurora.org>
parent caa449d9
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -4734,6 +4734,21 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq)
	return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(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
 *