git: 13d87d92e401 - main - LinuxKPI: 802.11: implement cfg80211_get_ies_channel_number()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 31 Dec 2022 02:33:03 UTC
The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=13d87d92e401523f8d8e817720d40dc31cdfa444 commit 13d87d92e401523f8d8e817720d40dc31cdfa444 Author: Bjoern A. Zeeb <bz@FreeBSD.org> AuthorDate: 2022-12-31 01:59:20 +0000 Commit: Bjoern A. Zeeb <bz@FreeBSD.org> CommitDate: 2022-12-31 01:59:20 +0000 LinuxKPI: 802.11: implement cfg80211_get_ies_channel_number() Using the previous changes implement cfg80211_get_ies_channel_number() either based on DSPARMS (or for the future HTINFO). Sponsored by: The FreeBSD Foundation MFC after: 10 days --- sys/compat/linuxkpi/common/include/net/cfg80211.h | 28 +++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h index 7e8e1a3adab6..ce2cdb3327f8 100644 --- a/sys/compat/linuxkpi/common/include/net/cfg80211.h +++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h @@ -1740,12 +1740,36 @@ cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel) return (false); } -static __inline int +static inline int cfg80211_get_ies_channel_number(const uint8_t *ie, size_t len, enum nl80211_band band, enum cfg80211_bss_frame_type ftype) { + const struct element *elem; - TODO(); + switch (band) { + case NL80211_BAND_6GHZ: + TODO(); + break; + case NL80211_BAND_5GHZ: + case NL80211_BAND_2GHZ: + /* DSPARAMS has the channel number. */ + elem = cfg80211_find_elem(IEEE80211_ELEMID_DSPARMS, ie, len); + if (elem != NULL && elem->datalen == 1) + return (elem->data[0]); + /* HTINFO has the primary center channel. */ + elem = cfg80211_find_elem(IEEE80211_ELEMID_HTINFO, ie, len); + if (elem != NULL && + elem->datalen >= (sizeof(struct ieee80211_ie_htinfo) - 2)) { + const struct ieee80211_ie_htinfo *htinfo; + htinfo = (const struct ieee80211_ie_htinfo *)elem; + return (htinfo->hi_ctrlchannel); + } + /* What else? */ + break; + default: + IMPROVE("Unsupported"); + break; + } return (-1); }