From nobody Tue Jan 20 15:44:44 2026 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 4dwWq02rNpz6PjWj for ; Tue, 20 Jan 2026 15:44:44 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dwWq02Hs7z3CC4 for ; Tue, 20 Jan 2026 15:44:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768923884; 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=VobHibdT+15pBpqyFlffigdEfIwhXLCB33n0f8NyKRU=; b=O1JL/vJ0hYcDU2oUKD4X2twdTElzMGm5StgleekesezLZWN3fg2GI7cNex6XWoD/3yQWRI U5OJdkXthtWWPyv6sCnPFfvta1rtYIulRFYrVx2IXu8eB3hXEaBFDMgg4IYoeC/StfzXDX l7+NRoDJ4jMIBcBSTFcfS7aUbZkPLC+Y3dN/8dg3rlSY+mInh9zen6oynzHxhZ4blzkHkv mpuCUDd5Vt1EHwMDs8a9BLHz8nRo2hdpenuveC8aqeTiCiAYjY230AQ1m7pnBEksiVdwPA dx50XfDW3Hlf/gHd0J0FVi40cL/6jX4uJHfvXPYnkplwXTt4O/zNySveE6Uk9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768923884; 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=VobHibdT+15pBpqyFlffigdEfIwhXLCB33n0f8NyKRU=; b=uYoH5pO4GC5wxay2OZRu7WMgy+XE61s1IqE2UDm67CGbfaZQGVaprKhuj27kx7Za+oYqYp S5NFWHaA1d7/isl9BicjUA+I4uoxV47EL20H238u+1SWlr7eNwJrCvsST/dyk7UljVy2Is 5QQJMQhRZkSEv0FUxWtlXmAod4PHiVY7vu2Zo0202hIrAXmvgVnXE1rJEQ3qiBQH94tJt1 QHfGTSzJlggVRlSs9inV4n83oIPio7WTLR+jD30AC8GCUdu1AlRnWbF/3fEHcJx9YJjnz/ JfdZ5sipeNuJGR5kWbW5+JFnI4pIRjERthkfgM7lfxnv9Ke9cAl8HuRiXu1UWw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768923884; a=rsa-sha256; cv=none; b=C26fLZ3Oodt0bxNFLT+4aIBtaIUamUZyShC0Ff+4prIZ0FKiDDWJrpYg+hbWqe42o9xeg8 ClAiTftGhV3d3JNkpUMUjyiiP1fPxxZSdo64z9vbkUSaODDXfyZnlzqyppk+vF6QbdVl3b rgcBMXdSe9j4GYcJQXVWZoFqYxa1iHFALbBrdx45s0ZkGyHRStxTq7vi4W701ISpH7Gte/ AiZos9V+gWJzFNWYJmDfprvORhsDKuwo/Z4SNA+3D2VQUBPc8PN+wRVdFhkqrYwbuCiYtQ /OrCTouLBzY4APMkV5R37EFPb1bV9UyW5A9bPdWLd9+Hk3QFu58j+S7cS2cNxA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dwWq01vLBz1Mff for ; Tue, 20 Jan 2026 15:44:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25bc2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 20 Jan 2026 15:44:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 768332d61948 - main - LinuxKPI: 802.11: factor out rate logic for mandatory channels 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-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: 768332d619484834a7866fde4bf2695d4262355a Auto-Submitted: auto-generated Date: Tue, 20 Jan 2026 15:44:44 +0000 Message-Id: <696fa2ec.25bc2.5df41946@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=768332d619484834a7866fde4bf2695d4262355a commit 768332d619484834a7866fde4bf2695d4262355a Author: Bjoern A. Zeeb AuthorDate: 2026-01-20 13:33:16 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-01-20 15:44:30 +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 MFC after: 3 days --- .../linuxkpi/common/include/linux/ieee80211.h | 13 ++- sys/compat/linuxkpi/common/include/net/cfg80211.h | 4 +- sys/compat/linuxkpi/common/src/linux_80211.c | 110 ++++++++++++++++----- 3 files changed, 100 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..7972d9d0f667 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,75 @@ 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: + IMPROVE("band %d(%s) not yet supported", + band, lkpi_nl80211_band_name(band)); + /* For bands added here, also check lkpi_lsta_alloc(). */ + 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) {