Lines Matching +full:txrx +full:-
1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2016 Qualcomm Atheros, Inc.
9 #include "txrx.h"
18 if (likely(!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN))) in ath10k_report_offchan_tx()
29 spin_lock_bh(&ar->data_lock); in ath10k_report_offchan_tx()
30 if (ar->offchan_tx_skb != skb) { in ath10k_report_offchan_tx()
35 complete(&ar->offchan_tx_completed); in ath10k_report_offchan_tx()
36 ar->offchan_tx_skb = NULL; /* just for sanity */ in ath10k_report_offchan_tx()
40 spin_unlock_bh(&ar->data_lock); in ath10k_report_offchan_tx()
47 struct ath10k *ar = htt->ar; in ath10k_txrx_tx_unref()
48 struct device *dev = ar->dev; in ath10k_txrx_tx_unref()
58 tx_done->msdu_id, tx_done->status); in ath10k_txrx_tx_unref()
60 if (tx_done->msdu_id >= htt->max_num_pending_tx) { in ath10k_txrx_tx_unref()
62 tx_done->msdu_id); in ath10k_txrx_tx_unref()
63 return -EINVAL; in ath10k_txrx_tx_unref()
66 spin_lock_bh(&htt->tx_lock); in ath10k_txrx_tx_unref()
67 msdu = idr_find(&htt->pending_tx, tx_done->msdu_id); in ath10k_txrx_tx_unref()
70 tx_done->msdu_id); in ath10k_txrx_tx_unref()
71 spin_unlock_bh(&htt->tx_lock); in ath10k_txrx_tx_unref()
72 return -ENOENT; in ath10k_txrx_tx_unref()
76 txq = skb_cb->txq; in ath10k_txrx_tx_unref()
79 artxq = (void *)txq->drv_priv; in ath10k_txrx_tx_unref()
80 artxq->num_fw_queued--; in ath10k_txrx_tx_unref()
83 flags = skb_cb->flags; in ath10k_txrx_tx_unref()
84 ath10k_htt_tx_free_msdu_id(htt, tx_done->msdu_id); in ath10k_txrx_tx_unref()
86 spin_unlock_bh(&htt->tx_lock); in ath10k_txrx_tx_unref()
89 if (txq && txq->sta && skb_cb->airtime_est) in ath10k_txrx_tx_unref()
90 ieee80211_sta_register_airtime(txq->sta, txq->tid, in ath10k_txrx_tx_unref()
91 skb_cb->airtime_est, 0); in ath10k_txrx_tx_unref()
94 if (ar->bus_param.dev_type != ATH10K_DEV_TYPE_HL) in ath10k_txrx_tx_unref()
95 dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); in ath10k_txrx_tx_unref()
97 ath10k_report_offchan_tx(htt->ar, msdu); in ath10k_txrx_tx_unref()
100 memset(&info->status, 0, sizeof(info->status)); in ath10k_txrx_tx_unref()
101 info->status.rates[0].idx = -1; in ath10k_txrx_tx_unref()
103 trace_ath10k_txrx_tx_unref(ar, tx_done->msdu_id); in ath10k_txrx_tx_unref()
105 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && in ath10k_txrx_tx_unref()
107 info->flags |= IEEE80211_TX_STAT_ACK; in ath10k_txrx_tx_unref()
109 if (tx_done->status == HTT_TX_COMPL_STATE_NOACK) in ath10k_txrx_tx_unref()
110 info->flags &= ~IEEE80211_TX_STAT_ACK; in ath10k_txrx_tx_unref()
112 if ((tx_done->status == HTT_TX_COMPL_STATE_ACK) && in ath10k_txrx_tx_unref()
113 ((info->flags & IEEE80211_TX_CTL_NO_ACK) || in ath10k_txrx_tx_unref()
115 info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED; in ath10k_txrx_tx_unref()
117 if (tx_done->status == HTT_TX_COMPL_STATE_DISCARD) { in ath10k_txrx_tx_unref()
118 if ((info->flags & IEEE80211_TX_CTL_NO_ACK) || in ath10k_txrx_tx_unref()
120 info->flags &= ~IEEE80211_TX_STAT_NOACK_TRANSMITTED; in ath10k_txrx_tx_unref()
122 info->flags &= ~IEEE80211_TX_STAT_ACK; in ath10k_txrx_tx_unref()
125 if (tx_done->status == HTT_TX_COMPL_STATE_ACK && in ath10k_txrx_tx_unref()
126 tx_done->ack_rssi != ATH10K_INVALID_RSSI) { in ath10k_txrx_tx_unref()
127 info->status.ack_signal = ATH10K_DEFAULT_NOISE_FLOOR + in ath10k_txrx_tx_unref()
128 tx_done->ack_rssi; in ath10k_txrx_tx_unref()
129 info->status.flags |= IEEE80211_TX_STATUS_ACK_SIGNAL_VALID; in ath10k_txrx_tx_unref()
139 status.sta = txq->sta; in ath10k_txrx_tx_unref()
141 ieee80211_tx_status_ext(htt->ar->hw, &status); in ath10k_txrx_tx_unref()
155 lockdep_assert_held(&ar->data_lock); in ath10k_peer_find()
157 list_for_each_entry(peer, &ar->peers, list) { in ath10k_peer_find()
158 if (peer->vdev_id != vdev_id) in ath10k_peer_find()
160 if (!ether_addr_equal(peer->addr, addr)) in ath10k_peer_find()
173 if (peer_id >= BITS_PER_TYPE(peer->peer_ids)) in ath10k_peer_find_by_id()
176 lockdep_assert_held(&ar->data_lock); in ath10k_peer_find_by_id()
178 list_for_each_entry(peer, &ar->peers, list) in ath10k_peer_find_by_id()
179 if (test_bit(peer_id, peer->peer_ids)) in ath10k_peer_find_by_id()
190 time_left = wait_event_timeout(ar->peer_mapping_wq, ({ in ath10k_wait_for_peer_common()
193 spin_lock_bh(&ar->data_lock); in ath10k_wait_for_peer_common()
195 spin_unlock_bh(&ar->data_lock); in ath10k_wait_for_peer_common()
198 test_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags)); in ath10k_wait_for_peer_common()
202 return -ETIMEDOUT; in ath10k_wait_for_peer_common()
220 struct ath10k *ar = htt->ar; in ath10k_peer_map_event()
223 if (ev->peer_id >= ATH10K_MAX_NUM_PEER_IDS) { in ath10k_peer_map_event()
226 ev->peer_id); in ath10k_peer_map_event()
230 spin_lock_bh(&ar->data_lock); in ath10k_peer_map_event()
231 peer = ath10k_peer_find(ar, ev->vdev_id, ev->addr); in ath10k_peer_map_event()
237 peer->vdev_id = ev->vdev_id; in ath10k_peer_map_event()
238 ether_addr_copy(peer->addr, ev->addr); in ath10k_peer_map_event()
239 list_add(&peer->list, &ar->peers); in ath10k_peer_map_event()
240 wake_up(&ar->peer_mapping_wq); in ath10k_peer_map_event()
244 ev->vdev_id, ev->addr, ev->peer_id); in ath10k_peer_map_event()
246 WARN_ON(ar->peer_map[ev->peer_id] && (ar->peer_map[ev->peer_id] != peer)); in ath10k_peer_map_event()
247 ar->peer_map[ev->peer_id] = peer; in ath10k_peer_map_event()
248 set_bit(ev->peer_id, peer->peer_ids); in ath10k_peer_map_event()
250 spin_unlock_bh(&ar->data_lock); in ath10k_peer_map_event()
256 struct ath10k *ar = htt->ar; in ath10k_peer_unmap_event()
259 if (ev->peer_id >= ATH10K_MAX_NUM_PEER_IDS) { in ath10k_peer_unmap_event()
262 ev->peer_id); in ath10k_peer_unmap_event()
266 spin_lock_bh(&ar->data_lock); in ath10k_peer_unmap_event()
267 peer = ath10k_peer_find_by_id(ar, ev->peer_id); in ath10k_peer_unmap_event()
269 ath10k_warn(ar, "peer-unmap-event: unknown peer id %d\n", in ath10k_peer_unmap_event()
270 ev->peer_id); in ath10k_peer_unmap_event()
275 peer->vdev_id, peer->addr, ev->peer_id); in ath10k_peer_unmap_event()
277 ar->peer_map[ev->peer_id] = NULL; in ath10k_peer_unmap_event()
278 clear_bit(ev->peer_id, peer->peer_ids); in ath10k_peer_unmap_event()
280 if (bitmap_empty(peer->peer_ids, ATH10K_MAX_NUM_PEER_IDS)) { in ath10k_peer_unmap_event()
281 list_del(&peer->list); in ath10k_peer_unmap_event()
283 wake_up(&ar->peer_mapping_wq); in ath10k_peer_unmap_event()
287 spin_unlock_bh(&ar->data_lock); in ath10k_peer_unmap_event()