From nobody Fri Feb 27 02:29:12 2026 X-Original-To: dev-commits-src-branches@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 4fMXMX3NlFz6T7bZ for ; Fri, 27 Feb 2026 02:29:12 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fMXMX2vkcz40Cy for ; Fri, 27 Feb 2026 02:29:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772159352; 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=3LGfQLLHNbPt22mNpPK8FVFrMTU7tIprVSjvb54oqH8=; b=SeLVO83d9oAPR2piOdNnDhxTlY67X+tBqU0fXIxgBAsW/WAh7PU7lZdd1AFuK3EWhntoB/ jph5gGAFYDt2mN4AUBT0hSpeiJij6aUB/PAvawud5R4AQAIA/WMgcht1fTGB8cj8S6wX9r hnzcFph+nRLfI/9HoSw9iblT2SkkO00XQSDupScLi7+zFDJ9K0nBItfNZVaB0uhKQ+6DAv fDW9917FaTqrWxzxqjpQipbr8wozxgcs1hPxYoT/XWWfWigdN4EpUt95fqqmaP8uTKRddu y/MFIbPRc/TBVS83ll9k0MEUXUhgfnIYEsoNSA0ULGqyeYe0Pu/sQY11U2L0iQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772159352; a=rsa-sha256; cv=none; b=wT2szKZ964yOwpoka7eMa3voiFcmvDZk9OSQ4PhBnGONAbNol1702x8BXaugNaPTy8sbn/ Pk/H4mt6nFLlxWOLSMyM3mkDjeUNy3wV/X0j8FugO700aqgwUK5O8mNq5EGYVXqEdjD/hs ZmQJfNWnP02OBfTVzHvWNOW6QpSofjJ32+/HU+SbjePG05Rx6Z3vNpwLbra+1TWbVNVA63 DBjb/lfNx2AXH19Uad2iVxlW+w9rTFvZqdUsPHbG7CTkHJ4qXd7Dr1YBxWANdkN200m40x 6B8dFHjm4RfRPZifvM2W6v+TQkD+kvSr3Jd0LPVUana+EEuF+yKZ0TSNOh8ecA== 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=1772159352; 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=3LGfQLLHNbPt22mNpPK8FVFrMTU7tIprVSjvb54oqH8=; b=CTt7m33QvnF7/chdS2tGkcYU4v9sZfj+5XBop++/0VbiMeLfKrik/rGh6SfrkM5HWLkuHF XIGlZ6dKALWW1aA9HReNh9CUmwt2jzOUNBwKK9zN4gNvQwsZOV3g2EkM/iXspAJ1AF7YpA Nq8gVsguhQ+bX9brBobNrfBa4b9Sa0QdPFryAS4nnEGqiFBB10HFHcu9s8G0Q9+sPMxOGq HgEyLH08+eDA5E5JNecxyhLOPeQrQRHNq5TQbtY8kIUb7UUqRSURKMTxlcqODYtyXewMF7 WBaTVEYDV/c0cYPLHJhpe9d8Yw6EFSBKTyQWpWnyI+SvENh6hV+CyNQ/C2VyCg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fMXMX2WDszyZK for ; Fri, 27 Feb 2026 02:29:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 21fab by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 27 Feb 2026 02:29:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 07c0695d7420 - stable/15 - LinuxKPI: 802.11: factor out rate logic for mandatory channels List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/15 X-Git-Reftype: branch X-Git-Commit: 07c0695d7420fb6e6a3e394b8eaf0e5a96708a9c Auto-Submitted: auto-generated Date: Fri, 27 Feb 2026 02:29:12 +0000 Message-Id: <69a10178.21fab.1c95adc1@gitrepo.freebsd.org> The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=07c0695d7420fb6e6a3e394b8eaf0e5a96708a9c commit 07c0695d7420fb6e6a3e394b8eaf0e5a96708a9c Author: Bjoern A. Zeeb AuthorDate: 2026-01-20 13:33:16 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-02-26 22:56:57 +0000 LinuxKPI: 802.11: factor out rate logic for mandatory channels I was looking at rate work for another problem and found more flags in ath9k (which we will likely never need). The documentation then revealed the "mandatory" flags as well and with discussions about cfg80211 going on I decided to use the momentum and split our "supp_rates" setup between lkpi_lsta_alloc() and wiphy_register(). There should be no functional change. While there also initialize max_rc_amsdu_len. Sponsored by: The FreeBSD Foundation (cherry picked from commit 768332d619484834a7866fde4bf2695d4262355a) (cherry picked from commit c592d54a24b984f2e23b337a6abeac09b9c357b5) --- .../linuxkpi/common/include/linux/ieee80211.h | 13 ++- sys/compat/linuxkpi/common/include/net/cfg80211.h | 4 +- sys/compat/linuxkpi/common/src/linux_80211.c | 112 ++++++++++++++++----- 3 files changed, 102 insertions(+), 27 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h index 12160df43915..b5051a9f7d21 100644 --- a/sys/compat/linuxkpi/common/include/linux/ieee80211.h +++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h @@ -108,7 +108,18 @@ struct ieee80211_mmie_16 { #define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT 0x0100 enum ieee80211_rate_flags { - IEEE80211_RATE_SHORT_PREAMBLE = BIT(0), + IEEE80211_RATE_SHORT_PREAMBLE = BIT(0), /* 2.4Ghz, CCK */ + IEEE80211_RATE_SUPPORTS_5MHZ = BIT(1), + IEEE80211_RATE_SUPPORTS_10MHZ = BIT(2), + IEEE80211_RATE_ERP_G = BIT(3), + + /* + * According to documentation these are flags initialized internally. + * See lkpi_wiphy_band_annotate(). + */ + IEEE80211_RATE_MANDATORY_A = BIT(4), + IEEE80211_RATE_MANDATORY_G = BIT(5), + IEEE80211_RATE_MANDATORY_B = BIT(6), }; enum ieee80211_rate_control_changed_flags { diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h index d7ed2bc97c98..4b21f82a0762 100644 --- a/sys/compat/linuxkpi/common/include/net/cfg80211.h +++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h @@ -1230,6 +1230,7 @@ struct cfg80211_ops { struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t); void linuxkpi_wiphy_free(struct wiphy *wiphy); +int linuxkpi_80211_wiphy_register(struct wiphy *); void linuxkpi_wiphy_work_queue(struct wiphy *, struct wiphy_work *); void linuxkpi_wiphy_work_cancel(struct wiphy *, struct wiphy_work *); @@ -1749,8 +1750,7 @@ wiphy_net(struct wiphy *wiphy) static __inline int wiphy_register(struct wiphy *wiphy) { - TODO(); - return (0); + return (linuxkpi_80211_wiphy_register(wiphy)); } static __inline void diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 1ac28dfef448..d25b32f1dae8 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -896,41 +896,34 @@ lkpi_lsta_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN], /* Deflink information. */ for (band = 0; band < NUM_NL80211_BANDS; band++) { struct ieee80211_supported_band *supband; + uint32_t rate_mandatory;; supband = hw->wiphy->bands[band]; if (supband == NULL) continue; + switch (band) { + case NL80211_BAND_2GHZ: + /* We have to assume 11g support here. */ + rate_mandatory = IEEE80211_RATE_MANDATORY_G | + IEEE80211_RATE_MANDATORY_B; + break; + case NL80211_BAND_5GHZ: + rate_mandatory = IEEE80211_RATE_MANDATORY_A; + break; + default: + continue; + } + for (i = 0; i < supband->n_bitrates; i++) { - switch (band) { - case NL80211_BAND_2GHZ: - switch (supband->bitrates[i].bitrate) { - case 240: /* 11g only */ - case 120: /* 11g only */ - case 110: - case 60: /* 11g only */ - case 55: - case 20: - case 10: - sta->deflink.supp_rates[band] |= BIT(i); - break; - } - break; - case NL80211_BAND_5GHZ: - switch (supband->bitrates[i].bitrate) { - case 240: - case 120: - case 60: - sta->deflink.supp_rates[band] |= BIT(i); - break; - } - break; - } + if ((supband->bitrates[i].flags & rate_mandatory) != 0) + sta->deflink.supp_rates[band] |= BIT(i); } } sta->deflink.smps_mode = IEEE80211_SMPS_OFF; sta->deflink.bandwidth = IEEE80211_STA_RX_BW_20; + sta->deflink.agg.max_rc_amsdu_len = IEEE80211_MAX_MPDU_LEN_HT_BA; sta->deflink.rx_nss = 1; sta->deflink.sta = sta; @@ -8028,6 +8021,77 @@ linuxkpi_wiphy_free(struct wiphy *wiphy) kfree(lwiphy); } +static void +lkpi_wiphy_band_annotate(struct wiphy *wiphy) +{ + int band; + + for (band = 0; band < NUM_NL80211_BANDS; band++) { + struct ieee80211_supported_band *supband; + int i; + + supband = wiphy->bands[band]; + if (supband == NULL) + continue; + + switch (band) { + case NL80211_BAND_2GHZ: + case NL80211_BAND_5GHZ: + break; + default: +#ifdef LINUXKPI_DEBUG_80211 + IMPROVE("band %d(%s) not yet supported", + band, lkpi_nl80211_band_name(band)); + /* For bands added here, also check lkpi_lsta_alloc(). */ +#endif + continue; + } + + for (i = 0; i < supband->n_bitrates; i++) { + switch (band) { + case NL80211_BAND_2GHZ: + switch (supband->bitrates[i].bitrate) { + case 110: + case 55: + case 20: + case 10: + supband->bitrates[i].flags |= + IEEE80211_RATE_MANDATORY_B; + /* FALLTHROUGH */ + /* 11g only */ + case 240: + case 120: + case 60: + supband->bitrates[i].flags |= + IEEE80211_RATE_MANDATORY_G; + break; + } + break; + case NL80211_BAND_5GHZ: + switch (supband->bitrates[i].bitrate) { + case 240: + case 120: + case 60: + supband->bitrates[i].flags |= + IEEE80211_RATE_MANDATORY_A; + break; + } + break; + } + } + } +} + +int +linuxkpi_80211_wiphy_register(struct wiphy *wiphy) +{ + TODO("Lots of checks and initialization"); + + lkpi_wiphy_band_annotate(wiphy); + + return (0); +} + static uint32_t lkpi_cfg80211_calculate_bitrate_ht(struct rate_info *rate) {