Lines Matching +full:local +full:- +full:cap +full:- +full:size

1 // SPDX-License-Identifier: GPL-2.0-only
6 * Copyright 2002-2005, Instant802 Networks, Inc.
7 * Copyright 2005-2006, Devicescape Software, Inc.
8 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
10 * Copyright 2007-2010, Intel Corporation
11 * Copyright(c) 2015-2017 Intel Deutschland GmbH
12 * Copyright (C) 2018-2020 Intel Corporation
16 * DOC: RX A-MPDU aggregation
20 * block-ack sessions for RX aggregation.
29 * to de-aggregate frames and pass them up one by one to mac80211,
43 #include "driver-ops.h"
51 for (i = 0; i < tid_rx->buf_size; i++) in ieee80211_free_tid_rx()
52 __skb_queue_purge(&tid_rx->reorder_buf[i]); in ieee80211_free_tid_rx()
53 kfree(tid_rx->reorder_buf); in ieee80211_free_tid_rx()
54 kfree(tid_rx->reorder_time); in ieee80211_free_tid_rx()
61 struct ieee80211_local *local = sta->local; in ___ieee80211_stop_rx_ba_session() local
64 .sta = &sta->sta, in ___ieee80211_stop_rx_ba_session()
72 lockdep_assert_held(&sta->ampdu_mlme.mtx); in ___ieee80211_stop_rx_ba_session()
74 tid_rx = rcu_dereference_protected(sta->ampdu_mlme.tid_rx[tid], in ___ieee80211_stop_rx_ba_session()
75 lockdep_is_held(&sta->ampdu_mlme.mtx)); in ___ieee80211_stop_rx_ba_session()
77 if (!test_bit(tid, sta->ampdu_mlme.agg_session_valid)) in ___ieee80211_stop_rx_ba_session()
80 RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL); in ___ieee80211_stop_rx_ba_session()
81 __clear_bit(tid, sta->ampdu_mlme.agg_session_valid); in ___ieee80211_stop_rx_ba_session()
83 ht_dbg(sta->sdata, in ___ieee80211_stop_rx_ba_session()
85 sta->sta.addr, tid, in ___ieee80211_stop_rx_ba_session()
89 if (drv_ampdu_action(local, sta->sdata, &params)) in ___ieee80211_stop_rx_ba_session()
90 sdata_info(sta->sdata, in ___ieee80211_stop_rx_ba_session()
91 "HW problem - can not stop rx aggregation for %pM tid %d\n", in ___ieee80211_stop_rx_ba_session()
92 sta->sta.addr, tid); in ___ieee80211_stop_rx_ba_session()
96 ieee80211_send_delba(sta->sdata, sta->sta.addr, in ___ieee80211_stop_rx_ba_session()
100 * return here in case tid_rx is not assigned - which will happen if in ___ieee80211_stop_rx_ba_session()
106 del_timer_sync(&tid_rx->session_timer); in ___ieee80211_stop_rx_ba_session()
108 /* make sure ieee80211_sta_reorder_release() doesn't re-arm the timer */ in ___ieee80211_stop_rx_ba_session()
109 spin_lock_bh(&tid_rx->reorder_lock); in ___ieee80211_stop_rx_ba_session()
110 tid_rx->removed = true; in ___ieee80211_stop_rx_ba_session()
111 spin_unlock_bh(&tid_rx->reorder_lock); in ___ieee80211_stop_rx_ba_session()
112 del_timer_sync(&tid_rx->reorder_timer); in ___ieee80211_stop_rx_ba_session()
114 call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx); in ___ieee80211_stop_rx_ba_session()
120 mutex_lock(&sta->ampdu_mlme.mtx); in __ieee80211_stop_rx_ba_session()
122 mutex_unlock(&sta->ampdu_mlme.mtx); in __ieee80211_stop_rx_ba_session()
141 set_bit(i, sta->ampdu_mlme.tid_rx_stop_requested); in ieee80211_stop_rx_ba_session()
143 ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work); in ieee80211_stop_rx_ba_session()
155 struct sta_info *sta = tid_rx->sta; in sta_rx_agg_session_timer_expired()
156 u8 tid = tid_rx->tid; in sta_rx_agg_session_timer_expired()
159 timeout = tid_rx->last_rx + TU_TO_JIFFIES(tid_rx->timeout); in sta_rx_agg_session_timer_expired()
161 mod_timer(&tid_rx->session_timer, timeout); in sta_rx_agg_session_timer_expired()
165 ht_dbg(sta->sdata, "RX session timer expired on %pM tid %d\n", in sta_rx_agg_session_timer_expired()
166 sta->sta.addr, tid); in sta_rx_agg_session_timer_expired()
168 set_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired); in sta_rx_agg_session_timer_expired()
169 ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work); in sta_rx_agg_session_timer_expired()
177 ieee80211_release_reorder_timeout(tid_rx->sta, tid_rx->tid); in sta_rx_agg_reorder_timer_expired()
194 he_cap = ieee80211_get_he_iftype_cap(sband, sdata->vif.type); in ieee80211_add_addbaext()
202 resp->data = req->data & IEEE80211_ADDBA_EXT_NO_FRAG; in ieee80211_add_addbaext()
204 frag_level = u32_get_bits(req->data, in ieee80211_add_addbaext()
206 cap_frag_level = u32_get_bits(he_cap->he_cap_elem.mac_cap_info[0], in ieee80211_add_addbaext()
210 resp->data |= u8_encode_bits(frag_level, in ieee80211_add_addbaext()
219 struct ieee80211_sub_if_data *sdata = sta->sdata; in ieee80211_send_addba_resp()
220 struct ieee80211_local *local = sdata->local; in ieee80211_send_addba_resp() local
223 bool amsdu = ieee80211_hw_check(&local->hw, SUPPORTS_AMSDU_IN_AMPDU); in ieee80211_send_addba_resp()
228 local->hw.extra_tx_headroom); in ieee80211_send_addba_resp()
232 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_addba_resp()
234 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_addba_resp()
235 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_addba_resp()
236 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_send_addba_resp()
237 sdata->vif.type == NL80211_IFTYPE_AP_VLAN || in ieee80211_send_addba_resp()
238 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) in ieee80211_send_addba_resp()
239 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); in ieee80211_send_addba_resp()
240 else if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_send_addba_resp()
241 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); in ieee80211_send_addba_resp()
242 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) in ieee80211_send_addba_resp()
243 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); in ieee80211_send_addba_resp()
245 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_addba_resp()
248 skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp)); in ieee80211_send_addba_resp()
249 mgmt->u.action.category = WLAN_CATEGORY_BACK; in ieee80211_send_addba_resp()
250 mgmt->u.action.u.addba_resp.action_code = WLAN_ACTION_ADDBA_RESP; in ieee80211_send_addba_resp()
251 mgmt->u.action.u.addba_resp.dialog_token = dialog_token; in ieee80211_send_addba_resp()
253 capab = (u16)(amsdu << 0); /* bit 0 A-MSDU support */ in ieee80211_send_addba_resp()
256 capab |= (u16)(buf_size << 6); /* bit 15:6 max size of aggregation */ in ieee80211_send_addba_resp()
258 mgmt->u.action.u.addba_resp.capab = cpu_to_le16(capab); in ieee80211_send_addba_resp()
259 mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout); in ieee80211_send_addba_resp()
260 mgmt->u.action.u.addba_resp.status = cpu_to_le16(status); in ieee80211_send_addba_resp()
262 if (sta->sta.he_cap.has_he && addbaext) in ieee80211_send_addba_resp()
274 struct ieee80211_local *local = sta->sdata->local; in ___ieee80211_start_rx_ba_session() local
277 .sta = &sta->sta, in ___ieee80211_start_rx_ba_session()
284 int i, ret = -EOPNOTSUPP; in ___ieee80211_start_rx_ba_session()
289 ht_dbg(sta->sdata, in ___ieee80211_start_rx_ba_session()
291 sta->sta.addr, tid); in ___ieee80211_start_rx_ba_session()
295 if (!sta->sta.ht_cap.ht_supported && in ___ieee80211_start_rx_ba_session()
296 sta->sdata->vif.bss_conf.chandef.chan->band != NL80211_BAND_6GHZ) { in ___ieee80211_start_rx_ba_session()
297 ht_dbg(sta->sdata, in ___ieee80211_start_rx_ba_session()
299 sta->sta.addr, tid); in ___ieee80211_start_rx_ba_session()
305 ht_dbg(sta->sdata, in ___ieee80211_start_rx_ba_session()
306 "Suspend in progress - Denying ADDBA request (%pM tid %d)\n", in ___ieee80211_start_rx_ba_session()
307 sta->sta.addr, tid); in ___ieee80211_start_rx_ba_session()
311 if (sta->sta.he_cap.has_he) in ___ieee80211_start_rx_ba_session()
318 * and if buffer size does not exceeds max value */ in ___ieee80211_start_rx_ba_session()
321 (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) || in ___ieee80211_start_rx_ba_session()
324 ht_dbg_ratelimited(sta->sdata, in ___ieee80211_start_rx_ba_session()
325 "AddBA Req with bad params from %pM on tid %u. policy %d, buffer size %d\n", in ___ieee80211_start_rx_ba_session()
326 sta->sta.addr, tid, ba_policy, buf_size); in ___ieee80211_start_rx_ba_session()
329 /* determine default buffer size */ in ___ieee80211_start_rx_ba_session()
333 /* make sure the size doesn't exceed the maximum supported by the hw */ in ___ieee80211_start_rx_ba_session()
334 if (buf_size > sta->sta.max_rx_aggregation_subframes) in ___ieee80211_start_rx_ba_session()
335 buf_size = sta->sta.max_rx_aggregation_subframes; in ___ieee80211_start_rx_ba_session()
338 ht_dbg(sta->sdata, "AddBA Req buf_size=%d for %pM\n", in ___ieee80211_start_rx_ba_session()
339 buf_size, sta->sta.addr); in ___ieee80211_start_rx_ba_session()
342 lockdep_assert_held(&sta->ampdu_mlme.mtx); in ___ieee80211_start_rx_ba_session()
344 if (test_bit(tid, sta->ampdu_mlme.agg_session_valid)) { in ___ieee80211_start_rx_ba_session()
345 if (sta->ampdu_mlme.tid_rx_token[tid] == dialog_token) { in ___ieee80211_start_rx_ba_session()
348 ht_dbg_ratelimited(sta->sdata, in ___ieee80211_start_rx_ba_session()
350 sta->sta.addr, tid); in ___ieee80211_start_rx_ba_session()
357 tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); in ___ieee80211_start_rx_ba_session()
358 if (tid_rx && tid_rx->timeout == timeout) in ___ieee80211_start_rx_ba_session()
366 ht_dbg_ratelimited(sta->sdata, in ___ieee80211_start_rx_ba_session()
368 sta->sta.addr, tid); in ___ieee80211_start_rx_ba_session()
376 if (ieee80211_hw_check(&local->hw, SUPPORTS_REORDERING_BUFFER)) { in ___ieee80211_start_rx_ba_session()
377 ret = drv_ampdu_action(local, sta->sdata, &params); in ___ieee80211_start_rx_ba_session()
378 ht_dbg(sta->sdata, in ___ieee80211_start_rx_ba_session()
379 "Rx A-MPDU request on %pM tid %d result %d\n", in ___ieee80211_start_rx_ba_session()
380 sta->sta.addr, tid, ret); in ___ieee80211_start_rx_ba_session()
386 /* prepare A-MPDU MLME for Rx aggregation */ in ___ieee80211_start_rx_ba_session()
391 spin_lock_init(&tid_agg_rx->reorder_lock); in ___ieee80211_start_rx_ba_session()
394 timer_setup(&tid_agg_rx->session_timer, in ___ieee80211_start_rx_ba_session()
398 timer_setup(&tid_agg_rx->reorder_timer, in ___ieee80211_start_rx_ba_session()
402 tid_agg_rx->reorder_buf = in ___ieee80211_start_rx_ba_session()
404 tid_agg_rx->reorder_time = in ___ieee80211_start_rx_ba_session()
406 if (!tid_agg_rx->reorder_buf || !tid_agg_rx->reorder_time) { in ___ieee80211_start_rx_ba_session()
407 kfree(tid_agg_rx->reorder_buf); in ___ieee80211_start_rx_ba_session()
408 kfree(tid_agg_rx->reorder_time); in ___ieee80211_start_rx_ba_session()
414 __skb_queue_head_init(&tid_agg_rx->reorder_buf[i]); in ___ieee80211_start_rx_ba_session()
416 ret = drv_ampdu_action(local, sta->sdata, &params); in ___ieee80211_start_rx_ba_session()
417 ht_dbg(sta->sdata, "Rx A-MPDU request on %pM tid %d result %d\n", in ___ieee80211_start_rx_ba_session()
418 sta->sta.addr, tid, ret); in ___ieee80211_start_rx_ba_session()
420 kfree(tid_agg_rx->reorder_buf); in ___ieee80211_start_rx_ba_session()
421 kfree(tid_agg_rx->reorder_time); in ___ieee80211_start_rx_ba_session()
427 tid_agg_rx->ssn = start_seq_num; in ___ieee80211_start_rx_ba_session()
428 tid_agg_rx->head_seq_num = start_seq_num; in ___ieee80211_start_rx_ba_session()
429 tid_agg_rx->buf_size = buf_size; in ___ieee80211_start_rx_ba_session()
430 tid_agg_rx->timeout = timeout; in ___ieee80211_start_rx_ba_session()
431 tid_agg_rx->stored_mpdu_num = 0; in ___ieee80211_start_rx_ba_session()
432 tid_agg_rx->auto_seq = auto_seq; in ___ieee80211_start_rx_ba_session()
433 tid_agg_rx->started = false; in ___ieee80211_start_rx_ba_session()
434 tid_agg_rx->reorder_buf_filtered = 0; in ___ieee80211_start_rx_ba_session()
435 tid_agg_rx->tid = tid; in ___ieee80211_start_rx_ba_session()
436 tid_agg_rx->sta = sta; in ___ieee80211_start_rx_ba_session()
440 rcu_assign_pointer(sta->ampdu_mlme.tid_rx[tid], tid_agg_rx); in ___ieee80211_start_rx_ba_session()
443 mod_timer(&tid_agg_rx->session_timer, TU_TO_EXP_TIME(timeout)); in ___ieee80211_start_rx_ba_session()
444 tid_agg_rx->last_rx = jiffies; in ___ieee80211_start_rx_ba_session()
449 __set_bit(tid, sta->ampdu_mlme.agg_session_valid); in ___ieee80211_start_rx_ba_session()
450 __clear_bit(tid, sta->ampdu_mlme.unexpected_agg); in ___ieee80211_start_rx_ba_session()
451 sta->ampdu_mlme.tid_rx_token[tid] = dialog_token; in ___ieee80211_start_rx_ba_session()
455 ieee80211_send_addba_resp(sta, sta->sta.addr, tid, in ___ieee80211_start_rx_ba_session()
467 mutex_lock(&sta->ampdu_mlme.mtx); in __ieee80211_start_rx_ba_session()
471 mutex_unlock(&sta->ampdu_mlme.mtx); in __ieee80211_start_rx_ba_session()
474 void ieee80211_process_addba_request(struct ieee80211_local *local, in ieee80211_process_addba_request() argument
485 dialog_token = mgmt->u.action.u.addba_req.dialog_token; in ieee80211_process_addba_request()
486 timeout = le16_to_cpu(mgmt->u.action.u.addba_req.timeout); in ieee80211_process_addba_request()
488 le16_to_cpu(mgmt->u.action.u.addba_req.start_seq_num) >> 4; in ieee80211_process_addba_request()
490 capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab); in ieee80211_process_addba_request()
495 ies_len = len - offsetof(struct ieee80211_mgmt, in ieee80211_process_addba_request()
498 ieee802_11_parse_elems(mgmt->u.action.u.addba_req.variable, in ieee80211_process_addba_request()
499 ies_len, true, &elems, mgmt->bssid, NULL); in ieee80211_process_addba_request()
514 struct ieee80211_local *local = sdata->local; in ieee80211_manage_rx_ba_offl() local
522 set_bit(tid, sta->ampdu_mlme.tid_rx_manage_offl); in ieee80211_manage_rx_ba_offl()
523 ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work); in ieee80211_manage_rx_ba_offl()
533 struct ieee80211_local *local = sdata->local; in ieee80211_rx_ba_timer_expired() local
541 set_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired); in ieee80211_rx_ba_timer_expired()
542 ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work); in ieee80211_rx_ba_timer_expired()