.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * HT handling |
---|
3 | 4 | * |
---|
.. | .. |
---|
8 | 9 | * Copyright 2007, Michael Wu <flamingice@sourmilk.net> |
---|
9 | 10 | * Copyright 2007-2010, Intel Corporation |
---|
10 | 11 | * Copyright(c) 2015-2017 Intel Deutschland GmbH |
---|
11 | | - * Copyright (C) 2018 Intel Corporation |
---|
12 | | - * |
---|
13 | | - * This program is free software; you can redistribute it and/or modify |
---|
14 | | - * it under the terms of the GNU General Public License version 2 as |
---|
15 | | - * published by the Free Software Foundation. |
---|
| 12 | + * Copyright (C) 2018-2021 Intel Corporation |
---|
16 | 13 | */ |
---|
17 | 14 | |
---|
18 | 15 | /** |
---|
.. | .. |
---|
181 | 178 | rcu_read_unlock(); |
---|
182 | 179 | } |
---|
183 | 180 | |
---|
184 | | -static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *da, u16 tid, |
---|
185 | | - u8 dialog_token, u16 status, u16 policy, |
---|
186 | | - u16 buf_size, u16 timeout) |
---|
| 181 | +static void ieee80211_add_addbaext(struct ieee80211_sub_if_data *sdata, |
---|
| 182 | + struct sk_buff *skb, |
---|
| 183 | + const struct ieee80211_addba_ext_ie *req) |
---|
187 | 184 | { |
---|
| 185 | + struct ieee80211_supported_band *sband; |
---|
| 186 | + struct ieee80211_addba_ext_ie *resp; |
---|
| 187 | + const struct ieee80211_sta_he_cap *he_cap; |
---|
| 188 | + u8 frag_level, cap_frag_level; |
---|
| 189 | + u8 *pos; |
---|
| 190 | + |
---|
| 191 | + sband = ieee80211_get_sband(sdata); |
---|
| 192 | + if (!sband) |
---|
| 193 | + return; |
---|
| 194 | + he_cap = ieee80211_get_he_iftype_cap(sband, |
---|
| 195 | + ieee80211_vif_type_p2p(&sdata->vif)); |
---|
| 196 | + if (!he_cap) |
---|
| 197 | + return; |
---|
| 198 | + |
---|
| 199 | + pos = skb_put_zero(skb, 2 + sizeof(struct ieee80211_addba_ext_ie)); |
---|
| 200 | + *pos++ = WLAN_EID_ADDBA_EXT; |
---|
| 201 | + *pos++ = sizeof(struct ieee80211_addba_ext_ie); |
---|
| 202 | + resp = (struct ieee80211_addba_ext_ie *)pos; |
---|
| 203 | + resp->data = req->data & IEEE80211_ADDBA_EXT_NO_FRAG; |
---|
| 204 | + |
---|
| 205 | + frag_level = u32_get_bits(req->data, |
---|
| 206 | + IEEE80211_ADDBA_EXT_FRAG_LEVEL_MASK); |
---|
| 207 | + cap_frag_level = u32_get_bits(he_cap->he_cap_elem.mac_cap_info[0], |
---|
| 208 | + IEEE80211_HE_MAC_CAP0_DYNAMIC_FRAG_MASK); |
---|
| 209 | + if (frag_level > cap_frag_level) |
---|
| 210 | + frag_level = cap_frag_level; |
---|
| 211 | + resp->data |= u8_encode_bits(frag_level, |
---|
| 212 | + IEEE80211_ADDBA_EXT_FRAG_LEVEL_MASK); |
---|
| 213 | +} |
---|
| 214 | + |
---|
| 215 | +static void ieee80211_send_addba_resp(struct sta_info *sta, u8 *da, u16 tid, |
---|
| 216 | + u8 dialog_token, u16 status, u16 policy, |
---|
| 217 | + u16 buf_size, u16 timeout, |
---|
| 218 | + const struct ieee80211_addba_ext_ie *addbaext) |
---|
| 219 | +{ |
---|
| 220 | + struct ieee80211_sub_if_data *sdata = sta->sdata; |
---|
188 | 221 | struct ieee80211_local *local = sdata->local; |
---|
189 | 222 | struct sk_buff *skb; |
---|
190 | 223 | struct ieee80211_mgmt *mgmt; |
---|
191 | 224 | bool amsdu = ieee80211_hw_check(&local->hw, SUPPORTS_AMSDU_IN_AMPDU); |
---|
192 | 225 | u16 capab; |
---|
193 | 226 | |
---|
194 | | - skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom); |
---|
| 227 | + skb = dev_alloc_skb(sizeof(*mgmt) + |
---|
| 228 | + 2 + sizeof(struct ieee80211_addba_ext_ie) + |
---|
| 229 | + local->hw.extra_tx_headroom); |
---|
195 | 230 | if (!skb) |
---|
196 | 231 | return; |
---|
197 | 232 | |
---|
.. | .. |
---|
225 | 260 | mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout); |
---|
226 | 261 | mgmt->u.action.u.addba_resp.status = cpu_to_le16(status); |
---|
227 | 262 | |
---|
| 263 | + if (sta->sta.he_cap.has_he && addbaext) |
---|
| 264 | + ieee80211_add_addbaext(sdata, skb, addbaext); |
---|
| 265 | + |
---|
228 | 266 | ieee80211_tx_skb(sdata, skb); |
---|
229 | 267 | } |
---|
230 | 268 | |
---|
231 | 269 | void ___ieee80211_start_rx_ba_session(struct sta_info *sta, |
---|
232 | 270 | u8 dialog_token, u16 timeout, |
---|
233 | 271 | u16 start_seq_num, u16 ba_policy, u16 tid, |
---|
234 | | - u16 buf_size, bool tx, bool auto_seq) |
---|
| 272 | + u16 buf_size, bool tx, bool auto_seq, |
---|
| 273 | + const struct ieee80211_addba_ext_ie *addbaext) |
---|
235 | 274 | { |
---|
236 | 275 | struct ieee80211_local *local = sta->sdata->local; |
---|
237 | 276 | struct tid_ampdu_rx *tid_agg_rx; |
---|
.. | .. |
---|
254 | 293 | goto end; |
---|
255 | 294 | } |
---|
256 | 295 | |
---|
257 | | - if (!sta->sta.ht_cap.ht_supported) { |
---|
| 296 | + if (!sta->sta.ht_cap.ht_supported && |
---|
| 297 | + sta->sdata->vif.bss_conf.chandef.chan->band != NL80211_BAND_6GHZ) { |
---|
258 | 298 | ht_dbg(sta->sdata, |
---|
259 | 299 | "STA %pM erroneously requests BA session on tid %d w/o QoS\n", |
---|
260 | 300 | sta->sta.addr, tid); |
---|
.. | .. |
---|
311 | 351 | sta->sta.addr, tid); |
---|
312 | 352 | /* We have no API to update the timeout value in the |
---|
313 | 353 | * driver so reject the timeout update if the timeout |
---|
314 | | - * changed. If if did not change, i.e., no real update, |
---|
| 354 | + * changed. If it did not change, i.e., no real update, |
---|
315 | 355 | * just reply with success. |
---|
316 | 356 | */ |
---|
317 | 357 | rcu_read_lock(); |
---|
.. | .. |
---|
413 | 453 | } |
---|
414 | 454 | |
---|
415 | 455 | if (tx) |
---|
416 | | - ieee80211_send_addba_resp(sta->sdata, sta->sta.addr, tid, |
---|
| 456 | + ieee80211_send_addba_resp(sta, sta->sta.addr, tid, |
---|
417 | 457 | dialog_token, status, 1, buf_size, |
---|
418 | | - timeout); |
---|
| 458 | + timeout, addbaext); |
---|
419 | 459 | } |
---|
420 | 460 | |
---|
421 | 461 | static void __ieee80211_start_rx_ba_session(struct sta_info *sta, |
---|
422 | 462 | u8 dialog_token, u16 timeout, |
---|
423 | 463 | u16 start_seq_num, u16 ba_policy, |
---|
424 | 464 | u16 tid, u16 buf_size, bool tx, |
---|
425 | | - bool auto_seq) |
---|
| 465 | + bool auto_seq, |
---|
| 466 | + const struct ieee80211_addba_ext_ie *addbaext) |
---|
426 | 467 | { |
---|
427 | 468 | mutex_lock(&sta->ampdu_mlme.mtx); |
---|
428 | 469 | ___ieee80211_start_rx_ba_session(sta, dialog_token, timeout, |
---|
429 | 470 | start_seq_num, ba_policy, tid, |
---|
430 | | - buf_size, tx, auto_seq); |
---|
| 471 | + buf_size, tx, auto_seq, addbaext); |
---|
431 | 472 | mutex_unlock(&sta->ampdu_mlme.mtx); |
---|
432 | 473 | } |
---|
433 | 474 | |
---|
.. | .. |
---|
437 | 478 | size_t len) |
---|
438 | 479 | { |
---|
439 | 480 | u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num; |
---|
| 481 | + struct ieee802_11_elems elems = { }; |
---|
440 | 482 | u8 dialog_token; |
---|
| 483 | + int ies_len; |
---|
441 | 484 | |
---|
442 | 485 | /* extract session parameters from addba request frame */ |
---|
443 | 486 | dialog_token = mgmt->u.action.u.addba_req.dialog_token; |
---|
.. | .. |
---|
450 | 493 | tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; |
---|
451 | 494 | buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6; |
---|
452 | 495 | |
---|
| 496 | + ies_len = len - offsetof(struct ieee80211_mgmt, |
---|
| 497 | + u.action.u.addba_req.variable); |
---|
| 498 | + if (ies_len) { |
---|
| 499 | + ieee802_11_parse_elems(mgmt->u.action.u.addba_req.variable, |
---|
| 500 | + ies_len, true, &elems, mgmt->bssid, NULL); |
---|
| 501 | + if (elems.parse_error) |
---|
| 502 | + return; |
---|
| 503 | + } |
---|
| 504 | + |
---|
453 | 505 | __ieee80211_start_rx_ba_session(sta, dialog_token, timeout, |
---|
454 | 506 | start_seq_num, ba_policy, tid, |
---|
455 | | - buf_size, true, false); |
---|
| 507 | + buf_size, true, false, |
---|
| 508 | + elems.addba_ext_ie); |
---|
456 | 509 | } |
---|
457 | 510 | |
---|
458 | 511 | void ieee80211_manage_rx_ba_offl(struct ieee80211_vif *vif, |
---|