Lines Matching refs:sc

50 static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
52 static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
54 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
57 static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
59 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
62 static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
64 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
80 void ath_txq_lock(struct ath_softc *sc, struct ath_txq *txq) in ath_txq_lock() argument
86 void ath_txq_unlock(struct ath_softc *sc, struct ath_txq *txq) in ath_txq_unlock() argument
92 void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq) in ath_txq_unlock_complete() argument
103 ieee80211_tx_status(sc->hw, skb); in ath_txq_unlock_complete()
106 static void ath_tx_queue_tid(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_queue_tid() argument
156 static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, in ath_txq_skb_done() argument
166 txq = sc->tx.txq_map[q]; in ath_txq_skb_done()
171 txq->pending_frames < sc->tx.txq_max_pending[q]) { in ath_txq_skb_done()
173 ieee80211_wake_queue(sc->hw, info->hw_queue); in ath_txq_skb_done()
175 ieee80211_wake_queue(sc->hw, q); in ath_txq_skb_done()
181 ath_get_skb_tid(struct ath_softc *sc, struct ath_node *an, struct sk_buff *skb) in ath_get_skb_tid() argument
209 ath_tx_tid_change_state(struct ath_softc *sc, struct ath_atx_tid *tid) in ath_tx_tid_change_state() argument
227 bf = ath_tx_setup_buffer(sc, txq, tid, skb); in ath_tx_tid_change_state()
230 ath_txq_skb_done(sc, txq, skb); in ath_tx_tid_change_state()
231 ieee80211_free_txskb(sc->hw, skb); in ath_tx_tid_change_state()
238 static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) in ath_tx_flush_tid() argument
256 ath_txq_skb_done(sc, txq, skb); in ath_tx_flush_tid()
257 ieee80211_free_txskb(sc->hw, skb); in ath_tx_flush_tid()
262 ath_tx_update_baw(sc, tid, bf->bf_state.seqno); in ath_tx_flush_tid()
267 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); in ath_tx_flush_tid()
271 ath_txq_unlock(sc, txq); in ath_tx_flush_tid()
273 ath_txq_lock(sc, txq); in ath_tx_flush_tid()
277 static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, in ath_tx_update_baw() argument
295 static void ath_tx_addto_baw(struct ath_softc *sc, struct ath_atx_tid *tid, in ath_tx_addto_baw() argument
314 static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq, in ath_tid_drain() argument
332 ath_tx_complete(sc, skb, ATH_TX_ERROR, txq); in ath_tid_drain()
337 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); in ath_tid_drain()
341 static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_set_retry() argument
357 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, in ath_tx_set_retry()
361 static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc) in ath_tx_get_buffer() argument
365 spin_lock_bh(&sc->tx.txbuflock); in ath_tx_get_buffer()
367 if (unlikely(list_empty(&sc->tx.txbuf))) { in ath_tx_get_buffer()
368 spin_unlock_bh(&sc->tx.txbuflock); in ath_tx_get_buffer()
372 bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); in ath_tx_get_buffer()
375 spin_unlock_bh(&sc->tx.txbuflock); in ath_tx_get_buffer()
380 static void ath_tx_return_buffer(struct ath_softc *sc, struct ath_buf *bf) in ath_tx_return_buffer() argument
382 spin_lock_bh(&sc->tx.txbuflock); in ath_tx_return_buffer()
383 list_add_tail(&bf->list, &sc->tx.txbuf); in ath_tx_return_buffer()
384 spin_unlock_bh(&sc->tx.txbuflock); in ath_tx_return_buffer()
387 static struct ath_buf* ath_clone_txbuf(struct ath_softc *sc, struct ath_buf *bf) in ath_clone_txbuf() argument
391 tbf = ath_tx_get_buffer(sc); in ath_clone_txbuf()
399 memcpy(tbf->bf_desc, bf->bf_desc, sc->sc_ah->caps.tx_desc_len); in ath_clone_txbuf()
406 static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf, in ath_tx_count_frames() argument
438 static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_complete_aggr() argument
445 struct ieee80211_hw *hw = sc->hw; in ath_tx_complete_aggr()
487 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 0); in ath_tx_complete_aggr()
495 tid = ath_get_skb_tid(sc, an, skb); in ath_tx_complete_aggr()
525 if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) in ath_tx_complete_aggr()
532 ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad); in ath_tx_complete_aggr()
561 ath_tx_set_retry(sc, txq, bf->bf_mpdu, in ath_tx_complete_aggr()
585 ath_tx_update_baw(sc, tid, seqno); in ath_tx_complete_aggr()
589 ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok); in ath_tx_complete_aggr()
592 ath_dynack_sample_tx_ts(sc->sc_ah, in ath_tx_complete_aggr()
597 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, in ath_tx_complete_aggr()
608 tbf = ath_clone_txbuf(sc, bf_last); in ath_tx_complete_aggr()
615 ath_tx_update_baw(sc, tid, seqno); in ath_tx_complete_aggr()
617 ath_tx_complete_buf(sc, bf, txq, in ath_tx_complete_aggr()
644 ath_tx_queue_tid(sc, txq, tid); in ath_tx_complete_aggr()
657 ath_txq_unlock(sc, txq); in ath_tx_complete_aggr()
659 ath_txq_lock(sc, txq); in ath_tx_complete_aggr()
665 ath9k_queue_reset(sc, RESET_TYPE_TX_ERROR); in ath_tx_complete_aggr()
674 static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_process_buffer() argument
689 ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc, in ath_tx_process_buffer()
696 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); in ath_tx_process_buffer()
697 ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts); in ath_tx_process_buffer()
699 ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok); in ath_tx_process_buffer()
701 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok); in ath_tx_process_buffer()
704 ath_txq_schedule(sc, txq); in ath_tx_process_buffer()
729 static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf, in ath_lookup_rate() argument
769 frmlen = sc->tx.max_aggr_framelen[q][modeidx][rates[i].idx]; in ath_lookup_rate()
786 bt_aggr_limit = ath9k_btcoex_aggr_limit(sc, max_4ms_framelen); in ath_lookup_rate()
800 static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid, in ath_compute_num_delims() argument
821 !(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)) in ath_compute_num_delims()
828 if (first_subfrm && !AR_SREV_9580_10_OR_LATER(sc->sc_ah) && in ath_compute_num_delims()
829 (sc->sc_ah->ent_mode & AR_ENT_OTP_MIN_PKT_SIZE_DISABLE)) in ath_compute_num_delims()
871 ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_get_tid_subframe() argument
892 bf = ath_tx_setup_buffer(sc, txq, tid, skb); in ath_tx_get_tid_subframe()
898 ath_txq_skb_done(sc, txq, skb); in ath_tx_get_tid_subframe()
899 ieee80211_free_txskb(sc->hw, skb); in ath_tx_get_tid_subframe()
936 ath_tx_update_baw(sc, tid, seqno); in ath_tx_get_tid_subframe()
937 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); in ath_tx_get_tid_subframe()
948 ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_form_aggr() argument
964 aggr_limit = ath_lookup_rate(sc, bf, tid); in ath_tx_form_aggr()
990 ndelim = ath_compute_num_delims(sc, tid, bf_first, fi->framelen, in ath_tx_form_aggr()
999 ath_tx_addto_baw(sc, tid, bf); in ath_tx_form_aggr()
1009 bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q); in ath_tx_form_aggr()
1038 static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, int pktlen, in ath_pkt_duration() argument
1078 void ath_update_max_aggr_framelen(struct ath_softc *sc, int queue, int txop) in ath_update_max_aggr_framelen() argument
1087 cur_ht20 = sc->tx.max_aggr_framelen[queue][MCS_HT20]; in ath_update_max_aggr_framelen()
1088 cur_ht20_sgi = sc->tx.max_aggr_framelen[queue][MCS_HT20_SGI]; in ath_update_max_aggr_framelen()
1089 cur_ht40 = sc->tx.max_aggr_framelen[queue][MCS_HT40]; in ath_update_max_aggr_framelen()
1090 cur_ht40_sgi = sc->tx.max_aggr_framelen[queue][MCS_HT40_SGI]; in ath_update_max_aggr_framelen()
1099 static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf, in ath_get_rate_txpower() argument
1106 struct ath_hw *ah = sc->sc_ah; in ath_get_rate_txpower()
1108 if (sc->tx99_state || !ah->tpc_enabled) in ath_get_rate_txpower()
1172 static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, in ath_buf_set_rate() argument
1175 struct ath_hw *ah = sc->sc_ah; in ath_buf_set_rate()
1183 u32 rts_thresh = sc->hw->wiphy->rts_threshold; in ath_buf_set_rate()
1236 info->rates[i].ChSel = ath_txchainmask_reduction(sc, in ath_buf_set_rate()
1238 info->rates[i].PktDuration = ath_pkt_duration(sc, rix, len, in ath_buf_set_rate()
1243 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix, in ath_buf_set_rate()
1267 info->rates[i].ChSel = ath_txchainmask_reduction(sc, in ath_buf_set_rate()
1270 info->rates[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah, in ath_buf_set_rate()
1274 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix, false, in ath_buf_set_rate()
1279 if (bf_isaggr(bf) && (len > sc->sc_ah->caps.rts_aggr_limit)) in ath_buf_set_rate()
1310 static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf, in ath_tx_fill_desc() argument
1313 struct ath_hw *ah = sc->sc_ah; in ath_tx_fill_desc()
1316 u32 rts_thresh = sc->hw->wiphy->rts_threshold; in ath_tx_fill_desc()
1334 info.link = (sc->tx99_state) ? bf->bf_daddr : 0; in ath_tx_fill_desc()
1339 if (!sc->tx99_state) in ath_tx_fill_desc()
1342 txq == sc->tx.uapsdq) in ath_tx_fill_desc()
1373 ath_buf_set_rate(sc, bf, &info, len, rts); in ath_tx_fill_desc()
1403 ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_form_burst() argument
1425 bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q); in ath_tx_form_burst()
1437 static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_sched_aggr() argument
1452 bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q); in ath_tx_sched_aggr()
1466 last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf, in ath_tx_sched_aggr()
1469 ath_tx_form_burst(sc, txq, tid, &bf_q, bf, tid_q); in ath_tx_sched_aggr()
1479 ath_tx_fill_desc(sc, bf, txq, aggr_len); in ath_tx_sched_aggr()
1480 ath_tx_txqaddbuf(sc, txq, &bf_q, false); in ath_tx_sched_aggr()
1484 int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, in ath_tx_aggr_start() argument
1496 ath_txq_lock(sc, txq); in ath_tx_aggr_start()
1510 ath_tx_tid_change_state(sc, txtid); in ath_tx_aggr_start()
1519 ath_txq_unlock_complete(sc, txq); in ath_tx_aggr_start()
1524 void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) in ath_tx_aggr_stop() argument
1530 ath_txq_lock(sc, txq); in ath_tx_aggr_stop()
1532 ath_tx_flush_tid(sc, txtid); in ath_tx_aggr_stop()
1533 ath_tx_tid_change_state(sc, txtid); in ath_tx_aggr_stop()
1534 ath_txq_unlock_complete(sc, txq); in ath_tx_aggr_stop()
1537 void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, in ath_tx_aggr_sleep() argument
1552 ath_txq_lock(sc, txq); in ath_tx_aggr_sleep()
1555 ath_txq_unlock(sc, txq); in ath_tx_aggr_sleep()
1569 ath_txq_unlock(sc, txq); in ath_tx_aggr_sleep()
1575 void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an) in ath_tx_aggr_wakeup() argument
1588 ath_txq_lock(sc, txq); in ath_tx_aggr_wakeup()
1592 ath_tx_queue_tid(sc, txq, tid); in ath_tx_aggr_wakeup()
1593 ath_txq_schedule(sc, txq); in ath_tx_aggr_wakeup()
1596 ath_txq_unlock_complete(sc, txq); in ath_tx_aggr_wakeup()
1600 void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, in ath_tx_aggr_resume() argument
1611 ath_txq_lock(sc, txq); in ath_tx_aggr_resume()
1616 ath_tx_queue_tid(sc, txq, tid); in ath_tx_aggr_resume()
1617 ath_txq_schedule(sc, txq); in ath_tx_aggr_resume()
1620 ath_txq_unlock_complete(sc, txq); in ath_tx_aggr_resume()
1629 struct ath_softc *sc = hw->priv; in ath9k_release_buffered_frames() local
1631 struct ath_txq *txq = sc->tx.uapsdq; in ath9k_release_buffered_frames()
1648 ath_txq_lock(sc, tid->ac->txq); in ath9k_release_buffered_frames()
1650 bf = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, tid, &tid_q); in ath9k_release_buffered_frames()
1658 ath_tx_addto_baw(sc, tid, bf); in ath9k_release_buffered_frames()
1672 ath_txq_unlock_complete(sc, tid->ac->txq); in ath9k_release_buffered_frames()
1682 ath_txq_lock(sc, txq); in ath9k_release_buffered_frames()
1683 ath_tx_fill_desc(sc, bf, txq, 0); in ath9k_release_buffered_frames()
1684 ath_tx_txqaddbuf(sc, txq, &bf_q, false); in ath9k_release_buffered_frames()
1685 ath_txq_unlock(sc, txq); in ath9k_release_buffered_frames()
1692 struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype) in ath_txq_setup() argument
1694 struct ath_hw *ah = sc->sc_ah; in ath_txq_setup()
1743 if (!ATH_TXQ_SETUP(sc, axq_qnum)) { in ath_txq_setup()
1744 struct ath_txq *txq = &sc->tx.txq[axq_qnum]; in ath_txq_setup()
1755 sc->tx.txqsetup |= 1<<axq_qnum; in ath_txq_setup()
1761 return &sc->tx.txq[axq_qnum]; in ath_txq_setup()
1764 int ath_txq_update(struct ath_softc *sc, int qnum, in ath_txq_update() argument
1767 struct ath_hw *ah = sc->sc_ah; in ath_txq_update()
1771 BUG_ON(sc->tx.txq[qnum].axq_qnum != qnum); in ath_txq_update()
1781 ath_err(ath9k_hw_common(sc->sc_ah), in ath_txq_update()
1791 int ath_cabq_update(struct ath_softc *sc) in ath_cabq_update() argument
1794 struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon; in ath_cabq_update()
1795 int qnum = sc->beacon.cabq->axq_qnum; in ath_cabq_update()
1797 ath9k_hw_get_txq_props(sc->sc_ah, qnum, &qi); in ath_cabq_update()
1801 ath_txq_update(sc, qnum, &qi); in ath_cabq_update()
1806 static void ath_drain_txq_list(struct ath_softc *sc, struct ath_txq *txq, in ath_drain_txq_list() argument
1823 ath_tx_return_buffer(sc, bf); in ath_drain_txq_list()
1829 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); in ath_drain_txq_list()
1839 void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq) in ath_draintxq() argument
1841 ath_txq_lock(sc, txq); in ath_draintxq()
1843 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { in ath_draintxq()
1847 ath_drain_txq_list(sc, txq, &txq->txq_fifo[idx]); in ath_draintxq()
1856 ath_drain_txq_list(sc, txq, &txq->axq_q); in ath_draintxq()
1858 ath_txq_unlock_complete(sc, txq); in ath_draintxq()
1861 bool ath_drain_all_txq(struct ath_softc *sc) in ath_drain_all_txq() argument
1863 struct ath_hw *ah = sc->sc_ah; in ath_drain_all_txq()
1864 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_drain_all_txq()
1876 if (!ATH_TXQ_SETUP(sc, i)) in ath_drain_all_txq()
1879 if (!sc->tx.txq[i].axq_depth) in ath_drain_all_txq()
1882 if (ath9k_hw_numtxpending(ah, sc->tx.txq[i].axq_qnum)) in ath_drain_all_txq()
1890 if (!ATH_TXQ_SETUP(sc, i)) in ath_drain_all_txq()
1898 txq = &sc->tx.txq[i]; in ath_drain_all_txq()
1900 ath_draintxq(sc, txq); in ath_drain_all_txq()
1906 void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq) in ath_tx_cleanupq() argument
1908 ath9k_hw_releasetxqueue(sc->sc_ah, txq->axq_qnum); in ath_tx_cleanupq()
1909 sc->tx.txqsetup &= ~(1<<txq->axq_qnum); in ath_tx_cleanupq()
1915 void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) in ath_txq_schedule() argument
1917 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_txq_schedule()
1929 spin_lock_bh(&sc->chan_lock); in ath_txq_schedule()
1930 ac_list = &sc->cur_chan->acq[txq->mac80211_qnum]; in ath_txq_schedule()
1933 spin_unlock_bh(&sc->chan_lock); in ath_txq_schedule()
1943 if (sc->cur_chan->stopped) in ath_txq_schedule()
1958 if (ath_tx_sched_aggr(sc, txq, tid, &stop)) in ath_txq_schedule()
1966 ath_tx_queue_tid(sc, txq, tid); in ath_txq_schedule()
1991 spin_unlock_bh(&sc->chan_lock); in ath_txq_schedule()
1994 void ath_txq_schedule_all(struct ath_softc *sc) in ath_txq_schedule_all() argument
2000 txq = sc->tx.txq_map[i]; in ath_txq_schedule_all()
2003 ath_txq_schedule(sc, txq); in ath_txq_schedule_all()
2016 static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_txqaddbuf() argument
2019 struct ath_hw *ah = sc->sc_ah; in ath_tx_txqaddbuf()
2065 if (!edma || sc->tx99_state) { in ath_tx_txqaddbuf()
2083 static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_send_normal() argument
2096 ath_tx_addto_baw(sc, tid, bf); in ath_tx_send_normal()
2101 ath_tx_fill_desc(sc, bf, txq, fi->framelen); in ath_tx_send_normal()
2102 ath_tx_txqaddbuf(sc, txq, &bf_head, false); in ath_tx_send_normal()
2141 struct ath_softc *sc = hw->priv; in setup_frame_info() local
2143 txpower = sc->cur_chan->cur_txpower; in setup_frame_info()
2165 u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) in ath_txchainmask_reduction() argument
2167 struct ath_hw *ah = sc->sc_ah; in ath_txchainmask_reduction()
2184 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, in ath_tx_setup_buffer() argument
2189 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_setup_buffer()
2196 bf = ath_tx_get_buffer(sc); in ath_tx_setup_buffer()
2220 bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, in ath_tx_setup_buffer()
2222 if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) { in ath_tx_setup_buffer()
2225 ath_err(ath9k_hw_common(sc->sc_ah), in ath_tx_setup_buffer()
2227 ath_tx_return_buffer(sc, bf); in ath_tx_setup_buffer()
2266 struct ath_softc *sc = hw->priv; in ath_tx_prepare() local
2281 ath_assign_seq(ath9k_hw_common(sc->sc_ah), skb); in ath_tx_prepare()
2314 struct ath_softc *sc = hw->priv; in ath_tx_start() local
2341 ath_txq_lock(sc, txq); in ath_tx_start()
2342 if (txq == sc->tx.txq_map[q]) { in ath_tx_start()
2344 if (++txq->pending_frames > sc->tx.txq_max_pending[q] && in ath_tx_start()
2347 ieee80211_stop_queue(sc->hw, info->hw_queue); in ath_tx_start()
2349 ieee80211_stop_queue(sc->hw, q); in ath_tx_start()
2360 if (((avp && avp->chanctx != sc->cur_chan) || in ath_tx_start()
2361 sc->cur_chan->stopped) && !txctl->force_channel) { in ath_tx_start()
2369 tid = ath_get_skb_tid(sc, txctl->an, skb); in ath_tx_start()
2372 ath_txq_unlock(sc, txq); in ath_tx_start()
2373 txq = sc->tx.uapsdq; in ath_tx_start()
2374 ath_txq_lock(sc, txq); in ath_tx_start()
2388 ath_tx_queue_tid(sc, txq, tid); in ath_tx_start()
2390 ath_txq_schedule(sc, txq); in ath_tx_start()
2394 bf = ath_tx_setup_buffer(sc, txq, tid, skb); in ath_tx_start()
2396 ath_txq_skb_done(sc, txq, skb); in ath_tx_start()
2400 ieee80211_free_txskb(sc->hw, skb); in ath_tx_start()
2410 ath_tx_send_normal(sc, txq, tid, skb); in ath_tx_start()
2413 ath_txq_unlock(sc, txq); in ath_tx_start()
2421 struct ath_softc *sc = hw->priv; in ath_tx_cabq() local
2423 .txq = sc->beacon.cabq in ath_tx_cabq()
2434 sc->cur_chan->beacon.beacon_interval * 1000 * in ath_tx_cabq()
2435 sc->cur_chan->beacon.dtim_period / ATH_BCBUF; in ath_tx_cabq()
2443 bf = ath_tx_setup_buffer(sc, txctl.txq, NULL, skb); in ath_tx_cabq()
2449 ath_buf_set_rate(sc, bf, &info, fi->framelen, false); in ath_tx_cabq()
2475 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, in ath_tx_cabq()
2479 ath_txq_lock(sc, txctl.txq); in ath_tx_cabq()
2480 ath_tx_fill_desc(sc, bf, txctl.txq, 0); in ath_tx_cabq()
2481 ath_tx_txqaddbuf(sc, txctl.txq, &bf_q, false); in ath_tx_cabq()
2483 ath_txq_unlock(sc, txctl.txq); in ath_tx_cabq()
2490 static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, in ath_tx_complete() argument
2494 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_complete()
2501 if (sc->sc_ah->caldata) in ath_tx_complete()
2502 set_bit(PAPRD_PACKET_SENT, &sc->sc_ah->caldata->cal_flags); in ath_tx_complete()
2522 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath_tx_complete()
2523 if ((sc->ps_flags & PS_WAIT_FOR_TX_ACK) && !txq->axq_depth) { in ath_tx_complete()
2524 sc->ps_flags &= ~PS_WAIT_FOR_TX_ACK; in ath_tx_complete()
2527 sc->ps_flags & (PS_WAIT_FOR_BEACON | in ath_tx_complete()
2532 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath_tx_complete()
2535 ath_txq_skb_done(sc, txq, skb); in ath_tx_complete()
2538 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, in ath_tx_complete_buf() argument
2553 dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE); in ath_tx_complete_buf()
2555 if (sc->tx99_state) in ath_tx_complete_buf()
2564 complete(&sc->paprd_complete); in ath_tx_complete_buf()
2566 ath_debug_stat_tx(sc, bf, ts, txq, tx_flags); in ath_tx_complete_buf()
2567 ath_tx_complete(sc, skb, tx_flags, txq); in ath_tx_complete_buf()
2578 spin_lock_irqsave(&sc->tx.txbuflock, flags); in ath_tx_complete_buf()
2579 list_splice_tail_init(bf_q, &sc->tx.txbuf); in ath_tx_complete_buf()
2580 spin_unlock_irqrestore(&sc->tx.txbuflock, flags); in ath_tx_complete_buf()
2583 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, in ath_tx_rc_status() argument
2590 struct ieee80211_hw *hw = sc->hw; in ath_tx_rc_status()
2591 struct ath_hw *ah = sc->sc_ah; in ath_tx_rc_status()
2625 ah->tx_trig_level >= sc->sc_ah->config.max_txtrig_level) in ath_tx_rc_status()
2638 static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) in ath_tx_processq() argument
2640 struct ath_hw *ah = sc->sc_ah; in ath_tx_processq()
2649 txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum), in ath_tx_processq()
2652 ath_txq_lock(sc, txq); in ath_tx_processq()
2659 ath_txq_schedule(sc, txq); in ath_tx_processq()
2705 ath_tx_return_buffer(sc, bf_held); in ath_tx_processq()
2708 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); in ath_tx_processq()
2710 ath_txq_unlock_complete(sc, txq); in ath_tx_processq()
2713 void ath_tx_tasklet(struct ath_softc *sc) in ath_tx_tasklet() argument
2715 struct ath_hw *ah = sc->sc_ah; in ath_tx_tasklet()
2720 if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i))) in ath_tx_tasklet()
2721 ath_tx_processq(sc, &sc->tx.txq[i]); in ath_tx_tasklet()
2725 void ath_tx_edma_tasklet(struct ath_softc *sc) in ath_tx_edma_tasklet() argument
2728 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_edma_tasklet()
2729 struct ath_hw *ah = sc->sc_ah; in ath_tx_edma_tasklet()
2749 if (ts.qid == sc->beacon.beaconq) { in ath_tx_edma_tasklet()
2750 sc->beacon.tx_processed = true; in ath_tx_edma_tasklet()
2751 sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK); in ath_tx_edma_tasklet()
2754 ath_chanctx_event(sc, NULL, in ath_tx_edma_tasklet()
2758 ath9k_csa_update(sc); in ath_tx_edma_tasklet()
2762 txq = &sc->tx.txq[ts.qid]; in ath_tx_edma_tasklet()
2764 ath_txq_lock(sc, txq); in ath_tx_edma_tasklet()
2770 ath_txq_unlock(sc, txq); in ath_tx_edma_tasklet()
2777 ath_tx_return_buffer(sc, bf); in ath_tx_edma_tasklet()
2794 ath_tx_txqaddbuf(sc, txq, &bf_q, true); in ath_tx_edma_tasklet()
2803 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); in ath_tx_edma_tasklet()
2804 ath_txq_unlock_complete(sc, txq); in ath_tx_edma_tasklet()
2812 static int ath_txstatus_setup(struct ath_softc *sc, int size) in ath_txstatus_setup() argument
2814 struct ath_descdma *dd = &sc->txsdma; in ath_txstatus_setup()
2815 u8 txs_len = sc->sc_ah->caps.txs_len; in ath_txstatus_setup()
2818 dd->dd_desc = dmam_alloc_coherent(sc->dev, dd->dd_desc_len, in ath_txstatus_setup()
2826 static int ath_tx_edma_init(struct ath_softc *sc) in ath_tx_edma_init() argument
2830 err = ath_txstatus_setup(sc, ATH_TXSTATUS_RING_SIZE); in ath_tx_edma_init()
2832 ath9k_hw_setup_statusring(sc->sc_ah, sc->txsdma.dd_desc, in ath_tx_edma_init()
2833 sc->txsdma.dd_desc_paddr, in ath_tx_edma_init()
2839 int ath_tx_init(struct ath_softc *sc, int nbufs) in ath_tx_init() argument
2841 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_init()
2844 spin_lock_init(&sc->tx.txbuflock); in ath_tx_init()
2846 error = ath_descdma_setup(sc, &sc->tx.txdma, &sc->tx.txbuf, in ath_tx_init()
2854 error = ath_descdma_setup(sc, &sc->beacon.bdma, &sc->beacon.bbuf, in ath_tx_init()
2862 INIT_DELAYED_WORK(&sc->tx_complete_work, ath_tx_complete_poll_work); in ath_tx_init()
2864 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) in ath_tx_init()
2865 error = ath_tx_edma_init(sc); in ath_tx_init()
2870 void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an) in ath_tx_node_init() argument
2896 ac->txq = sc->tx.txq_map[acno]; in ath_tx_node_init()
2901 void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an) in ath_tx_node_cleanup() argument
2914 ath_txq_lock(sc, txq); in ath_tx_node_cleanup()
2926 ath_tid_drain(sc, txq, tid); in ath_tx_node_cleanup()
2929 ath_txq_unlock(sc, txq); in ath_tx_node_cleanup()
2935 int ath9k_tx99_send(struct ath_softc *sc, struct sk_buff *skb, in ath9k_tx99_send() argument
2940 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_tx99_send()
2962 bf = ath_tx_setup_buffer(sc, txctl->txq, NULL, skb); in ath9k_tx99_send()
2968 ath_set_rates(sc->tx99_vif, NULL, bf); in ath9k_tx99_send()
2970 ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr); in ath9k_tx99_send()
2971 ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum); in ath9k_tx99_send()
2973 ath_tx_send_normal(sc, txctl->txq, NULL, skb); in ath9k_tx99_send()