aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2026-06-22 00:27:21 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2026-06-22 01:21:38 +0000
commit7bf2eec68a293a22f332fc1592dffaa4ed9f0809 (patch)
tree44dd9e0df336a879714761e89cdbbe4b2aedcb54
parentb58d8df5829233ced7024c30a0a979e2e0a722fd (diff)
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 MFC after: 3 days
-rw-r--r--sys/compat/linuxkpi/common/src/linux_80211.c45
-rw-r--r--sys/compat/linuxkpi/common/src/linux_80211.h1
2 files changed, 45 insertions, 1 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 95385474840a..f41ad9f573b6 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -4087,6 +4087,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;
@@ -4109,8 +4110,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 *,