diff options
| author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2026-06-22 00:27:21 +0000 |
|---|---|---|
| committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2026-06-22 01:21:38 +0000 |
| commit | 7bf2eec68a293a22f332fc1592dffaa4ed9f0809 (patch) | |
| tree | 44dd9e0df336a879714761e89cdbbe4b2aedcb54 /sys/compat | |
| parent | b58d8df5829233ced7024c30a0a979e2e0a722fd (diff) | |
Diffstat (limited to 'sys/compat')
| -rw-r--r-- | sys/compat/linuxkpi/common/src/linux_80211.c | 45 | ||||
| -rw-r--r-- | sys/compat/linuxkpi/common/src/linux_80211.h | 1 |
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 *, |
