git: c17a6e0f8787 - stable/15 - LinuxKPI: 802.11: initalize br_mask and basic_rates for each vap
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Jun 2026 06:34:39 UTC
The branch stable/15 has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=c17a6e0f87871885cb698451ff1f1b0864da3cc9
commit c17a6e0f87871885cb698451ff1f1b0864da3cc9
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-06-22 00:27:21 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-06-29 03:54:41 +0000
LinuxKPI: 802.11: initalize br_mask and basic_rates for each vap
During vap creating we inialize most [l]vif related variables.
Add a br_mask (bit rate mask) to the lvif and setup the legacy component
as it seems to be static.
Given we are looping over the bands, also initialize the bss_conf
basic_rates. At this point we only have all bitrates for the band
or the mandatory bitrates for the band available. In order to not
hint usage of possibly unsupported bit rates set it up with the
manadatory bit rates only, which should get us through the mgmt
frames, etc. to get to assoc state. By then we will do updates.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 7bf2eec68a293a22f332fc1592dffaa4ed9f0809)
---
sys/compat/linuxkpi/common/src/linux_80211.c | 45 +++++++++++++++++++++++++++-
sys/compat/linuxkpi/common/src/linux_80211.h | 1 +
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 24819a970431..8a761be3d6fd 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -4081,6 +4081,7 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
struct ieee80211_vif *vif;
struct ieee80211_tx_queue_params txqp;
enum ieee80211_bss_changed bss_changed;
+ enum nl80211_band band;
struct sysctl_oid *node;
size_t len;
int error, i;
@@ -4103,8 +4104,50 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ],
refcount_init(&lvif->nt_unlocked, 0);
lvif->lvif_bss_synched = false;
vap = LVIF_TO_VAP(lvif);
-
vif = LVIF_TO_VIF(lvif);
+
+ /*
+ * Setup legacy br_mask here. We will call (*set_bitrate_mask)
+ * elsewhere to announce it to the driver but it is a static
+ * setup.
+ * Also setup basic_rates with just the mandatory rates for the
+ * current band (if avail).
+ */
+ 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 || supband->n_bitrates == 0)
+ continue;
+
+ /* Per-band legacy br_mask. */
+ lvif->br_mask.control[band].legacy = (1 << supband->n_bitrates) - 1;
+
+ /* basic_rates for the current band. */
+ if (hw->conf.chandef.chan == NULL ||
+ hw->conf.chandef.chan->band != band)
+ 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++) {
+ if ((supband->bitrates[i].flags & rate_mandatory) != 0)
+ vif->bss_conf.basic_rates |= BIT(i);
+ }
+ }
+
memcpy(vif->addr, mac, IEEE80211_ADDR_LEN);
vif->p2p = false;
vif->probe_req_reg = false;
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h
index 91751c0b4de5..8d6b0a23cad3 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.h
+++ b/sys/compat/linuxkpi/common/src/linux_80211.h
@@ -220,6 +220,7 @@ struct lkpi_vif {
struct mtx mtx;
struct wireless_dev wdev;
+ struct cfg80211_bitrate_mask br_mask;
/* Other local stuff. */
int (*iv_newstate)(struct ieee80211vap *,