From nobody Sun Feb 23 00:38:51 2025 X-Original-To: dev-commits-src-all@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 4Z0lNW714Pz5p20T; Sun, 23 Feb 2025 00:38:51 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z0lNW6Wj3z42Bs; Sun, 23 Feb 2025 00:38:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740271131; 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=CVeLkOPrnHgN99INp5Nenunwf6LjvJZUsUIySa3wvts=; b=pbLwPOXY8ccbkNGdgxSxu7ZefglE/npkQBS9DLjxl7NS8S5D3XBUbVIPz80MpC5PH0ZDH4 fZTuD7TN+Wl2TNxZV3L3BgFHaHTkceVvw2OF2sMYzBpkG2pKnAJwm9ByICP76dkRDmTPvp HDZ/DhTRhxPOEwrQHVVg6uQyYY5kzD/JLfZfg9JAIUyCUjqiSrg3AzudZvqHQcMDZJa3e6 vY8u6j+zAmygb5i3ur/C8Uvi/MU6er+YIwDBnAxtRQ1G99kpIgAYYQf2x3g4dFT/IRzKBs iGdeEWJQENsP84EFJPB915//n9k1pkfr/JYhC5IZdNJztxYiaocqG3UmRh5b/g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740271131; a=rsa-sha256; cv=none; b=wl83S5t1wh7zE7tzZoxGiQ/tWhaSeEgylMeIPhhSiTqe4Z2Msw77nk7pW5mMhaipSamv4C 9zqWQYxy3TxZxDIZChhTlGVnGInkogp9ivrpgEPoVEz7VOnqCp1F4J/GoJROIcWN8YgiQT Pm8a6H8k42seU6pNWfzz6ABiD3vnK+JANE1xWLNxV+LOYw2yo5o3BWkvlLPOtE9mqRupJo bogYP/ZwIyxHVdpYm9O0QZLN3bSGcVPguBMDpCMEx9mQnRJjvWSeKisoOFfA6TlJbFGdhf sSCwhID5CCaFUWMIpg1V1Ytt+vsWuVmppPeuF+iPkA5QWx/zQ2h2bFYFXyR7dw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740271131; 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=CVeLkOPrnHgN99INp5Nenunwf6LjvJZUsUIySa3wvts=; b=aGOddhcTyu7mmN/i/quGGvERh5vaW+z1LMJ2Jv0ngNcAb+EfEDLM1x7FjvuUPwtLv5sEYO o15O/bF96yt+rGZCQCA8HndQ0KB6j/FBI2zCMQdt2/0WGDw1EVKvrWD6/fHHC8K5zLCuN/ 8Mf+lNIzlTmvBPqpc/ww5TgMUDncKju3jJWkn8GHVD8Gp9Bq/IMaI+urCTV2LPdEoatoOb l1HnPhnEZW+Tb9MGBRaVRRJF6+KxkeGPTdFIIUw9OgfQKkF/vAobI2KPbXaOQsUwgAkiJQ 2D3Dke/k8Dn/wkpQ2ZiWN+cSTCYAXxz6otiD/RB4JFndjqYMrb9ZYVFcoPL30Q== 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 4Z0lNW5mfXzXbw; Sun, 23 Feb 2025 00:38:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51N0cpmu014415; Sun, 23 Feb 2025 00:38:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51N0cpIt014412; Sun, 23 Feb 2025 00:38:51 GMT (envelope-from git) Date: Sun, 23 Feb 2025 00:38:51 GMT Message-Id: <202502230038.51N0cpIt014412@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: 11450726d3cf - main - LinuxKPI: 802.11: improve cfg80211_chandef_create() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: 11450726d3cf8d76d2113d7cabe995f8ef31ec5a Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=11450726d3cf8d76d2113d7cabe995f8ef31ec5a commit 11450726d3cf8d76d2113d7cabe995f8ef31ec5a Author: Bjoern A. Zeeb AuthorDate: 2024-12-30 06:35:03 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-02-22 22:18:51 +0000 LinuxKPI: 802.11: improve cfg80211_chandef_create() Implement cfg80211_chandef_create() to work with HT. Update enum with HT channel types. When calling the function from LinuxKPI 802.11 code, pass in NL80211_CHAN_HT20 if HT is supported rather than NO_HT. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/include/linux/nl80211.h | 6 ++-- sys/compat/linuxkpi/common/include/net/cfg80211.h | 35 ++++++++++------------ sys/compat/linuxkpi/common/src/linux_80211.c | 4 +-- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/nl80211.h b/sys/compat/linuxkpi/common/include/linux/nl80211.h index 80546e56f0c1..b2a33a28b3a7 100644 --- a/sys/compat/linuxkpi/common/include/linux/nl80211.h +++ b/sys/compat/linuxkpi/common/include/linux/nl80211.h @@ -135,9 +135,11 @@ enum nl80211_band { NUM_NL80211_BANDS } __packed; -enum nl80211_chan_flags { - /* XXX TODO */ +enum nl80211_channel_type { NL80211_CHAN_NO_HT, + NL80211_CHAN_HT20, + NL80211_CHAN_HT40PLUS, + NL80211_CHAN_HT40MINUS, }; enum nl80211_chan_width { diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h index 338ffb82bd83..4ae31b257ae0 100644 --- a/sys/compat/linuxkpi/common/include/net/cfg80211.h +++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h @@ -1483,36 +1483,33 @@ cfg80211_pmsr_report(struct wireless_dev *wdev, TODO(); } -static __inline void +static inline void cfg80211_chandef_create(struct cfg80211_chan_def *chandef, - struct linuxkpi_ieee80211_channel *chan, enum nl80211_chan_flags chan_flag) + struct linuxkpi_ieee80211_channel *chan, enum nl80211_channel_type chan_type) { KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__)); KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__)); - memset(chandef, 0, sizeof(*chandef)); + /* memset(chandef, 0, sizeof(*chandef)); */ chandef->chan = chan; - chandef->center_freq2 = 0; /* Set here and only overwrite if needed. */ + chandef->center_freq1 = chan->center_freq; + /* chandef->width, center_freq2, punctured */ - switch (chan_flag) { + switch (chan_type) { case NL80211_CHAN_NO_HT: chandef->width = NL80211_CHAN_WIDTH_20_NOHT; - chandef->center_freq1 = chan->center_freq; break; - default: - IMPROVE("Also depends on our manual settings"); - if (chan->flags & IEEE80211_CHAN_NO_HT40) - chandef->width = NL80211_CHAN_WIDTH_20; - else if (chan->flags & IEEE80211_CHAN_NO_80MHZ) - chandef->width = NL80211_CHAN_WIDTH_40; - else if (chan->flags & IEEE80211_CHAN_NO_160MHZ) - chandef->width = NL80211_CHAN_WIDTH_80; - else { - chandef->width = NL80211_CHAN_WIDTH_160; - IMPROVE("80P80 and 320 ..."); - } - chandef->center_freq1 = chan->center_freq; + case NL80211_CHAN_HT20: + chandef->width = NL80211_CHAN_WIDTH_20; + break; + case NL80211_CHAN_HT40MINUS: + chandef->width = NL80211_CHAN_WIDTH_40; + chandef->center_freq1 -= 10; + break; + case NL80211_CHAN_HT40PLUS: + chandef->width = NL80211_CHAN_WIDTH_40; + chandef->center_freq1 += 10; break; }; } diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 729eb2dcd570..92f308fe9228 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -4118,7 +4118,7 @@ lkpi_ic_set_channel(struct ieee80211com *ic) hw = LHW_TO_HW(lhw); cfg80211_chandef_create(&hw->conf.chandef, chan, #ifdef LKPI_80211_HT - (ic->ic_htcaps & IEEE80211_HTC_HT) ? 0 : + (ic->ic_flags_ht & IEEE80211_FHT_HT) ? NL80211_CHAN_HT20 : #endif NL80211_CHAN_NO_HT); @@ -5589,7 +5589,7 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw) cfg80211_chandef_create(&hw->conf.chandef, &channels[i], #ifdef LKPI_80211_HT - (ic->ic_htcaps & IEEE80211_HTC_HT) ? 0 : + (ic->ic_flags_ht & IEEE80211_FHT_HT) ? NL80211_CHAN_HT20 : #endif NL80211_CHAN_NO_HT); break;