diff options
author | Johannes Berg <johannes.berg@intel.com> | 2024-01-29 20:19:28 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2024-02-08 15:00:43 +0100 |
commit | 6239da18d2f947523a80fb1f85f8d8a13d1726c1 (patch) | |
tree | e94f1aa93b07d0e852bfea1bab18f0ca0dd95a46 /net/mac80211/mlme.c | |
parent | 90233160d761e4ea56c7ac30e36fdaec73b3bdc4 (diff) |
wifi: mac80211: adjust EHT capa when lowering bandwidth
If intending to associate with a lower bandwidth, remove capabilities
related to 320 MHz from the EHT capabilities element. Also change the
EHT MCS-NSS set accordingly: if just reducing 320->160 or similar the
format doesn't change, just cut off the last bytes. If changing from
higher bandwidth to 20 MHz only EHT STA, adjust the format.
Note that this also requires adjusting the caller in mlme.c since the
data written can now be shorter than it determined. We need to clean
all that up. Since the other callers pass NULL for the conn limit, we
don't need to change things there.
Link: https://msgid.link/20240129202041.b5f6df108c77.I0d8ea04079c61cb3744cc88625eeaf0d4776dc2b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r-- | net/mac80211/mlme.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 9a0331d914d3..bbc7894ccad0 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -1072,9 +1072,10 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata, static void ieee80211_add_eht_ie(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, - struct ieee80211_supported_band *sband) + struct ieee80211_supported_band *sband, + const struct ieee80211_conn_settings *conn) { - u8 *pos; + u8 *pos, *pre_eht_pos; const struct ieee80211_sta_he_cap *he_cap; const struct ieee80211_sta_eht_cap *eht_cap; u8 eht_cap_size; @@ -1097,8 +1098,11 @@ static void ieee80211_add_eht_ie(struct ieee80211_sub_if_data *sdata, ieee80211_eht_ppe_size(eht_cap->eht_ppe_thres[0], eht_cap->eht_cap_elem.phy_cap_info); pos = skb_put(skb, eht_cap_size); - ieee80211_ie_build_eht_cap(pos, he_cap, eht_cap, pos + eht_cap_size, - false); + pre_eht_pos = pos; + pos = ieee80211_ie_build_eht_cap(conn, pos, he_cap, eht_cap, + pos + eht_cap_size, false); + /* trim excess if any */ + skb_trim(skb, skb->len - (pre_eht_pos + eht_cap_size - pos)); } static void ieee80211_assoc_add_rates(struct sk_buff *skb, @@ -1453,7 +1457,8 @@ static size_t ieee80211_assoc_link_elems(struct ieee80211_sub_if_data *sdata, present_elems = NULL; if (assoc_data->link[link_id].conn.mode >= IEEE80211_CONN_MODE_EHT) - ieee80211_add_eht_ie(sdata, skb, sband); + ieee80211_add_eht_ie(sdata, skb, sband, + &assoc_data->link[link_id].conn); if (sband->band == NL80211_BAND_S1GHZ) { ieee80211_add_aid_request_ie(sdata, skb); |