From nobody Sat Dec 31 02:33:03 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NkR4b3qv4z2l9mx; Sat, 31 Dec 2022 02:33:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NkR4b3Q8bz4HTW; Sat, 31 Dec 2022 02:33:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672453983; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h27dKFXum7eGNs3ISlqScGa+/k+/g+bvqd2ZwmPh5nY=; b=Jym5LP/ykv8bEAUEPyaUaNFBKe2wXAIKRtjWKfTuU9cl6nTl8mMbKCG4BfkroKSn1As/+e uGu9kR8glUDvIbwaEtkimnzeZ73NLFXhlSSscV618nDCtTpF7TEtxr+ziMR3FnKlrYcHxZ Cqwjz0S6JfijWTY2IZIOEW/tzKsTsNdSYko+OkbHNhoe5CGSenxENN420Hsej1nW78+Qyz qdJlnuiM1DoFGoNfwzblDmYEYpDGx/v/f53ZuvfdrdQHClkrkb0kzoHZdcE4HlGDbjsC/n +ClG2ArX/Ofr+JNFmSoy8V5l4t9uBKXwtBdjrIRZx4terFgPhOlCyLUd+CPazA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672453983; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h27dKFXum7eGNs3ISlqScGa+/k+/g+bvqd2ZwmPh5nY=; b=dXwn0LAG/CPLSU0bnn8zgBJ9lzBViXFnXiAzTCq6ufnsSX0Ud74ZipnUjX7tklUKe7VQA/ K5kbzmipRnuDmq6TAgEbp3JZ4aTS7HHHrZQt0iyBynkEDNuA1DinQhXRuRG1IFgLz3SPxm Bf/EtJt7+Y5crAibbcTiS4ETzAO49Yp25ImAntb/TDVbE6IHsWl1o4OASsMPrzBJoEN5tN 6O/ynvKMujrPb7epN90yfDMl9S1tZsJ70rvoCQCX6TDu1LrSSgDPaq7MMnpRTJqymtteCp EjB1/1gQSDgK8m4X8sKxr7+DrL3TA5tZQ3elugN6yVRASv+O5Zp6hSUns7yrUg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672453983; a=rsa-sha256; cv=none; b=TdjatVPY+Tu2WgCY2dcZ2wmh+zLtLQImvCXHaRhxDzzSO03G78fr9wf2tYVhyb/p/rpBrF 6EyVVtp26v3qCpMvlnIjarsdIj5pd4KaMa9+FjozQxINW1OIxMN3o68B0rWDGEson8aB6F RC3+HsShxVi3eqNufCAm7myHOF+k1d52fZQDChepMUIlbp4aKMp6GHmXW7Zhr6EUVxXuug gvgqdpZ8CyGSUDQ4Sv7BtwAG/n61yHmypLxuQdSGq2DWp3BWfxbL0iFJpp+luX9WeincM3 nNW7iobxL2nwMkSn/gF6m7m5+97Lb/YzRlM9iqI9WkVWbtQM8Ty5SKeAVfcOJg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NkR4b2X28zWsK; Sat, 31 Dec 2022 02:33:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BV2X3UP021144; Sat, 31 Dec 2022 02:33:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BV2X3ug021143; Sat, 31 Dec 2022 02:33:03 GMT (envelope-from git) Date: Sat, 31 Dec 2022 02:33:03 GMT Message-Id: <202212310233.2BV2X3ug021143@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 13d87d92e401 - main - LinuxKPI: 802.11: implement cfg80211_get_ies_channel_number() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13d87d92e401523f8d8e817720d40dc31cdfa444 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=13d87d92e401523f8d8e817720d40dc31cdfa444 commit 13d87d92e401523f8d8e817720d40dc31cdfa444 Author: Bjoern A. Zeeb AuthorDate: 2022-12-31 01:59:20 +0000 Commit: Bjoern A. Zeeb 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); }