From nobody Wed Feb 26 15:03:08 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 4Z2yQP0D4dz5qGFr; Wed, 26 Feb 2025 15:03:09 +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 4Z2yQN6gHgz3GF1; Wed, 26 Feb 2025 15:03:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740582189; 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=BPAYYwuKKyXMriAtBXCz0LpKr19wPEuRLyxiHCmVQG0=; b=oOitmwDr5ieJoU2VzCpZpyJSi3MmCpkQG55HlHflaVnHljwkY+KmGvA5nccna2MHYnr6U4 jR4glK4XC/G2hzxKL8XGOXLtu5wLhY2yvJPUA1tSfljUYLkMozmbVRa6jiw+zV571OIqDT ctSCCLtxJNP2BE0VcxL7IxNm4/i6ajxdVZ/hPfhLcJMARkNcshseihk8iDrNx0Dcrtk0zZ w+Y/CndJghKbLxUQoYzcurFIC0X70lRbPdU15opOx7qL09lJyg8n11D6ntVAWi/tMVT8AO INbFrh5af/GRdc6bK8AxRHEyNtLPyW0iQHdYZkiMasURF23PHbS9VNmmGnlFiQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740582189; a=rsa-sha256; cv=none; b=TuqmVAJI2pegr7Uu+kUtN8oPpWZ/qkyc6meFwWxJDcIYmCuvro8KONjODfxWHRdm8QRQzB MqDzpGPcwPqR1IO8bBxFC6xcjTdfdrvn6vbSVvhE+WTF/Yu4Oj1fCxd60Fn6arqCUEY87s 87ZmVItLkBsrj747QLKKqarxFAjRzn3R3JHsLzzYsiA2y1AE4Btoxm4ZbHsnQhTl1BBTZU b3OnvQVuYPP0SkXM2UbdW4K8JJtewluwBCsLY57PSf4sc45tbscqNZlhWIHrRgc8Rs04ZN ikhJhyvsgKoZjIH9Zj9XoAt7riydaYS/LUSJgfy6kcu/ZqYxpfG8QByKI9R+8Q== 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=1740582189; 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=BPAYYwuKKyXMriAtBXCz0LpKr19wPEuRLyxiHCmVQG0=; b=ul0OiWbct6L+Z32EaCrUrfBBewuNJQdq9WviL8NdvkjE13jJx13ZW1LAJytix24ne1laf9 0ORc+e3+7lieI/U4rEJIX9svRVZRSmjw53TIFh3DH2SeNapdW5wBgM9zDlm6ZuPVPvX91r i8e0WsOItID33T/bog6jPgbWeIIOdTGgCy7AEY8Lm9yJcU9AHJ3iPlOzc06//8t1EzWUAt ivlEarp3PZvoDsahsPw7+PxmK3t9Dm//wdxb+n0aD+jrndnJIxA4GPsoOGxuychjzz0ee8 JcK9csBIPyYwYg58+iqsQk5SDTfRzRnn6Upb5BJDZ8DSJNx+ritf3PCLIDDMFA== 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 4Z2yQN6Gmlz1GnG; Wed, 26 Feb 2025 15:03:08 +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 51QF38rD014452; Wed, 26 Feb 2025 15:03:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51QF38Ir014449; Wed, 26 Feb 2025 15:03:08 GMT (envelope-from git) Date: Wed, 26 Feb 2025 15:03:08 GMT Message-Id: <202502261503.51QF38Ir014449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: c1895bd9c035 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: c1895bd9c035a1c4af8e44ce2505dc2e00478083 Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c1895bd9c035a1c4af8e44ce2505dc2e00478083 commit c1895bd9c035a1c4af8e44ce2505dc2e00478083 Author: Bjoern A. Zeeb AuthorDate: 2024-12-30 06:35:03 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-02-26 02:39:13 +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 (cherry picked from commit 11450726d3cf8d76d2113d7cabe995f8ef31ec5a) --- 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 0574d4a502de..cc6b72dbea59 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;