Lines Matching refs:bf

61 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
67 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
71 struct ath_buf *bf);
163 static bool ath_merge_ratetbl(struct ieee80211_sta *sta, struct ath_buf *bf,
181 bf->rates[0] = tx_info->control.rates[0];
186 bf->rates[i].idx = ratetbl->rate[i].idx;
187 bf->rates[i].flags = ratetbl->rate[i].flags;
189 bf->rates[i].count = ratetbl->rate[i].count_rts;
191 bf->rates[i].count = ratetbl->rate[i].count_cts;
193 bf->rates[i].count = ratetbl->rate[i].count;
200 struct ath_buf *bf)
204 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
206 if (!ath_merge_ratetbl(sta, bf, tx_info))
207 ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
208 ARRAY_SIZE(bf->rates));
283 struct ath_buf *bf;
295 bf = fi->bf;
296 if (!bf) {
303 ath_tx_update_baw(sc, tid, bf);
307 list_add_tail(&bf->list, &bf_head);
308 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
319 struct ath_buf *bf)
321 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
322 u16 seqno = bf->bf_state.seqno;
342 struct ath_buf *bf)
344 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
345 u16 seqno = bf->bf_state.seqno;
368 struct ath_buf *bf;
379 bf = fi->bf;
381 if (!bf) {
386 list_add_tail(&bf->list, &bf_head);
387 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
395 struct ath_buf *bf = fi->bf;
407 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
413 struct ath_buf *bf = NULL;
422 bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
423 list_del(&bf->list);
427 return bf;
430 static void ath_tx_return_buffer(struct ath_softc *sc, struct ath_buf *bf)
433 list_add_tail(&bf->list, &sc->tx.txbuf);
437 static struct ath_buf* ath_clone_txbuf(struct ath_softc *sc, struct ath_buf *bf)
447 tbf->bf_mpdu = bf->bf_mpdu;
448 tbf->bf_buf_addr = bf->bf_buf_addr;
449 memcpy(tbf->bf_desc, bf->bf_desc, sc->sc_ah->caps.tx_desc_len);
450 tbf->bf_state = bf->bf_state;
456 static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf,
468 isaggr = bf_isaggr(bf);
476 while (bf) {
477 ba_index = ATH_BA_INDEX(seq_st, bf->bf_state.seqno);
483 bf = bf->bf_next;
489 struct ath_buf *bf, struct list_head *bf_q,
497 struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
511 skb = bf->bf_mpdu;
514 memcpy(rates, bf->rates, sizeof(rates));
522 while (bf) {
523 bf_next = bf->bf_next;
525 if (!bf->bf_state.stale || bf_next != NULL)
526 list_move_tail(&bf->list, &bf_head);
528 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, ts, 0);
530 bf = bf_next;
550 isaggr = bf_isaggr(bf);
572 ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad);
573 while (bf) {
574 u16 seqno = bf->bf_state.seqno;
577 bf_next = bf->bf_next;
579 skb = bf->bf_mpdu;
601 ath_tx_set_retry(sc, txq, bf->bf_mpdu,
618 list_move_tail(&bf->list, &bf_head);
625 ath_tx_update_baw(sc, tid, bf);
629 ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok);
631 if (bf == bf->bf_lastbf)
633 bf->bf_mpdu,
637 ath_tx_complete_buf(sc, bf, txq, &bf_head, sta, ts,
645 if (bf->bf_next == NULL && bf_last->bf_state.stale) {
655 ath_tx_update_baw(sc, tid, bf);
657 ath_tx_complete_buf(sc, bf, txq,
665 fi->bf = tbf;
675 bf = bf_next;
706 static bool bf_is_ampdu_not_probing(struct ath_buf *bf)
708 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
709 return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
714 struct ath_buf *bf,
723 int rate_dur = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc, i);
724 airtime += rate_dur * bf->rates[i].count;
731 struct ath_tx_status *ts, struct ath_buf *bf,
746 if (bf_is_ampdu_not_probing(bf))
749 ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc,
752 hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
756 tid = ath_get_skb_tid(sc, an, bf->bf_mpdu);
757 ath_tx_count_airtime(sc, sta, bf, ts, tid->tidno);
762 if (!bf_isampdu(bf)) {
764 info = IEEE80211_SKB_CB(bf->bf_mpdu);
765 memcpy(info->control.rates, bf->rates,
767 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
768 ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts,
771 ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok);
773 ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, tid, ts, txok);
779 static bool ath_lookup_legacy(struct ath_buf *bf)
786 skb = bf->bf_mpdu;
801 static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf,
812 skb = bf->bf_mpdu;
814 rates = bf->rates;
873 struct ath_buf *bf, u16 frmlen,
881 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
917 rix = bf->rates[0].idx;
918 flags = bf->rates[0].flags;
948 struct ath_buf *bf;
959 bf = fi->bf;
960 if (!fi->bf)
961 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
963 bf->bf_state.stale = false;
965 if (!bf) {
971 bf->bf_next = NULL;
972 bf->bf_lastbf = bf;
987 bf->bf_state.bf_type = 0;
991 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
992 seqno = bf->bf_state.seqno;
1015 list_add(&bf->list, &bf_head);
1016 ath_tx_update_baw(sc, tid, bf);
1017 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
1021 if (bf_isampdu(bf))
1022 ath_tx_addto_baw(sc, tid, bf);
1027 *buf = bf;
1037 struct ath_buf *bf = bf_first, *bf_prev = NULL;
1046 bf = bf_first;
1047 aggr_limit = ath_lookup_rate(sc, bf, tid);
1049 while (bf)
1051 skb = bf->bf_mpdu;
1058 ath_lookup_legacy(bf) || nframes >= h_baw)
1061 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1079 bf->bf_next = NULL;
1082 bf->bf_state.ndelim = ndelim;
1084 list_add_tail(&bf->list, bf_q);
1086 bf_prev->bf_next = bf;
1088 bf_prev = bf;
1090 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1096 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
1098 bf = bf_first;
1099 bf->bf_lastbf = bf_prev;
1101 if (bf == bf_prev) {
1102 al = get_frame_info(bf->bf_mpdu)->framelen;
1103 bf->bf_state.bf_type = BUF_AMPDU;
1179 static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf,
1192 skb = bf->bf_mpdu;
1251 } else if (!bf->bf_state.bfs_paprd) {
1265 static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
1275 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
1280 skb = bf->bf_mpdu;
1282 rates = bf->rates;
1289 for (i = 0; i < ARRAY_SIZE(bf->rates); i++) {
1302 if (bf_isampdu(bf) && !bf_isaggr(bf) &&
1341 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix,
1362 if (bf->bf_state.bfs_paprd)
1372 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix, false,
1377 if (bf_isaggr(bf) && (len > sc->sc_ah->caps.rts_aggr_limit))
1408 static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf,
1422 while (bf) {
1423 struct sk_buff *skb = bf->bf_mpdu;
1426 bool aggr = !!(bf->bf_state.bf_type & BUF_AGGR);
1429 if (bf->bf_next)
1430 info.link = bf->bf_next->bf_daddr;
1432 info.link = (sc->tx99_state) ? bf->bf_daddr : 0;
1435 bf_first = bf;
1448 if (bf->bf_state.bfs_paprd)
1449 info.flags |= (u32) bf->bf_state.bfs_paprd <<
1459 if (aggr && (bf == bf_first) &&
1471 ath_buf_set_rate(sc, bf, &info, len, rts);
1474 info.buf_addr[0] = bf->bf_buf_addr;
1481 if (bf == bf_first)
1483 else if (bf == bf_first->bf_lastbf)
1488 info.ndelim = bf->bf_state.ndelim;
1492 if (bf == bf_first->bf_lastbf)
1495 ath9k_hw_set_txdesc(ah, bf->bf_desc, &info);
1496 bf = bf->bf_next;
1505 struct ath_buf *bf = bf_first, *bf_prev = NULL;
1512 list_add_tail(&bf->list, bf_q);
1514 bf_prev->bf_next = bf;
1515 bf_prev = bf;
1520 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1524 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1526 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
1530 ath_set_rates(tid->an->vif, tid->an->sta, bf);
1537 struct ath_buf *bf = NULL;
1545 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1549 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1553 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
1557 ath_set_rates(tid->an->vif, tid->an->sta, bf);
1559 aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf);
1561 ath_tx_form_burst(sc, txq, tid, &bf_q, bf);
1571 ath_tx_fill_desc(sc, bf, txq, aggr_len);
1675 ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val)
1681 hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
1684 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
1700 struct ath_buf *bf_tail = NULL, *bf = NULL;
1715 tid, &bf);
1719 ath9k_set_moredata(sc, bf, true);
1720 list_add_tail(&bf->list, &bf_q);
1721 ath_set_rates(tid->an->vif, tid->an->sta, bf);
1722 if (bf_isampdu(bf))
1723 bf->bf_state.bf_type &= ~BUF_AGGR;
1725 bf_tail->bf_next = bf;
1727 bf_tail = bf;
1746 bf = list_first_entry(&bf_q, struct ath_buf, list);
1748 ath_tx_fill_desc(sc, bf, txq, 0);
1874 struct ath_buf *bf, *lastbf;
1883 bf = list_first_entry(list, struct ath_buf, list);
1885 if (bf->bf_state.stale) {
1886 list_del(&bf->list);
1888 ath_tx_return_buffer(sc, bf);
1892 lastbf = bf->bf_lastbf;
1894 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
2045 struct ath_buf *bf, *bf_last;
2058 bf = list_first_entry(head, struct ath_buf, list);
2072 ath9k_hw_set_desc_link(ah, txq->axq_link, bf->bf_daddr);
2075 ito64(bf->bf_daddr), bf->bf_desc);
2084 ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
2086 txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
2095 while (bf) {
2097 if (bf_is_ampdu_not_probing(bf))
2100 bf_last = bf->bf_lastbf;
2101 bf = bf_last->bf_next;
2113 struct ath_buf *bf = fi->bf;
2116 list_add_tail(&bf->list, &bf_head);
2117 bf->bf_state.bf_type = 0;
2119 bf->bf_state.bf_type = BUF_AMPDU;
2120 ath_tx_addto_baw(sc, tid, bf);
2123 bf->bf_next = NULL;
2124 bf->bf_lastbf = bf;
2125 ath_tx_fill_desc(sc, bf, txq, fi->framelen);
2220 struct ath_buf *bf;
2224 bf = ath_tx_get_buffer(sc);
2225 if (!bf) {
2230 ATH_TXBUF_RESET(bf);
2243 bf->bf_state.seqno = seqno;
2246 bf->bf_mpdu = skb;
2248 bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
2250 if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) {
2251 bf->bf_mpdu = NULL;
2252 bf->bf_buf_addr = 0;
2255 ath_tx_return_buffer(sc, bf);
2259 fi->bf = bf;
2261 return bf;
2344 struct ath_buf *bf;
2375 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
2376 if (!bf) {
2385 bf->bf_state.bfs_paprd = txctl->paprd;
2388 bf->bf_state.bfs_paprd_timestamp = jiffies;
2390 ath_set_rates(vif, sta, bf);
2408 struct ath_buf *bf;
2423 bf = ath_tx_setup_buffer(sc, txctl.txq, NULL, skb);
2424 if (!bf)
2427 bf->bf_lastbf = bf;
2428 ath_set_rates(vif, NULL, bf);
2429 ath_buf_set_rate(sc, bf, &info, fi->framelen, false);
2432 bf_tail->bf_next = bf;
2434 list_add_tail(&bf->list, &bf_q);
2435 bf_tail = bf;
2450 bf = list_last_entry(&bf_q, struct ath_buf, list);
2451 ath9k_set_moredata(sc, bf, false);
2453 bf = list_first_entry(&bf_q, struct ath_buf, list);
2455 ath_tx_fill_desc(sc, bf, txctl.txq, 0);
2517 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
2522 struct sk_buff *skb = bf->bf_mpdu;
2533 dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE);
2534 bf->bf_buf_addr = 0;
2538 if (bf->bf_state.bfs_paprd) {
2540 bf->bf_state.bfs_paprd_timestamp +
2546 ath_debug_stat_tx(sc, bf, ts, txq, tx_flags);
2550 /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
2553 bf->bf_mpdu = NULL;
2573 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
2577 struct sk_buff *skb = bf->bf_mpdu;
2634 struct ath_buf *bf, *lastbf, *bf_held = NULL;
2654 bf = list_first_entry(&txq->axq_q, struct ath_buf, list);
2665 if (bf->bf_state.stale) {
2666 bf_held = bf;
2670 bf = list_entry(bf_held->list.next, struct ath_buf,
2674 lastbf = bf->bf_lastbf;
2700 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
2725 struct ath_buf *bf, *lastbf;
2769 bf = list_first_entry(fifo_list, struct ath_buf, list);
2770 if (bf->bf_state.stale) {
2771 list_del(&bf->list);
2772 ath_tx_return_buffer(sc, bf);
2773 bf = list_first_entry(fifo_list, struct ath_buf, list);
2776 lastbf = bf->bf_lastbf;
2793 if (bf != lastbf)
2798 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
2925 struct ath_buf *bf;
2946 bf = ath_tx_setup_buffer(sc, txctl->txq, NULL, skb);
2947 if (!bf) {
2952 ath_set_rates(sc->tx99_vif, NULL, bf);
2954 ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);