Lines Matching +full:local +full:- +full:timer +full:- +full:stop

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-2023 Intel Corporation
16 * DOC: RX A-MPDU aggregation
19 * @ampdu_action callback that is invoked to start/stop any
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_wiphy(sta->local->hw.wiphy); 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->local->hw.wiphy->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()
84 "Rx BA session stop requested for %pM tid %u %s reason: %d\n", 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()
133 set_bit(i, sta->ampdu_mlme.tid_rx_stop_requested); in ieee80211_stop_rx_ba_session()
135 wiphy_work_queue(sta->local->hw.wiphy, &sta->ampdu_mlme.work); in ieee80211_stop_rx_ba_session()
141 * After accepting the AddBA Request we activated a timer,
147 struct sta_info *sta = tid_rx->sta; in sta_rx_agg_session_timer_expired()
148 u8 tid = tid_rx->tid; in sta_rx_agg_session_timer_expired()
151 timeout = tid_rx->last_rx + TU_TO_JIFFIES(tid_rx->timeout); in sta_rx_agg_session_timer_expired()
153 mod_timer(&tid_rx->session_timer, timeout); in sta_rx_agg_session_timer_expired()
157 ht_dbg(sta->sdata, "RX session timer expired on %pM tid %d\n", in sta_rx_agg_session_timer_expired()
158 sta->sta.addr, tid); in sta_rx_agg_session_timer_expired()
160 set_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired); in sta_rx_agg_session_timer_expired()
161 wiphy_work_queue(sta->local->hw.wiphy, &sta->ampdu_mlme.work); in sta_rx_agg_session_timer_expired()
169 ieee80211_release_reorder_timeout(tid_rx->sta, tid_rx->tid); in sta_rx_agg_reorder_timer_expired()
185 resp->data = req->data & IEEE80211_ADDBA_EXT_NO_FRAG; in ieee80211_add_addbaext()
187 resp->data |= u8_encode_bits(buf_size >> IEEE80211_ADDBA_EXT_BUF_SIZE_SHIFT, in ieee80211_add_addbaext()
196 struct ieee80211_sub_if_data *sdata = sta->sdata; in ieee80211_send_addba_resp()
197 struct ieee80211_local *local = sdata->local; in ieee80211_send_addba_resp() local
200 bool amsdu = ieee80211_hw_check(&local->hw, SUPPORTS_AMSDU_IN_AMPDU); in ieee80211_send_addba_resp()
205 local->hw.extra_tx_headroom); in ieee80211_send_addba_resp()
209 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_addba_resp()
212 skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp)); in ieee80211_send_addba_resp()
213 mgmt->u.action.category = WLAN_CATEGORY_BACK; in ieee80211_send_addba_resp()
214 mgmt->u.action.u.addba_resp.action_code = WLAN_ACTION_ADDBA_RESP; in ieee80211_send_addba_resp()
215 mgmt->u.action.u.addba_resp.dialog_token = dialog_token; in ieee80211_send_addba_resp()
222 mgmt->u.action.u.addba_resp.capab = cpu_to_le16(capab); in ieee80211_send_addba_resp()
223 mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout); in ieee80211_send_addba_resp()
224 mgmt->u.action.u.addba_resp.status = cpu_to_le16(status); in ieee80211_send_addba_resp()
226 if (sta->sta.deflink.he_cap.has_he && addbaext) in ieee80211_send_addba_resp()
238 struct ieee80211_local *local = sta->sdata->local; in __ieee80211_start_rx_ba_session() local
241 .sta = &sta->sta, in __ieee80211_start_rx_ba_session()
248 int i, ret = -EOPNOTSUPP; in __ieee80211_start_rx_ba_session()
252 lockdep_assert_wiphy(sta->local->hw.wiphy); in __ieee80211_start_rx_ba_session()
255 ht_dbg(sta->sdata, in __ieee80211_start_rx_ba_session()
257 sta->sta.addr, tid); in __ieee80211_start_rx_ba_session()
261 if (!sta->sta.deflink.ht_cap.ht_supported && in __ieee80211_start_rx_ba_session()
262 !sta->sta.deflink.he_cap.has_he) { in __ieee80211_start_rx_ba_session()
263 ht_dbg(sta->sdata, in __ieee80211_start_rx_ba_session()
265 sta->sta.addr, tid); in __ieee80211_start_rx_ba_session()
271 ht_dbg(sta->sdata, in __ieee80211_start_rx_ba_session()
272 "Suspend in progress - Denying ADDBA request (%pM tid %d)\n", in __ieee80211_start_rx_ba_session()
273 sta->sta.addr, tid); in __ieee80211_start_rx_ba_session()
277 if (sta->sta.deflink.eht_cap.has_eht) in __ieee80211_start_rx_ba_session()
279 else if (sta->sta.deflink.he_cap.has_he) in __ieee80211_start_rx_ba_session()
289 (!(sta->sta.deflink.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) || in __ieee80211_start_rx_ba_session()
292 ht_dbg_ratelimited(sta->sdata, in __ieee80211_start_rx_ba_session()
294 sta->sta.addr, tid, ba_policy, buf_size); in __ieee80211_start_rx_ba_session()
302 if (buf_size > sta->sta.max_rx_aggregation_subframes) in __ieee80211_start_rx_ba_session()
303 buf_size = sta->sta.max_rx_aggregation_subframes; in __ieee80211_start_rx_ba_session()
306 ht_dbg(sta->sdata, "AddBA Req buf_size=%d for %pM\n", in __ieee80211_start_rx_ba_session()
307 buf_size, sta->sta.addr); in __ieee80211_start_rx_ba_session()
309 if (test_bit(tid, sta->ampdu_mlme.agg_session_valid)) { in __ieee80211_start_rx_ba_session()
310 if (sta->ampdu_mlme.tid_rx_token[tid] == dialog_token) { in __ieee80211_start_rx_ba_session()
313 ht_dbg_ratelimited(sta->sdata, in __ieee80211_start_rx_ba_session()
315 sta->sta.addr, tid); in __ieee80211_start_rx_ba_session()
322 tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); in __ieee80211_start_rx_ba_session()
323 if (tid_rx && tid_rx->timeout == timeout) in __ieee80211_start_rx_ba_session()
331 ht_dbg_ratelimited(sta->sdata, in __ieee80211_start_rx_ba_session()
333 sta->sta.addr, tid); in __ieee80211_start_rx_ba_session()
341 if (ieee80211_hw_check(&local->hw, SUPPORTS_REORDERING_BUFFER)) { in __ieee80211_start_rx_ba_session()
342 ret = drv_ampdu_action(local, sta->sdata, &params); in __ieee80211_start_rx_ba_session()
343 ht_dbg(sta->sdata, in __ieee80211_start_rx_ba_session()
344 "Rx A-MPDU request on %pM tid %d result %d\n", in __ieee80211_start_rx_ba_session()
345 sta->sta.addr, tid, ret); in __ieee80211_start_rx_ba_session()
351 /* prepare A-MPDU MLME for Rx aggregation */ in __ieee80211_start_rx_ba_session()
356 spin_lock_init(&tid_agg_rx->reorder_lock); in __ieee80211_start_rx_ba_session()
358 /* rx timer */ in __ieee80211_start_rx_ba_session()
359 timer_setup(&tid_agg_rx->session_timer, in __ieee80211_start_rx_ba_session()
362 /* rx reorder timer */ in __ieee80211_start_rx_ba_session()
363 timer_setup(&tid_agg_rx->reorder_timer, in __ieee80211_start_rx_ba_session()
367 tid_agg_rx->reorder_buf = in __ieee80211_start_rx_ba_session()
369 tid_agg_rx->reorder_time = in __ieee80211_start_rx_ba_session()
371 if (!tid_agg_rx->reorder_buf || !tid_agg_rx->reorder_time) { in __ieee80211_start_rx_ba_session()
372 kfree(tid_agg_rx->reorder_buf); in __ieee80211_start_rx_ba_session()
373 kfree(tid_agg_rx->reorder_time); in __ieee80211_start_rx_ba_session()
379 __skb_queue_head_init(&tid_agg_rx->reorder_buf[i]); in __ieee80211_start_rx_ba_session()
381 ret = drv_ampdu_action(local, sta->sdata, &params); in __ieee80211_start_rx_ba_session()
382 ht_dbg(sta->sdata, "Rx A-MPDU request on %pM tid %d result %d\n", in __ieee80211_start_rx_ba_session()
383 sta->sta.addr, tid, ret); in __ieee80211_start_rx_ba_session()
385 kfree(tid_agg_rx->reorder_buf); in __ieee80211_start_rx_ba_session()
386 kfree(tid_agg_rx->reorder_time); in __ieee80211_start_rx_ba_session()
392 tid_agg_rx->ssn = start_seq_num; in __ieee80211_start_rx_ba_session()
393 tid_agg_rx->head_seq_num = start_seq_num; in __ieee80211_start_rx_ba_session()
394 tid_agg_rx->buf_size = buf_size; in __ieee80211_start_rx_ba_session()
395 tid_agg_rx->timeout = timeout; in __ieee80211_start_rx_ba_session()
396 tid_agg_rx->stored_mpdu_num = 0; in __ieee80211_start_rx_ba_session()
397 tid_agg_rx->auto_seq = auto_seq; in __ieee80211_start_rx_ba_session()
398 tid_agg_rx->started = false; in __ieee80211_start_rx_ba_session()
399 tid_agg_rx->reorder_buf_filtered = 0; in __ieee80211_start_rx_ba_session()
400 tid_agg_rx->tid = tid; in __ieee80211_start_rx_ba_session()
401 tid_agg_rx->sta = sta; in __ieee80211_start_rx_ba_session()
405 rcu_assign_pointer(sta->ampdu_mlme.tid_rx[tid], tid_agg_rx); in __ieee80211_start_rx_ba_session()
408 mod_timer(&tid_agg_rx->session_timer, TU_TO_EXP_TIME(timeout)); in __ieee80211_start_rx_ba_session()
409 tid_agg_rx->last_rx = jiffies; in __ieee80211_start_rx_ba_session()
414 __set_bit(tid, sta->ampdu_mlme.agg_session_valid); in __ieee80211_start_rx_ba_session()
415 __clear_bit(tid, sta->ampdu_mlme.unexpected_agg); in __ieee80211_start_rx_ba_session()
416 sta->ampdu_mlme.tid_rx_token[tid] = dialog_token; in __ieee80211_start_rx_ba_session()
420 ieee80211_send_addba_resp(sta, sta->sta.addr, tid, in __ieee80211_start_rx_ba_session()
425 void ieee80211_process_addba_request(struct ieee80211_local *local, in ieee80211_process_addba_request() argument
436 dialog_token = mgmt->u.action.u.addba_req.dialog_token; in ieee80211_process_addba_request()
437 timeout = le16_to_cpu(mgmt->u.action.u.addba_req.timeout); in ieee80211_process_addba_request()
439 le16_to_cpu(mgmt->u.action.u.addba_req.start_seq_num) >> 4; in ieee80211_process_addba_request()
441 capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab); in ieee80211_process_addba_request()
446 ies_len = len - offsetof(struct ieee80211_mgmt, in ieee80211_process_addba_request()
449 elems = ieee802_11_parse_elems(mgmt->u.action.u.addba_req.variable, in ieee80211_process_addba_request()
451 if (!elems || elems->parse_error) in ieee80211_process_addba_request()
455 if (sta->sta.deflink.eht_cap.has_eht && elems && elems->addba_ext_ie) { in ieee80211_process_addba_request()
456 u8 buf_size_1k = u8_get_bits(elems->addba_ext_ie->data, in ieee80211_process_addba_request()
465 elems ? elems->addba_ext_ie : NULL); in ieee80211_process_addba_request()
481 set_bit(tid, sta->ampdu_mlme.tid_rx_manage_offl); in ieee80211_manage_rx_ba_offl()
482 wiphy_work_queue(sta->local->hw.wiphy, &sta->ampdu_mlme.work); in ieee80211_manage_rx_ba_offl()
499 set_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired); in ieee80211_rx_ba_timer_expired()
500 wiphy_work_queue(sta->local->hw.wiphy, &sta->ampdu_mlme.work); in ieee80211_rx_ba_timer_expired()