Lines Matching refs:bf

54 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
59 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
190 struct ath_buf *bf;
202 bf = fi->bf;
204 if (bf && fi->retries) {
205 list_add_tail(&bf->list, &bf_head);
206 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
207 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
271 struct ath_buf *bf;
281 bf = fi->bf;
283 if (!bf) {
288 list_add_tail(&bf->list, &bf_head);
291 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
293 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
305 struct ath_buf *bf = fi->bf;
317 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
323 struct ath_buf *bf = NULL;
332 bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
333 list_del(&bf->list);
337 return bf;
340 static void ath_tx_return_buffer(struct ath_softc *sc, struct ath_buf *bf)
343 list_add_tail(&bf->list, &sc->tx.txbuf);
347 static struct ath_buf* ath_clone_txbuf(struct ath_softc *sc, struct ath_buf *bf)
357 tbf->bf_mpdu = bf->bf_mpdu;
358 tbf->bf_buf_addr = bf->bf_buf_addr;
359 memcpy(tbf->bf_desc, bf->bf_desc, sc->sc_ah->caps.tx_desc_len);
360 tbf->bf_state = bf->bf_state;
365 static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf,
378 isaggr = bf_isaggr(bf);
384 while (bf) {
385 fi = get_frame_info(bf->bf_mpdu);
386 ba_index = ATH_BA_INDEX(seq_st, bf->bf_state.seqno);
392 bf = bf->bf_next;
398 struct ath_buf *bf, struct list_head *bf_q,
408 struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
423 skb = bf->bf_mpdu;
441 while (bf) {
442 bf_next = bf->bf_next;
444 if (!bf->bf_stale || bf_next != NULL)
445 list_move_tail(&bf->list, &bf_head);
447 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, 0);
449 bf = bf_next;
467 isaggr = bf_isaggr(bf);
489 ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad);
490 while (bf) {
491 u16 seqno = bf->bf_state.seqno;
494 bf_next = bf->bf_next;
496 skb = bf->bf_mpdu;
517 ath_tx_set_retry(sc, txq, bf->bf_mpdu,
535 list_move_tail(&bf->list, &bf_head);
546 ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok);
550 ath_tx_complete_buf(sc, bf, txq, &bf_head, ts,
555 bf->bf_next == NULL && bf_last->bf_stale) {
567 ath_tx_complete_buf(sc, bf, txq,
574 fi->bf = tbf;
584 bf = bf_next;
623 static bool ath_lookup_legacy(struct ath_buf *bf)
630 skb = bf->bf_mpdu;
645 static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf,
655 skb = bf->bf_mpdu;
722 struct ath_buf *bf, u16 frmlen,
726 struct sk_buff *skb = bf->bf_mpdu;
732 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
800 struct ath_buf *bf, *bf_first = NULL, *bf_prev = NULL;
813 bf = fi->bf;
814 if (!fi->bf)
815 bf = ath_tx_setup_buffer(sc, txq, tid, skb, true);
817 if (!bf)
820 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
821 seqno = bf->bf_state.seqno;
834 list_add(&bf->list, &bf_head);
837 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
842 bf_first = bf;
845 aggr_limit = ath_lookup_rate(sc, bf, tid);
854 ath_lookup_legacy(bf))) {
859 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
881 bf->bf_next = NULL;
886 bf->bf_state.ndelim = ndelim;
889 list_add_tail(&bf->list, bf_q);
891 bf_prev->bf_next = bf;
893 bf_prev = bf;
932 static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
941 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
945 skb = bf->bf_mpdu;
1009 if (bf->bf_state.bfs_paprd)
1020 if (bf_isaggr(bf) && (len > sc->sc_ah->caps.rts_aggr_limit))
1051 static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf,
1055 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1056 struct ath_buf *bf_first = bf;
1058 bool aggr = !!(bf->bf_state.bf_type & BUF_AGGR);
1072 ath_buf_set_rate(sc, bf, &info, len);
1077 if (bf->bf_state.bfs_paprd)
1078 info.flags |= (u32) bf->bf_state.bfs_paprd << ATH9K_TXDESC_PAPRD_S;
1081 while (bf) {
1082 struct sk_buff *skb = bf->bf_mpdu;
1086 if (bf->bf_next)
1087 info.link = bf->bf_next->bf_daddr;
1091 info.buf_addr[0] = bf->bf_buf_addr;
1098 if (bf == bf_first)
1100 else if (!bf->bf_next)
1105 info.ndelim = bf->bf_state.ndelim;
1109 ath9k_hw_set_txdesc(ah, bf->bf_desc, &info);
1110 bf = bf->bf_next;
1117 struct ath_buf *bf;
1138 bf = list_first_entry(&bf_q, struct ath_buf, list);
1139 bf->bf_lastbf = list_entry(bf_q.prev, struct ath_buf, list);
1140 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1150 if (bf == bf->bf_lastbf) {
1151 aggr_len = get_frame_info(bf->bf_mpdu)->framelen;
1152 bf->bf_state.bf_type = BUF_AMPDU;
1157 ath_tx_fill_desc(sc, bf, txq, aggr_len);
1446 static bool bf_is_ampdu_not_probing(struct ath_buf *bf)
1448 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
1449 return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
1455 struct ath_buf *bf, *lastbf;
1464 bf = list_first_entry(list, struct ath_buf, list);
1466 if (bf->bf_stale) {
1467 list_del(&bf->list);
1469 ath_tx_return_buffer(sc, bf);
1473 lastbf = bf->bf_lastbf;
1477 if (bf_is_ampdu_not_probing(bf))
1480 if (bf_isampdu(bf))
1481 ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, 0,
1484 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
1636 struct ath_buf *bf, *bf_last;
1649 bf = list_first_entry(head, struct ath_buf, list);
1663 ath9k_hw_set_desc_link(ah, txq->axq_link, bf->bf_daddr);
1666 ito64(bf->bf_daddr), bf->bf_desc);
1675 ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
1677 txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
1687 if (bf_is_ampdu_not_probing(bf))
1697 struct ath_buf *bf;
1720 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false);
1721 if (!bf)
1724 bf->bf_state.bf_type = BUF_AMPDU;
1726 list_add(&bf->list, &bf_head);
1729 ath_tx_addto_baw(sc, tid, bf->bf_state.seqno);
1733 bf->bf_lastbf = bf;
1734 ath_tx_fill_desc(sc, bf, txctl->txq, fi->framelen);
1743 struct ath_buf *bf;
1745 bf = fi->bf;
1746 if (!bf)
1747 bf = ath_tx_setup_buffer(sc, txq, tid, skb, false);
1749 if (!bf)
1753 list_add_tail(&bf->list, &bf_head);
1754 bf->bf_state.bf_type = 0;
1756 bf->bf_lastbf = bf;
1757 ath_tx_fill_desc(sc, bf, txq, fi->framelen);
1829 struct ath_buf *bf;
1833 bf = ath_tx_get_buffer(sc);
1834 if (!bf) {
1839 ATH_TXBUF_RESET(bf);
1852 bf->bf_state.seqno = seqno;
1855 bf->bf_mpdu = skb;
1857 bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
1859 if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) {
1860 bf->bf_mpdu = NULL;
1861 bf->bf_buf_addr = 0;
1864 ath_tx_return_buffer(sc, bf);
1868 fi->bf = bf;
1870 return bf;
1886 struct ath_buf *bf;
1905 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false);
1906 if (!bf)
1909 bf->bf_state.bfs_paprd = txctl->paprd;
1912 bf->bf_state.bfs_paprd_timestamp = jiffies;
2044 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
2048 struct sk_buff *skb = bf->bf_mpdu;
2059 dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE);
2060 bf->bf_buf_addr = 0;
2062 if (bf->bf_state.bfs_paprd) {
2064 bf->bf_state.bfs_paprd_timestamp +
2070 ath_debug_stat_tx(sc, bf, ts, txq, tx_flags);
2073 /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
2076 bf->bf_mpdu = NULL;
2086 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
2090 struct sk_buff *skb = bf->bf_mpdu;
2142 struct ath_tx_status *ts, struct ath_buf *bf,
2150 if (bf_is_ampdu_not_probing(bf))
2153 if (!bf_isampdu(bf)) {
2154 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
2155 ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok);
2157 ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok, true);
2167 struct ath_buf *bf, *lastbf, *bf_held = NULL;
2188 bf = list_first_entry(&txq->axq_q, struct ath_buf, list);
2199 if (bf->bf_stale) {
2200 bf_held = bf;
2204 bf = list_entry(bf_held->list.next, struct ath_buf,
2208 lastbf = bf->bf_lastbf;
2234 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
2297 struct ath_buf *bf, *lastbf;
2329 bf = list_first_entry(&txq->txq_fifo[txq->txq_tailidx],
2331 lastbf = bf->bf_lastbf;
2350 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);