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,
55 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
59 static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
61 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
64 static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
66 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
101 void ath_txq_unlock_complete(struct ath_softc *sc, struct ath_txq *txq) in ath_txq_unlock_complete() argument
104 struct ieee80211_hw *hw = sc->hw; in ath_txq_unlock_complete()
116 void ath_tx_queue_tid(struct ath_softc *sc, struct ath_atx_tid *tid) in ath_tx_queue_tid() argument
121 ieee80211_schedule_txq(sc->hw, queue); in ath_tx_queue_tid()
126 struct ath_softc *sc = hw->priv; in ath9k_wake_tx_queue() local
127 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_wake_tx_queue()
135 ath_txq_lock(sc, txq); in ath9k_wake_tx_queue()
136 ath_txq_schedule(sc, txq); in ath9k_wake_tx_queue()
137 ath_txq_unlock(sc, txq); in ath9k_wake_tx_queue()
164 static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, in ath_txq_skb_done() argument
173 txq = sc->tx.txq_map[q]; in ath_txq_skb_done()
180 ath_get_skb_tid(struct ath_softc *sc, struct ath_node *an, struct sk_buff *skb) in ath_get_skb_tid() argument
190 struct ath_softc *sc = tid->an->sc; in ath_tid_pull() local
191 struct ieee80211_hw *hw = sc->hw; in ath_tid_pull()
211 if (tid->txq == sc->tx.txq_map[q]) { in ath_tid_pull()
232 static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) in ath_tx_flush_tid() argument
250 ath_txq_skb_done(sc, txq, skb); in ath_tx_flush_tid()
251 ieee80211_free_txskb(sc->hw, skb); in ath_tx_flush_tid()
256 ath_tx_update_baw(sc, tid, bf); in ath_tx_flush_tid()
261 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0); in ath_tx_flush_tid()
265 ath_txq_unlock(sc, txq); in ath_tx_flush_tid()
267 ath_txq_lock(sc, txq); in ath_tx_flush_tid()
271 static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, in ath_tx_update_baw() argument
294 static void ath_tx_addto_baw(struct ath_softc *sc, struct ath_atx_tid *tid, in ath_tx_addto_baw() argument
316 static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq, in ath_tid_drain() argument
335 ath_tx_complete(sc, skb, ATH_TX_ERROR, txq, NULL); in ath_tid_drain()
340 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0); in ath_tid_drain()
344 static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_set_retry() argument
352 TX_STAT_INC(sc, txq->axq_qnum, a_retries); in ath_tx_set_retry()
360 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, in ath_tx_set_retry()
364 static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc) in ath_tx_get_buffer() argument
368 spin_lock_bh(&sc->tx.txbuflock); in ath_tx_get_buffer()
370 if (unlikely(list_empty(&sc->tx.txbuf))) { in ath_tx_get_buffer()
371 spin_unlock_bh(&sc->tx.txbuflock); in ath_tx_get_buffer()
375 bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); in ath_tx_get_buffer()
378 spin_unlock_bh(&sc->tx.txbuflock); in ath_tx_get_buffer()
383 static void ath_tx_return_buffer(struct ath_softc *sc, struct ath_buf *bf) in ath_tx_return_buffer() argument
385 spin_lock_bh(&sc->tx.txbuflock); in ath_tx_return_buffer()
386 list_add_tail(&bf->list, &sc->tx.txbuf); in ath_tx_return_buffer()
387 spin_unlock_bh(&sc->tx.txbuflock); in ath_tx_return_buffer()
390 static struct ath_buf* ath_clone_txbuf(struct ath_softc *sc, struct ath_buf *bf) in ath_clone_txbuf() argument
394 tbf = ath_tx_get_buffer(sc); in ath_clone_txbuf()
402 memcpy(tbf->bf_desc, bf->bf_desc, sc->sc_ah->caps.tx_desc_len); in ath_clone_txbuf()
409 static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf, in ath_tx_count_frames() argument
439 static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_complete_aggr() argument
479 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, ts, 0); in ath_tx_complete_aggr()
516 if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) in ath_tx_complete_aggr()
523 ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad); in ath_tx_complete_aggr()
552 ath_tx_set_retry(sc, txq, bf->bf_mpdu, in ath_tx_complete_aggr()
576 ath_tx_update_baw(sc, tid, bf); in ath_tx_complete_aggr()
580 ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok); in ath_tx_complete_aggr()
583 ath_dynack_sample_tx_ts(sc->sc_ah, in ath_tx_complete_aggr()
588 ath_tx_complete_buf(sc, bf, txq, &bf_head, sta, ts, in ath_tx_complete_aggr()
599 tbf = ath_clone_txbuf(sc, bf_last); in ath_tx_complete_aggr()
606 ath_tx_update_baw(sc, tid, bf); in ath_tx_complete_aggr()
608 ath_tx_complete_buf(sc, bf, txq, in ath_tx_complete_aggr()
636 ath_tx_queue_tid(sc, tid); in ath_tx_complete_aggr()
648 ath_txq_unlock(sc, txq); in ath_tx_complete_aggr()
650 ath_txq_lock(sc, txq); in ath_tx_complete_aggr()
654 ath9k_queue_reset(sc, RESET_TYPE_TX_ERROR); in ath_tx_complete_aggr()
663 static void ath_tx_count_airtime(struct ath_softc *sc, in ath_tx_count_airtime() argument
674 int rate_dur = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc, i); in ath_tx_count_airtime()
681 static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_process_buffer() argument
685 struct ieee80211_hw *hw = sc->hw; in ath_tx_process_buffer()
700 ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc, in ath_tx_process_buffer()
707 tid = ath_get_skb_tid(sc, an, bf->bf_mpdu); in ath_tx_process_buffer()
708 ath_tx_count_airtime(sc, sta, bf, ts, tid->tidno); in ath_tx_process_buffer()
718 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); in ath_tx_process_buffer()
719 ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts, in ath_tx_process_buffer()
722 ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok); in ath_tx_process_buffer()
724 ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, tid, ts, txok); in ath_tx_process_buffer()
727 ath_txq_schedule(sc, txq); in ath_tx_process_buffer()
752 static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf, in ath_lookup_rate() argument
792 frmlen = sc->tx.max_aggr_framelen[q][modeidx][rates[i].idx]; in ath_lookup_rate()
809 bt_aggr_limit = ath9k_btcoex_aggr_limit(sc, max_4ms_framelen); in ath_lookup_rate()
823 static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid, in ath_compute_num_delims() argument
844 !(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA)) in ath_compute_num_delims()
851 if (first_subfrm && !AR_SREV_9580_10_OR_LATER(sc->sc_ah) && in ath_compute_num_delims()
852 (sc->sc_ah->ent_mode & AR_ENT_OTP_MIN_PKT_SIZE_DISABLE)) in ath_compute_num_delims()
894 ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_get_tid_subframe() argument
912 bf = ath_tx_setup_buffer(sc, txq, tid, skb); in ath_tx_get_tid_subframe()
917 ath_txq_skb_done(sc, txq, skb); in ath_tx_get_tid_subframe()
918 ieee80211_free_txskb(sc->hw, skb); in ath_tx_get_tid_subframe()
967 ath_tx_update_baw(sc, tid, bf); in ath_tx_get_tid_subframe()
968 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0); in ath_tx_get_tid_subframe()
973 ath_tx_addto_baw(sc, tid, bf); in ath_tx_get_tid_subframe()
983 ath_tx_form_aggr(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_form_aggr() argument
998 aggr_limit = ath_lookup_rate(sc, bf, tid); in ath_tx_form_aggr()
1025 ndelim = ath_compute_num_delims(sc, tid, bf_first, fi->framelen, in ath_tx_form_aggr()
1041 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf); in ath_tx_form_aggr()
1056 TX_STAT_INC(sc, txq->axq_qnum, a_aggr); in ath_tx_form_aggr()
1069 u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, int pktlen, in ath_pkt_duration() argument
1109 void ath_update_max_aggr_framelen(struct ath_softc *sc, int queue, int txop) in ath_update_max_aggr_framelen() argument
1118 cur_ht20 = sc->tx.max_aggr_framelen[queue][MCS_HT20]; in ath_update_max_aggr_framelen()
1119 cur_ht20_sgi = sc->tx.max_aggr_framelen[queue][MCS_HT20_SGI]; in ath_update_max_aggr_framelen()
1120 cur_ht40 = sc->tx.max_aggr_framelen[queue][MCS_HT40]; in ath_update_max_aggr_framelen()
1121 cur_ht40_sgi = sc->tx.max_aggr_framelen[queue][MCS_HT40_SGI]; in ath_update_max_aggr_framelen()
1130 static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf, in ath_get_rate_txpower() argument
1137 struct ath_hw *ah = sc->sc_ah; in ath_get_rate_txpower()
1139 if (sc->tx99_state || !ah->tpc_enabled) in ath_get_rate_txpower()
1204 static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, in ath_buf_set_rate() argument
1207 struct ath_hw *ah = sc->sc_ah; in ath_buf_set_rate()
1215 u32 rts_thresh = sc->hw->wiphy->rts_threshold; in ath_buf_set_rate()
1268 info->rates[i].ChSel = ath_txchainmask_reduction(sc, in ath_buf_set_rate()
1270 info->rates[i].PktDuration = ath_pkt_duration(sc, rix, len, in ath_buf_set_rate()
1280 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix, in ath_buf_set_rate()
1304 info->rates[i].ChSel = ath_txchainmask_reduction(sc, in ath_buf_set_rate()
1307 info->rates[i].PktDuration = ath9k_hw_computetxtime(sc->sc_ah, in ath_buf_set_rate()
1311 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix, false, in ath_buf_set_rate()
1316 if (bf_isaggr(bf) && (len > sc->sc_ah->caps.rts_aggr_limit)) in ath_buf_set_rate()
1347 static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf, in ath_tx_fill_desc() argument
1350 struct ath_hw *ah = sc->sc_ah; in ath_tx_fill_desc()
1353 u32 rts_thresh = sc->hw->wiphy->rts_threshold; in ath_tx_fill_desc()
1371 info.link = (sc->tx99_state) ? bf->bf_daddr : 0; in ath_tx_fill_desc()
1376 if (!sc->tx99_state) in ath_tx_fill_desc()
1379 txq == sc->tx.uapsdq) in ath_tx_fill_desc()
1410 ath_buf_set_rate(sc, bf, &info, len, rts); in ath_tx_fill_desc()
1440 ath_tx_form_burst(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_form_burst() argument
1459 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf); in ath_tx_form_burst()
1473 static int ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_sched_aggr() argument
1484 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf); in ath_tx_sched_aggr()
1498 aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf); in ath_tx_sched_aggr()
1500 ath_tx_form_burst(sc, txq, tid, &bf_q, bf); in ath_tx_sched_aggr()
1510 ath_tx_fill_desc(sc, bf, txq, aggr_len); in ath_tx_sched_aggr()
1511 ath_tx_txqaddbuf(sc, txq, &bf_q, false); in ath_tx_sched_aggr()
1515 int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, in ath_tx_aggr_start() argument
1518 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_aggr_start()
1530 ath_txq_lock(sc, txq); in ath_tx_aggr_start()
1550 ath_txq_unlock_complete(sc, txq); in ath_tx_aggr_start()
1555 void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) in ath_tx_aggr_stop() argument
1557 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_aggr_stop()
1564 ath_txq_lock(sc, txq); in ath_tx_aggr_stop()
1566 ath_tx_flush_tid(sc, txtid); in ath_tx_aggr_stop()
1567 ath_txq_unlock_complete(sc, txq); in ath_tx_aggr_stop()
1570 void ath_tx_aggr_sleep(struct ieee80211_sta *sta, struct ath_softc *sc, in ath_tx_aggr_sleep() argument
1573 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_aggr_sleep()
1588 void ath_tx_aggr_wakeup(struct ath_softc *sc, struct ath_node *an) in ath_tx_aggr_wakeup() argument
1590 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_aggr_wakeup()
1601 ath_txq_lock(sc, txq); in ath_tx_aggr_wakeup()
1604 ath_tx_queue_tid(sc, tid); in ath_tx_aggr_wakeup()
1605 ath_txq_schedule(sc, txq); in ath_tx_aggr_wakeup()
1607 ath_txq_unlock_complete(sc, txq); in ath_tx_aggr_wakeup()
1614 ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val) in ath9k_set_moredata() argument
1623 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr, in ath9k_set_moredata()
1634 struct ath_softc *sc = hw->priv; in ath9k_release_buffered_frames() local
1636 struct ath_txq *txq = sc->tx.uapsdq; in ath9k_release_buffered_frames()
1652 ath_txq_lock(sc, tid->txq); in ath9k_release_buffered_frames()
1654 ret = ath_tx_get_tid_subframe(sc, sc->tx.uapsdq, in ath9k_release_buffered_frames()
1659 ath9k_set_moredata(sc, bf, true); in ath9k_release_buffered_frames()
1670 TX_STAT_INC(sc, txq->axq_qnum, a_queued_hw); in ath9k_release_buffered_frames()
1675 ath_txq_unlock_complete(sc, tid->txq); in ath9k_release_buffered_frames()
1682 ath9k_set_moredata(sc, bf_tail, false); in ath9k_release_buffered_frames()
1688 ath_txq_lock(sc, txq); in ath9k_release_buffered_frames()
1689 ath_tx_fill_desc(sc, bf, txq, 0); in ath9k_release_buffered_frames()
1690 ath_tx_txqaddbuf(sc, txq, &bf_q, false); in ath9k_release_buffered_frames()
1691 ath_txq_unlock(sc, txq); in ath9k_release_buffered_frames()
1698 struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype) in ath_txq_setup() argument
1700 struct ath_hw *ah = sc->sc_ah; in ath_txq_setup()
1749 if (!ATH_TXQ_SETUP(sc, axq_qnum)) { in ath_txq_setup()
1750 struct ath_txq *txq = &sc->tx.txq[axq_qnum]; in ath_txq_setup()
1761 sc->tx.txqsetup |= 1<<axq_qnum; in ath_txq_setup()
1767 return &sc->tx.txq[axq_qnum]; in ath_txq_setup()
1770 int ath_txq_update(struct ath_softc *sc, int qnum, in ath_txq_update() argument
1773 struct ath_hw *ah = sc->sc_ah; in ath_txq_update()
1777 BUG_ON(sc->tx.txq[qnum].axq_qnum != qnum); in ath_txq_update()
1787 ath_err(ath9k_hw_common(sc->sc_ah), in ath_txq_update()
1797 int ath_cabq_update(struct ath_softc *sc) in ath_cabq_update() argument
1800 struct ath_beacon_config *cur_conf = &sc->cur_chan->beacon; in ath_cabq_update()
1801 int qnum = sc->beacon.cabq->axq_qnum; in ath_cabq_update()
1803 ath9k_hw_get_txq_props(sc->sc_ah, qnum, &qi); in ath_cabq_update()
1807 ath_txq_update(sc, qnum, &qi); in ath_cabq_update()
1812 static void ath_drain_txq_list(struct ath_softc *sc, struct ath_txq *txq, in ath_drain_txq_list() argument
1829 ath_tx_return_buffer(sc, bf); in ath_drain_txq_list()
1835 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); in ath_drain_txq_list()
1845 void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq) in ath_draintxq() argument
1848 ath_txq_lock(sc, txq); in ath_draintxq()
1850 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { in ath_draintxq()
1854 ath_drain_txq_list(sc, txq, &txq->txq_fifo[idx]); in ath_draintxq()
1863 ath_drain_txq_list(sc, txq, &txq->axq_q); in ath_draintxq()
1865 ath_txq_unlock_complete(sc, txq); in ath_draintxq()
1869 bool ath_drain_all_txq(struct ath_softc *sc) in ath_drain_all_txq() argument
1871 struct ath_hw *ah = sc->sc_ah; in ath_drain_all_txq()
1872 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_drain_all_txq()
1884 if (!ATH_TXQ_SETUP(sc, i)) in ath_drain_all_txq()
1887 if (!sc->tx.txq[i].axq_depth) in ath_drain_all_txq()
1890 if (ath9k_hw_numtxpending(ah, sc->tx.txq[i].axq_qnum)) in ath_drain_all_txq()
1895 RESET_STAT_INC(sc, RESET_TX_DMA_ERROR); in ath_drain_all_txq()
1901 if (!ATH_TXQ_SETUP(sc, i)) in ath_drain_all_txq()
1904 txq = &sc->tx.txq[i]; in ath_drain_all_txq()
1905 ath_draintxq(sc, txq); in ath_drain_all_txq()
1911 void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq) in ath_tx_cleanupq() argument
1913 ath9k_hw_releasetxqueue(sc->sc_ah, txq->axq_qnum); in ath_tx_cleanupq()
1914 sc->tx.txqsetup &= ~(1<<txq->axq_qnum); in ath_tx_cleanupq()
1920 void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq) in ath_txq_schedule() argument
1922 struct ieee80211_hw *hw = sc->hw; in ath_txq_schedule()
1923 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_txq_schedule()
1935 spin_lock_bh(&sc->chan_lock); in ath_txq_schedule()
1938 if (sc->cur_chan->stopped) in ath_txq_schedule()
1946 ret = ath_tx_sched_aggr(sc, txq, tid); in ath_txq_schedule()
1955 spin_unlock_bh(&sc->chan_lock); in ath_txq_schedule()
1959 void ath_txq_schedule_all(struct ath_softc *sc) in ath_txq_schedule_all() argument
1965 txq = sc->tx.txq_map[i]; in ath_txq_schedule_all()
1968 ath_txq_schedule(sc, txq); in ath_txq_schedule_all()
1981 static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_txqaddbuf() argument
1984 struct ath_hw *ah = sc->sc_ah; in ath_tx_txqaddbuf()
2024 TX_STAT_INC(sc, txq->axq_qnum, puttxbuf); in ath_tx_txqaddbuf()
2030 if (!edma || sc->tx99_state) { in ath_tx_txqaddbuf()
2031 TX_STAT_INC(sc, txq->axq_qnum, txstart); in ath_tx_txqaddbuf()
2048 static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, in ath_tx_send_normal() argument
2061 ath_tx_addto_baw(sc, tid, bf); in ath_tx_send_normal()
2066 ath_tx_fill_desc(sc, bf, txq, fi->framelen); in ath_tx_send_normal()
2067 ath_tx_txqaddbuf(sc, txq, &bf_head, false); in ath_tx_send_normal()
2068 TX_STAT_INC(sc, txq->axq_qnum, queued); in ath_tx_send_normal()
2107 struct ath_softc *sc; in setup_frame_info() local
2109 sc = hw->priv; in setup_frame_info()
2111 txpower = sc->cur_chan->cur_txpower; in setup_frame_info()
2134 u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) in ath_txchainmask_reduction() argument
2136 struct ath_hw *ah = sc->sc_ah; in ath_txchainmask_reduction()
2153 static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, in ath_tx_setup_buffer() argument
2158 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_setup_buffer()
2165 bf = ath_tx_get_buffer(sc); in ath_tx_setup_buffer()
2189 bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, in ath_tx_setup_buffer()
2191 if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) { in ath_tx_setup_buffer()
2194 ath_err(ath9k_hw_common(sc->sc_ah), in ath_tx_setup_buffer()
2196 ath_tx_return_buffer(sc, bf); in ath_tx_setup_buffer()
2235 struct ath_softc *sc = hw->priv; in ath_tx_prepare() local
2250 ath_assign_seq(ath9k_hw_common(sc->sc_ah), skb); in ath_tx_prepare()
2281 struct ath_softc *sc = hw->priv; in ath_tx_start() local
2303 txq = sc->tx.uapsdq; in ath_tx_start()
2307 tid = ath_get_skb_tid(sc, an, skb); in ath_tx_start()
2310 ath_txq_lock(sc, txq); in ath_tx_start()
2311 if (txq == sc->tx.txq_map[q]) { in ath_tx_start()
2316 bf = ath_tx_setup_buffer(sc, txq, tid, skb); in ath_tx_start()
2318 ath_txq_skb_done(sc, txq, skb); in ath_tx_start()
2322 ieee80211_free_txskb(sc->hw, skb); in ath_tx_start()
2332 ath_tx_send_normal(sc, txq, tid, skb); in ath_tx_start()
2335 ath_txq_unlock(sc, txq); in ath_tx_start()
2343 struct ath_softc *sc = hw->priv; in ath_tx_cabq() local
2345 .txq = sc->beacon.cabq in ath_tx_cabq()
2355 sc->cur_chan->beacon.beacon_interval * 1000 * in ath_tx_cabq()
2356 sc->cur_chan->beacon.dtim_period / ATH_BCBUF; in ath_tx_cabq()
2364 bf = ath_tx_setup_buffer(sc, txctl.txq, NULL, skb); in ath_tx_cabq()
2370 ath_buf_set_rate(sc, bf, &info, fi->framelen, false); in ath_tx_cabq()
2392 ath9k_set_moredata(sc, bf, false); in ath_tx_cabq()
2395 ath_txq_lock(sc, txctl.txq); in ath_tx_cabq()
2396 ath_tx_fill_desc(sc, bf, txctl.txq, 0); in ath_tx_cabq()
2397 ath_tx_txqaddbuf(sc, txctl.txq, &bf_q, false); in ath_tx_cabq()
2398 TX_STAT_INC(sc, txctl.txq->axq_qnum, queued); in ath_tx_cabq()
2399 ath_txq_unlock(sc, txctl.txq); in ath_tx_cabq()
2406 static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, in ath_tx_complete() argument
2411 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_complete()
2418 if (sc->sc_ah->caldata) in ath_tx_complete()
2419 set_bit(PAPRD_PACKET_SENT, &sc->sc_ah->caldata->cal_flags); in ath_tx_complete()
2441 spin_lock_irqsave(&sc->sc_pm_lock, flags); in ath_tx_complete()
2442 if ((sc->ps_flags & PS_WAIT_FOR_TX_ACK) && !txq->axq_depth) { in ath_tx_complete()
2443 sc->ps_flags &= ~PS_WAIT_FOR_TX_ACK; in ath_tx_complete()
2446 sc->ps_flags & (PS_WAIT_FOR_BEACON | in ath_tx_complete()
2451 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); in ath_tx_complete()
2453 ath_txq_skb_done(sc, txq, skb); in ath_tx_complete()
2458 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, in ath_tx_complete_buf() argument
2474 dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE); in ath_tx_complete_buf()
2476 if (sc->tx99_state) in ath_tx_complete_buf()
2485 complete(&sc->paprd_complete); in ath_tx_complete_buf()
2487 ath_debug_stat_tx(sc, bf, ts, txq, tx_flags); in ath_tx_complete_buf()
2488 ath_tx_complete(sc, skb, tx_flags, txq, sta); in ath_tx_complete_buf()
2499 spin_lock_irqsave(&sc->tx.txbuflock, flags); in ath_tx_complete_buf()
2500 list_splice_tail_init(bf_q, &sc->tx.txbuf); in ath_tx_complete_buf()
2501 spin_unlock_irqrestore(&sc->tx.txbuflock, flags); in ath_tx_complete_buf()
2514 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, in ath_tx_rc_status() argument
2521 struct ieee80211_hw *hw = sc->hw; in ath_tx_rc_status()
2522 struct ath_hw *ah = sc->sc_ah; in ath_tx_rc_status()
2565 ah->tx_trig_level >= sc->sc_ah->config.max_txtrig_level) in ath_tx_rc_status()
2571 static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) in ath_tx_processq() argument
2573 struct ath_hw *ah = sc->sc_ah; in ath_tx_processq()
2582 txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum), in ath_tx_processq()
2585 ath_txq_lock(sc, txq); in ath_tx_processq()
2592 ath_txq_schedule(sc, txq); in ath_tx_processq()
2623 TX_STAT_INC(sc, txq->axq_qnum, txprocdesc); in ath_tx_processq()
2638 ath_tx_return_buffer(sc, bf_held); in ath_tx_processq()
2641 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); in ath_tx_processq()
2643 ath_txq_unlock_complete(sc, txq); in ath_tx_processq()
2646 void ath_tx_tasklet(struct ath_softc *sc) in ath_tx_tasklet() argument
2648 struct ath_hw *ah = sc->sc_ah; in ath_tx_tasklet()
2654 if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i))) in ath_tx_tasklet()
2655 ath_tx_processq(sc, &sc->tx.txq[i]); in ath_tx_tasklet()
2660 void ath_tx_edma_tasklet(struct ath_softc *sc) in ath_tx_edma_tasklet() argument
2663 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_edma_tasklet()
2664 struct ath_hw *ah = sc->sc_ah; in ath_tx_edma_tasklet()
2685 if (ts.qid == sc->beacon.beaconq) { in ath_tx_edma_tasklet()
2686 sc->beacon.tx_processed = true; in ath_tx_edma_tasklet()
2687 sc->beacon.tx_last = !(ts.ts_status & ATH9K_TXERR_MASK); in ath_tx_edma_tasklet()
2690 ath_chanctx_event(sc, NULL, in ath_tx_edma_tasklet()
2694 ath9k_csa_update(sc); in ath_tx_edma_tasklet()
2698 txq = &sc->tx.txq[ts.qid]; in ath_tx_edma_tasklet()
2700 ath_txq_lock(sc, txq); in ath_tx_edma_tasklet()
2702 TX_STAT_INC(sc, txq->axq_qnum, txprocdesc); in ath_tx_edma_tasklet()
2706 ath_txq_unlock(sc, txq); in ath_tx_edma_tasklet()
2713 ath_tx_return_buffer(sc, bf); in ath_tx_edma_tasklet()
2730 ath_tx_txqaddbuf(sc, txq, &bf_q, true); in ath_tx_edma_tasklet()
2739 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head); in ath_tx_edma_tasklet()
2740 ath_txq_unlock_complete(sc, txq); in ath_tx_edma_tasklet()
2749 static int ath_txstatus_setup(struct ath_softc *sc, int size) in ath_txstatus_setup() argument
2751 struct ath_descdma *dd = &sc->txsdma; in ath_txstatus_setup()
2752 u8 txs_len = sc->sc_ah->caps.txs_len; in ath_txstatus_setup()
2755 dd->dd_desc = dmam_alloc_coherent(sc->dev, dd->dd_desc_len, in ath_txstatus_setup()
2763 static int ath_tx_edma_init(struct ath_softc *sc) in ath_tx_edma_init() argument
2767 err = ath_txstatus_setup(sc, ATH_TXSTATUS_RING_SIZE); in ath_tx_edma_init()
2769 ath9k_hw_setup_statusring(sc->sc_ah, sc->txsdma.dd_desc, in ath_tx_edma_init()
2770 sc->txsdma.dd_desc_paddr, in ath_tx_edma_init()
2776 int ath_tx_init(struct ath_softc *sc, int nbufs) in ath_tx_init() argument
2778 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_tx_init()
2781 spin_lock_init(&sc->tx.txbuflock); in ath_tx_init()
2783 error = ath_descdma_setup(sc, &sc->tx.txdma, &sc->tx.txbuf, in ath_tx_init()
2791 error = ath_descdma_setup(sc, &sc->beacon.bdma, &sc->beacon.bbuf, in ath_tx_init()
2799 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) in ath_tx_init()
2800 error = ath_tx_edma_init(sc); in ath_tx_init()
2805 void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an) in ath_tx_node_init() argument
2822 tid->txq = sc->tx.txq_map[acno]; in ath_tx_node_init()
2829 void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an) in ath_tx_node_cleanup() argument
2841 ath_txq_lock(sc, txq); in ath_tx_node_cleanup()
2846 ath_tid_drain(sc, txq, tid); in ath_tx_node_cleanup()
2849 ath_txq_unlock(sc, txq); in ath_tx_node_cleanup()
2860 int ath9k_tx99_send(struct ath_softc *sc, struct sk_buff *skb, in ath9k_tx99_send() argument
2865 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_tx99_send()
2887 bf = ath_tx_setup_buffer(sc, txctl->txq, NULL, skb); in ath9k_tx99_send()
2893 ath_set_rates(sc->tx99_vif, NULL, bf); in ath9k_tx99_send()
2895 ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr); in ath9k_tx99_send()
2896 ath9k_hw_tx99_start(sc->sc_ah, txctl->txq->axq_qnum); in ath9k_tx99_send()
2898 ath_tx_send_normal(sc, txctl->txq, NULL, skb); in ath9k_tx99_send()