• Home
  • Raw
  • Download

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 - 2021 Intel Corporation
20 #include "driver-ops.h"
24 * DOC: TX A-MPDU aggregation
28 * packets with a flag indicating A-MPDU aggregation. The driver
66 struct ieee80211_local *local = sdata->local; in ieee80211_send_addba_request() local
71 skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom); in ieee80211_send_addba_request()
76 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_addba_request()
78 memcpy(mgmt->da, da, ETH_ALEN); in ieee80211_send_addba_request()
79 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); in ieee80211_send_addba_request()
80 if (sdata->vif.type == NL80211_IFTYPE_AP || in ieee80211_send_addba_request()
81 sdata->vif.type == NL80211_IFTYPE_AP_VLAN || in ieee80211_send_addba_request()
82 sdata->vif.type == NL80211_IFTYPE_MESH_POINT) in ieee80211_send_addba_request()
83 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); in ieee80211_send_addba_request()
84 else if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_send_addba_request()
85 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); in ieee80211_send_addba_request()
86 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) in ieee80211_send_addba_request()
87 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); in ieee80211_send_addba_request()
89 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | in ieee80211_send_addba_request()
92 skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_req)); in ieee80211_send_addba_request()
94 mgmt->u.action.category = WLAN_CATEGORY_BACK; in ieee80211_send_addba_request()
95 mgmt->u.action.u.addba_req.action_code = WLAN_ACTION_ADDBA_REQ; in ieee80211_send_addba_request()
97 mgmt->u.action.u.addba_req.dialog_token = dialog_token; in ieee80211_send_addba_request()
98 capab = (u16)(1 << 0); /* bit 0 A-MSDU support */ in ieee80211_send_addba_request()
103 mgmt->u.action.u.addba_req.capab = cpu_to_le16(capab); in ieee80211_send_addba_request()
105 mgmt->u.action.u.addba_req.timeout = cpu_to_le16(timeout); in ieee80211_send_addba_request()
106 mgmt->u.action.u.addba_req.start_seq_num = in ieee80211_send_addba_request()
115 struct ieee80211_local *local = sdata->local; in ieee80211_send_bar() local
120 skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom); in ieee80211_send_bar()
124 skb_reserve(skb, local->hw.extra_tx_headroom); in ieee80211_send_bar()
126 bar->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | in ieee80211_send_bar()
128 memcpy(bar->ra, ra, ETH_ALEN); in ieee80211_send_bar()
129 memcpy(bar->ta, sdata->vif.addr, ETH_ALEN); in ieee80211_send_bar()
133 bar->control = cpu_to_le16(bar_control); in ieee80211_send_bar()
134 bar->start_seq_num = cpu_to_le16(ssn); in ieee80211_send_bar()
136 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | in ieee80211_send_bar()
145 lockdep_assert_held(&sta->ampdu_mlme.mtx); in ieee80211_assign_tid_tx()
146 lockdep_assert_held(&sta->lock); in ieee80211_assign_tid_tx()
147 rcu_assign_pointer(sta->ampdu_mlme.tid_tx[tid], tid_tx); in ieee80211_assign_tid_tx()
153 * refcount the global queue stop caused by that in order
155 * setup or teardown re-enables queues before the other is
164 int queue = sdata->vif.hw_queue[ieee80211_ac_from_tid(tid)]; in __acquires()
168 if (atomic_inc_return(&sdata->local->agg_queue_stop[queue]) == 1) in __acquires()
170 &sdata->local->hw, queue, in __acquires()
179 int queue = sdata->vif.hw_queue[ieee80211_ac_from_tid(tid)]; in __releases()
181 if (atomic_dec_return(&sdata->local->agg_queue_stop[queue]) == 0) in __releases()
183 &sdata->local->hw, queue, in __releases()
192 struct ieee80211_txq *txq = sta->sta.txq[tid]; in ieee80211_agg_stop_txq()
201 sdata = vif_to_sdata(txq->vif); in ieee80211_agg_stop_txq()
202 fq = &sdata->local->fq; in ieee80211_agg_stop_txq()
205 spin_lock_bh(&fq->lock); in ieee80211_agg_stop_txq()
206 set_bit(IEEE80211_TXQ_STOP, &txqi->flags); in ieee80211_agg_stop_txq()
207 spin_unlock_bh(&fq->lock); in ieee80211_agg_stop_txq()
213 struct ieee80211_txq *txq = sta->sta.txq[tid]; in ieee80211_agg_start_txq()
216 lockdep_assert_held(&sta->ampdu_mlme.mtx); in ieee80211_agg_start_txq()
224 set_bit(IEEE80211_TXQ_AMPDU, &txqi->flags); in ieee80211_agg_start_txq()
226 clear_bit(IEEE80211_TXQ_AMPDU, &txqi->flags); in ieee80211_agg_start_txq()
228 clear_bit(IEEE80211_TXQ_STOP, &txqi->flags); in ieee80211_agg_start_txq()
231 schedule_and_wake_txq(sta->sdata->local, txqi); in ieee80211_agg_start_txq()
237 * splice packets from the STA's pending to the local pending,
244 struct ieee80211_local *local = sdata->local; in __acquires() local
245 int queue = sdata->vif.hw_queue[ieee80211_ac_from_tid(tid)]; in __acquires()
255 if (!skb_queue_empty(&tid_tx->pending)) { in __acquires()
256 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); in __acquires()
258 skb_queue_splice_tail_init(&tid_tx->pending, in __acquires()
259 &local->pending[queue]); in __acquires()
260 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); in __acquires()
274 lockdep_assert_held(&sta->ampdu_mlme.mtx); in ieee80211_remove_tid_tx()
275 lockdep_assert_held(&sta->lock); in ieee80211_remove_tid_tx()
283 * stop the queue now, we will not get any more packets, and any in ieee80211_remove_tid_tx()
289 ieee80211_agg_splice_packets(sta->sdata, tid_tx, tid); in ieee80211_remove_tid_tx()
294 ieee80211_agg_splice_finish(sta->sdata, tid); in ieee80211_remove_tid_tx()
302 struct ieee80211_local *local = sta->local; in ___ieee80211_stop_tx_ba_session() local
305 .sta = &sta->sta, in ___ieee80211_stop_tx_ba_session()
314 lockdep_assert_held(&sta->ampdu_mlme.mtx); in ___ieee80211_stop_tx_ba_session()
327 return -EINVAL; in ___ieee80211_stop_tx_ba_session()
330 spin_lock_bh(&sta->lock); in ___ieee80211_stop_tx_ba_session()
333 tid_tx = sta->ampdu_mlme.tid_start_tx[tid]; in ___ieee80211_stop_tx_ba_session()
335 sta->ampdu_mlme.tid_start_tx[tid] = NULL; in ___ieee80211_stop_tx_ba_session()
339 spin_unlock_bh(&sta->lock); in ___ieee80211_stop_tx_ba_session()
340 return -ENOENT; in ___ieee80211_stop_tx_ba_session()
344 * if we're already stopping ignore any new requests to stop in ___ieee80211_stop_tx_ba_session()
347 if (test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { in ___ieee80211_stop_tx_ba_session()
348 spin_unlock_bh(&sta->lock); in ___ieee80211_stop_tx_ba_session()
350 return -EALREADY; in ___ieee80211_stop_tx_ba_session()
352 ret = drv_ampdu_action(local, sta->sdata, &params); in ___ieee80211_stop_tx_ba_session()
357 if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { in ___ieee80211_stop_tx_ba_session()
360 spin_unlock_bh(&sta->lock); in ___ieee80211_stop_tx_ba_session()
365 set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state); in ___ieee80211_stop_tx_ba_session()
369 spin_unlock_bh(&sta->lock); in ___ieee80211_stop_tx_ba_session()
371 ht_dbg(sta->sdata, "Tx BA session stop requested for %pM tid %u\n", in ___ieee80211_stop_tx_ba_session()
372 sta->sta.addr, tid); in ___ieee80211_stop_tx_ba_session()
374 del_timer_sync(&tid_tx->addba_resp_timer); in ___ieee80211_stop_tx_ba_session()
375 del_timer_sync(&tid_tx->session_timer); in ___ieee80211_stop_tx_ba_session()
379 * to the driver but are put onto tid_tx->pending instead, in ___ieee80211_stop_tx_ba_session()
382 clear_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state); in ___ieee80211_stop_tx_ba_session()
396 if (!local->in_reconfig) in ___ieee80211_stop_tx_ba_session()
399 tid_tx->stop_initiator = reason == AGG_STOP_PEER_REQUEST ? in ___ieee80211_stop_tx_ba_session()
402 tid_tx->tx_stop = reason == AGG_STOP_LOCAL_REQUEST; in ___ieee80211_stop_tx_ba_session()
404 ret = drv_ampdu_action(local, sta->sdata, &params); in ___ieee80211_stop_tx_ba_session()
428 * After sending add Block Ack request we activated a timer until
430 * If this timer expires sta_addba_resp_timer_expired will be executed.
435 struct sta_info *sta = tid_tx->sta; in sta_addba_resp_timer_expired()
436 u8 tid = tid_tx->tid; in sta_addba_resp_timer_expired()
439 if (test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) { in sta_addba_resp_timer_expired()
440 ht_dbg(sta->sdata, in sta_addba_resp_timer_expired()
441 "timer expired on %pM tid %d not expecting addBA response\n", in sta_addba_resp_timer_expired()
442 sta->sta.addr, tid); in sta_addba_resp_timer_expired()
446 ht_dbg(sta->sdata, "addBA response timer expired on %pM tid %d\n", in sta_addba_resp_timer_expired()
447 sta->sta.addr, tid); in sta_addba_resp_timer_expired()
449 ieee80211_stop_tx_ba_session(&sta->sta, tid); in sta_addba_resp_timer_expired()
455 struct ieee80211_sub_if_data *sdata = sta->sdata; in ieee80211_send_addba_with_timeout()
456 struct ieee80211_local *local = sta->local; in ieee80211_send_addba_with_timeout() local
457 u8 tid = tid_tx->tid; in ieee80211_send_addba_with_timeout()
460 /* activate the timer for the recipient's addBA response */ in ieee80211_send_addba_with_timeout()
461 mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL); in ieee80211_send_addba_with_timeout()
462 ht_dbg(sdata, "activated addBA response timer on %pM tid %d\n", in ieee80211_send_addba_with_timeout()
463 sta->sta.addr, tid); in ieee80211_send_addba_with_timeout()
465 spin_lock_bh(&sta->lock); in ieee80211_send_addba_with_timeout()
466 sta->ampdu_mlme.last_addba_req_time[tid] = jiffies; in ieee80211_send_addba_with_timeout()
467 sta->ampdu_mlme.addba_req_num[tid]++; in ieee80211_send_addba_with_timeout()
468 spin_unlock_bh(&sta->lock); in ieee80211_send_addba_with_timeout()
470 if (sta->sta.he_cap.has_he) { in ieee80211_send_addba_with_timeout()
471 buf_size = local->hw.max_tx_aggregation_subframes; in ieee80211_send_addba_with_timeout()
483 ieee80211_send_addba_request(sdata, sta->sta.addr, tid, in ieee80211_send_addba_with_timeout()
484 tid_tx->dialog_token, tid_tx->ssn, in ieee80211_send_addba_with_timeout()
485 buf_size, tid_tx->timeout); in ieee80211_send_addba_with_timeout()
487 WARN_ON(test_and_set_bit(HT_AGG_STATE_SENT_ADDBA, &tid_tx->state)); in ieee80211_send_addba_with_timeout()
493 struct ieee80211_local *local = sta->local; in ieee80211_tx_ba_session_handle_start() local
494 struct ieee80211_sub_if_data *sdata = sta->sdata; in ieee80211_tx_ba_session_handle_start()
496 .sta = &sta->sta, in ieee80211_tx_ba_session_handle_start()
512 clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state); in ieee80211_tx_ba_session_handle_start()
518 * we have a valid starting sequence number and that in-flight in ieee80211_tx_ba_session_handle_start()
524 params.ssn = sta->tid_seq[tid] >> 4; in ieee80211_tx_ba_session_handle_start()
525 ret = drv_ampdu_action(local, sdata, &params); in ieee80211_tx_ba_session_handle_start()
526 tid_tx->ssn = params.ssn; in ieee80211_tx_ba_session_handle_start()
535 set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state); in ieee80211_tx_ba_session_handle_start()
538 "BA request denied - HW unavailable for %pM tid %d\n", in ieee80211_tx_ba_session_handle_start()
539 sta->sta.addr, tid); in ieee80211_tx_ba_session_handle_start()
540 spin_lock_bh(&sta->lock); in ieee80211_tx_ba_session_handle_start()
544 spin_unlock_bh(&sta->lock); in ieee80211_tx_ba_session_handle_start()
556 * After accepting the AddBA Response we activated a timer,
562 struct sta_info *sta = tid_tx->sta; in sta_tx_agg_session_timer_expired()
563 u8 tid = tid_tx->tid; in sta_tx_agg_session_timer_expired()
566 if (test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { in sta_tx_agg_session_timer_expired()
570 timeout = tid_tx->last_tx + TU_TO_JIFFIES(tid_tx->timeout); in sta_tx_agg_session_timer_expired()
572 mod_timer(&tid_tx->session_timer, timeout); in sta_tx_agg_session_timer_expired()
576 ht_dbg(sta->sdata, "tx session timer expired on %pM tid %d\n", in sta_tx_agg_session_timer_expired()
577 sta->sta.addr, tid); in sta_tx_agg_session_timer_expired()
579 ieee80211_stop_tx_ba_session(&sta->sta, tid); in sta_tx_agg_session_timer_expired()
586 struct ieee80211_sub_if_data *sdata = sta->sdata; in ieee80211_start_tx_ba_session()
587 struct ieee80211_local *local = sdata->local; in ieee80211_start_tx_ba_session() local
593 if (WARN(sta->reserved_tid == tid, in ieee80211_start_tx_ba_session()
595 return -EINVAL; in ieee80211_start_tx_ba_session()
597 if (!pubsta->ht_cap.ht_supported && in ieee80211_start_tx_ba_session()
598 sta->sdata->vif.bss_conf.chandef.chan->band != NL80211_BAND_6GHZ) in ieee80211_start_tx_ba_session()
599 return -EINVAL; in ieee80211_start_tx_ba_session()
601 if (WARN_ON_ONCE(!local->ops->ampdu_action)) in ieee80211_start_tx_ba_session()
602 return -EINVAL; in ieee80211_start_tx_ba_session()
605 !ieee80211_hw_check(&local->hw, AMPDU_AGGREGATION) || in ieee80211_start_tx_ba_session()
606 ieee80211_hw_check(&local->hw, TX_AMPDU_SETUP_IN_HW)) in ieee80211_start_tx_ba_session()
607 return -EINVAL; in ieee80211_start_tx_ba_session()
610 return -EINVAL; in ieee80211_start_tx_ba_session()
613 pubsta->addr, tid); in ieee80211_start_tx_ba_session()
615 if (sdata->vif.type != NL80211_IFTYPE_STATION && in ieee80211_start_tx_ba_session()
616 sdata->vif.type != NL80211_IFTYPE_MESH_POINT && in ieee80211_start_tx_ba_session()
617 sdata->vif.type != NL80211_IFTYPE_AP_VLAN && in ieee80211_start_tx_ba_session()
618 sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_start_tx_ba_session()
619 sdata->vif.type != NL80211_IFTYPE_ADHOC) in ieee80211_start_tx_ba_session()
620 return -EINVAL; in ieee80211_start_tx_ba_session()
624 "BA sessions blocked - Denying BA session request %pM tid %d\n", in ieee80211_start_tx_ba_session()
625 sta->sta.addr, tid); in ieee80211_start_tx_ba_session()
626 return -EINVAL; in ieee80211_start_tx_ba_session()
630 * 802.11n-2009 11.5.1.1: If the initiating STA is an HT STA, is a in ieee80211_start_tx_ba_session()
641 if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC && in ieee80211_start_tx_ba_session()
642 !sta->sta.ht_cap.ht_supported) { in ieee80211_start_tx_ba_session()
644 "BA request denied - IBSS STA %pM does not advertise HT support\n", in ieee80211_start_tx_ba_session()
645 pubsta->addr); in ieee80211_start_tx_ba_session()
646 return -EINVAL; in ieee80211_start_tx_ba_session()
649 spin_lock_bh(&sta->lock); in ieee80211_start_tx_ba_session()
651 /* we have tried too many times, receiver does not want A-MPDU */ in ieee80211_start_tx_ba_session()
652 if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_MAX_RETRIES) { in ieee80211_start_tx_ba_session()
653 ret = -EBUSY; in ieee80211_start_tx_ba_session()
662 if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES && in ieee80211_start_tx_ba_session()
663 time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] + in ieee80211_start_tx_ba_session()
666 "BA request denied - %d failed requests on %pM tid %u\n", in ieee80211_start_tx_ba_session()
667 sta->ampdu_mlme.addba_req_num[tid], sta->sta.addr, tid); in ieee80211_start_tx_ba_session()
668 ret = -EBUSY; in ieee80211_start_tx_ba_session()
674 if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) { in ieee80211_start_tx_ba_session()
676 "BA request denied - session is not idle on %pM tid %u\n", in ieee80211_start_tx_ba_session()
677 sta->sta.addr, tid); in ieee80211_start_tx_ba_session()
678 ret = -EAGAIN; in ieee80211_start_tx_ba_session()
682 /* prepare A-MPDU MLME for Tx aggregation */ in ieee80211_start_tx_ba_session()
685 ret = -ENOMEM; in ieee80211_start_tx_ba_session()
689 skb_queue_head_init(&tid_tx->pending); in ieee80211_start_tx_ba_session()
690 __set_bit(HT_AGG_STATE_WANT_START, &tid_tx->state); in ieee80211_start_tx_ba_session()
692 tid_tx->timeout = timeout; in ieee80211_start_tx_ba_session()
693 tid_tx->sta = sta; in ieee80211_start_tx_ba_session()
694 tid_tx->tid = tid; in ieee80211_start_tx_ba_session()
696 /* response timer */ in ieee80211_start_tx_ba_session()
697 timer_setup(&tid_tx->addba_resp_timer, sta_addba_resp_timer_expired, 0); in ieee80211_start_tx_ba_session()
699 /* tx timer */ in ieee80211_start_tx_ba_session()
700 timer_setup(&tid_tx->session_timer, in ieee80211_start_tx_ba_session()
704 sta->ampdu_mlme.dialog_token_allocator++; in ieee80211_start_tx_ba_session()
705 tid_tx->dialog_token = sta->ampdu_mlme.dialog_token_allocator; in ieee80211_start_tx_ba_session()
711 sta->ampdu_mlme.tid_start_tx[tid] = tid_tx; in ieee80211_start_tx_ba_session()
713 ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work); in ieee80211_start_tx_ba_session()
717 spin_unlock_bh(&sta->lock); in ieee80211_start_tx_ba_session()
722 static void ieee80211_agg_tx_operational(struct ieee80211_local *local, in ieee80211_agg_tx_operational() argument
727 .sta = &sta->sta, in ieee80211_agg_tx_operational()
734 lockdep_assert_held(&sta->ampdu_mlme.mtx); in ieee80211_agg_tx_operational()
737 params.buf_size = tid_tx->buf_size; in ieee80211_agg_tx_operational()
738 params.amsdu = tid_tx->amsdu; in ieee80211_agg_tx_operational()
740 ht_dbg(sta->sdata, "Aggregation is on for %pM tid %d\n", in ieee80211_agg_tx_operational()
741 sta->sta.addr, tid); in ieee80211_agg_tx_operational()
743 drv_ampdu_action(local, sta->sdata, &params); in ieee80211_agg_tx_operational()
749 spin_lock_bh(&sta->lock); in ieee80211_agg_tx_operational()
751 ieee80211_agg_splice_packets(sta->sdata, tid_tx, tid); in ieee80211_agg_tx_operational()
754 * in the TX path, and lets it go lock-free in in ieee80211_agg_tx_operational()
757 set_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state); in ieee80211_agg_tx_operational()
758 ieee80211_agg_splice_finish(sta->sdata, tid); in ieee80211_agg_tx_operational()
760 spin_unlock_bh(&sta->lock); in ieee80211_agg_tx_operational()
768 struct ieee80211_sub_if_data *sdata = sta->sdata; in ieee80211_start_tx_ba_cb()
769 struct ieee80211_local *local = sdata->local; in ieee80211_start_tx_ba_cb() local
771 if (WARN_ON(test_and_set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state))) in ieee80211_start_tx_ba_cb()
774 if (!test_bit(HT_AGG_STATE_SENT_ADDBA, &tid_tx->state)) { in ieee80211_start_tx_ba_cb()
780 if (test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) in ieee80211_start_tx_ba_cb()
781 ieee80211_agg_tx_operational(local, sta, tid); in ieee80211_start_tx_ba_cb()
802 tid_tx = rcu_dereference((*sta)->ampdu_mlme.tid_tx[tid]); in ieee80211_lookup_tid_tx()
814 struct ieee80211_local *local = sdata->local; in ieee80211_start_tx_ba_cb_irqsafe() local
825 set_bit(HT_AGG_STATE_START_CB, &tid_tx->state); in ieee80211_start_tx_ba_cb_irqsafe()
826 ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work); in ieee80211_start_tx_ba_cb_irqsafe()
837 mutex_lock(&sta->ampdu_mlme.mtx); in __ieee80211_stop_tx_ba_session()
841 mutex_unlock(&sta->ampdu_mlme.mtx); in __ieee80211_stop_tx_ba_session()
849 struct ieee80211_sub_if_data *sdata = sta->sdata; in ieee80211_stop_tx_ba_session()
850 struct ieee80211_local *local = sdata->local; in ieee80211_stop_tx_ba_session() local
856 if (!local->ops->ampdu_action) in ieee80211_stop_tx_ba_session()
857 return -EINVAL; in ieee80211_stop_tx_ba_session()
860 return -EINVAL; in ieee80211_stop_tx_ba_session()
862 spin_lock_bh(&sta->lock); in ieee80211_stop_tx_ba_session()
866 ret = -ENOENT; in ieee80211_stop_tx_ba_session()
870 WARN(sta->reserved_tid == tid, in ieee80211_stop_tx_ba_session()
871 "Requested to stop BA session on reserved tid=%d", tid); in ieee80211_stop_tx_ba_session()
873 if (test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { in ieee80211_stop_tx_ba_session()
879 set_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state); in ieee80211_stop_tx_ba_session()
880 ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work); in ieee80211_stop_tx_ba_session()
883 spin_unlock_bh(&sta->lock); in ieee80211_stop_tx_ba_session()
891 struct ieee80211_sub_if_data *sdata = sta->sdata; in ieee80211_stop_tx_ba_cb()
896 sta->sta.addr, tid); in ieee80211_stop_tx_ba_cb()
898 spin_lock_bh(&sta->lock); in ieee80211_stop_tx_ba_cb()
900 if (!test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { in ieee80211_stop_tx_ba_cb()
902 "unexpected callback to A-MPDU stop for %pM tid %d\n", in ieee80211_stop_tx_ba_cb()
903 sta->sta.addr, tid); in ieee80211_stop_tx_ba_cb()
907 if (tid_tx->stop_initiator == WLAN_BACK_INITIATOR && tid_tx->tx_stop) in ieee80211_stop_tx_ba_cb()
914 spin_unlock_bh(&sta->lock); in ieee80211_stop_tx_ba_cb()
920 ieee80211_send_delba(sdata, sta->sta.addr, tid, in ieee80211_stop_tx_ba_cb()
928 struct ieee80211_local *local = sdata->local; in ieee80211_stop_tx_ba_cb_irqsafe() local
939 set_bit(HT_AGG_STATE_STOP_CB, &tid_tx->state); in ieee80211_stop_tx_ba_cb_irqsafe()
940 ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work); in ieee80211_stop_tx_ba_cb_irqsafe()
947 void ieee80211_process_addba_resp(struct ieee80211_local *local, in ieee80211_process_addba_resp() argument
957 capab = le16_to_cpu(mgmt->u.action.u.addba_resp.capab); in ieee80211_process_addba_resp()
961 buf_size = min(buf_size, local->hw.max_tx_aggregation_subframes); in ieee80211_process_addba_resp()
963 txq = sta->sta.txq[tid]; in ieee80211_process_addba_resp()
965 set_bit(IEEE80211_TXQ_NO_AMSDU, &to_txq_info(txq)->flags); in ieee80211_process_addba_resp()
967 mutex_lock(&sta->ampdu_mlme.mtx); in ieee80211_process_addba_resp()
973 if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) { in ieee80211_process_addba_resp()
974 ht_dbg(sta->sdata, "wrong addBA response token, %pM tid %d\n", in ieee80211_process_addba_resp()
975 sta->sta.addr, tid); in ieee80211_process_addba_resp()
979 del_timer_sync(&tid_tx->addba_resp_timer); in ieee80211_process_addba_resp()
981 ht_dbg(sta->sdata, "switched off addBA timer for %pM tid %d\n", in ieee80211_process_addba_resp()
982 sta->sta.addr, tid); in ieee80211_process_addba_resp()
986 * caused WANT_STOP to be set. If the stop then was already in ieee80211_process_addba_resp()
989 if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) || in ieee80211_process_addba_resp()
990 test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { in ieee80211_process_addba_resp()
991 ht_dbg(sta->sdata, in ieee80211_process_addba_resp()
993 sta->sta.addr, tid); in ieee80211_process_addba_resp()
998 * IEEE 802.11-2007 7.3.1.14: in ieee80211_process_addba_resp()
1003 if (le16_to_cpu(mgmt->u.action.u.addba_resp.status) in ieee80211_process_addba_resp()
1006 &tid_tx->state)) { in ieee80211_process_addba_resp()
1011 tid_tx->buf_size = buf_size; in ieee80211_process_addba_resp()
1012 tid_tx->amsdu = amsdu; in ieee80211_process_addba_resp()
1014 if (test_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state)) in ieee80211_process_addba_resp()
1015 ieee80211_agg_tx_operational(local, sta, tid); in ieee80211_process_addba_resp()
1017 sta->ampdu_mlme.addba_req_num[tid] = 0; in ieee80211_process_addba_resp()
1019 tid_tx->timeout = in ieee80211_process_addba_resp()
1020 le16_to_cpu(mgmt->u.action.u.addba_resp.timeout); in ieee80211_process_addba_resp()
1022 if (tid_tx->timeout) { in ieee80211_process_addba_resp()
1023 mod_timer(&tid_tx->session_timer, in ieee80211_process_addba_resp()
1024 TU_TO_EXP_TIME(tid_tx->timeout)); in ieee80211_process_addba_resp()
1025 tid_tx->last_tx = jiffies; in ieee80211_process_addba_resp()
1033 mutex_unlock(&sta->ampdu_mlme.mtx); in ieee80211_process_addba_resp()