Lines Matching refs:bf
55 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
61 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
65 struct ath_buf *bf);
158 struct ath_buf *bf)
160 ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
161 ARRAY_SIZE(bf->rates));
236 struct ath_buf *bf;
248 bf = fi->bf;
249 if (!bf) {
256 ath_tx_update_baw(sc, tid, bf);
260 list_add_tail(&bf->list, &bf_head);
261 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
272 struct ath_buf *bf)
274 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
275 u16 seqno = bf->bf_state.seqno;
295 struct ath_buf *bf)
297 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
298 u16 seqno = bf->bf_state.seqno;
321 struct ath_buf *bf;
332 bf = fi->bf;
334 if (!bf) {
339 list_add_tail(&bf->list, &bf_head);
340 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
348 struct ath_buf *bf = fi->bf;
360 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
366 struct ath_buf *bf = NULL;
375 bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
376 list_del(&bf->list);
380 return bf;
383 static void ath_tx_return_buffer(struct ath_softc *sc, struct ath_buf *bf)
386 list_add_tail(&bf->list, &sc->tx.txbuf);
390 static struct ath_buf* ath_clone_txbuf(struct ath_softc *sc, struct ath_buf *bf)
400 tbf->bf_mpdu = bf->bf_mpdu;
401 tbf->bf_buf_addr = bf->bf_buf_addr;
402 memcpy(tbf->bf_desc, bf->bf_desc, sc->sc_ah->caps.tx_desc_len);
403 tbf->bf_state = bf->bf_state;
409 static void ath_tx_count_frames(struct ath_softc *sc, struct ath_buf *bf,
421 isaggr = bf_isaggr(bf);
427 while (bf) {
428 ba_index = ATH_BA_INDEX(seq_st, bf->bf_state.seqno);
434 bf = bf->bf_next;
440 struct ath_buf *bf, struct list_head *bf_q,
448 struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
462 skb = bf->bf_mpdu;
465 memcpy(rates, bf->rates, sizeof(rates));
473 while (bf) {
474 bf_next = bf->bf_next;
476 if (!bf->bf_state.stale || bf_next != NULL)
477 list_move_tail(&bf->list, &bf_head);
479 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, ts, 0);
481 bf = bf_next;
501 isaggr = bf_isaggr(bf);
523 ath_tx_count_frames(sc, bf, ts, txok, &nframes, &nbad);
524 while (bf) {
525 u16 seqno = bf->bf_state.seqno;
528 bf_next = bf->bf_next;
530 skb = bf->bf_mpdu;
552 ath_tx_set_retry(sc, txq, bf->bf_mpdu,
569 list_move_tail(&bf->list, &bf_head);
576 ath_tx_update_baw(sc, tid, bf);
580 ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok);
582 if (bf == bf->bf_lastbf)
584 bf->bf_mpdu,
588 ath_tx_complete_buf(sc, bf, txq, &bf_head, sta, ts,
596 if (bf->bf_next == NULL && bf_last->bf_state.stale) {
606 ath_tx_update_baw(sc, tid, bf);
608 ath_tx_complete_buf(sc, bf, txq,
616 fi->bf = tbf;
626 bf = bf_next;
657 static bool bf_is_ampdu_not_probing(struct ath_buf *bf)
659 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
660 return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
665 struct ath_buf *bf,
674 int rate_dur = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc, i);
675 airtime += rate_dur * bf->rates[i].count;
682 struct ath_tx_status *ts, struct ath_buf *bf,
697 if (bf_is_ampdu_not_probing(bf))
700 ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc,
703 hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
707 tid = ath_get_skb_tid(sc, an, bf->bf_mpdu);
708 ath_tx_count_airtime(sc, sta, bf, ts, tid->tidno);
713 if (!bf_isampdu(bf)) {
715 info = IEEE80211_SKB_CB(bf->bf_mpdu);
716 memcpy(info->control.rates, bf->rates,
718 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
719 ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts,
722 ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok);
724 ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, tid, ts, txok);
730 static bool ath_lookup_legacy(struct ath_buf *bf)
737 skb = bf->bf_mpdu;
752 static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf,
763 skb = bf->bf_mpdu;
765 rates = bf->rates;
824 struct ath_buf *bf, u16 frmlen,
832 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
868 rix = bf->rates[0].idx;
869 flags = bf->rates[0].flags;
899 struct ath_buf *bf;
910 bf = fi->bf;
911 if (!fi->bf)
912 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
914 bf->bf_state.stale = false;
916 if (!bf) {
922 bf->bf_next = NULL;
923 bf->bf_lastbf = bf;
938 bf->bf_state.bf_type = 0;
942 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
943 seqno = bf->bf_state.seqno;
966 list_add(&bf->list, &bf_head);
967 ath_tx_update_baw(sc, tid, bf);
968 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
972 if (bf_isampdu(bf))
973 ath_tx_addto_baw(sc, tid, bf);
978 *buf = bf;
988 struct ath_buf *bf = bf_first, *bf_prev = NULL;
997 bf = bf_first;
998 aggr_limit = ath_lookup_rate(sc, bf, tid);
1000 while (bf)
1002 skb = bf->bf_mpdu;
1009 ath_lookup_legacy(bf) || nframes >= h_baw)
1012 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1030 bf->bf_next = NULL;
1033 bf->bf_state.ndelim = ndelim;
1035 list_add_tail(&bf->list, bf_q);
1037 bf_prev->bf_next = bf;
1039 bf_prev = bf;
1041 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1047 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
1049 bf = bf_first;
1050 bf->bf_lastbf = bf_prev;
1052 if (bf == bf_prev) {
1053 al = get_frame_info(bf->bf_mpdu)->framelen;
1054 bf->bf_state.bf_type = BUF_AMPDU;
1130 static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf,
1142 skb = bf->bf_mpdu;
1190 } else if (!bf->bf_state.bfs_paprd) {
1204 static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
1214 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
1219 skb = bf->bf_mpdu;
1221 rates = bf->rates;
1228 for (i = 0; i < ARRAY_SIZE(bf->rates); i++) {
1241 if (bf_isampdu(bf) && !bf_isaggr(bf) &&
1280 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix,
1301 if (bf->bf_state.bfs_paprd)
1311 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix, false,
1316 if (bf_isaggr(bf) && (len > sc->sc_ah->caps.rts_aggr_limit))
1347 static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf,
1361 while (bf) {
1362 struct sk_buff *skb = bf->bf_mpdu;
1365 bool aggr = !!(bf->bf_state.bf_type & BUF_AGGR);
1368 if (bf->bf_next)
1369 info.link = bf->bf_next->bf_daddr;
1371 info.link = (sc->tx99_state) ? bf->bf_daddr : 0;
1374 bf_first = bf;
1387 if (bf->bf_state.bfs_paprd)
1388 info.flags |= (u32) bf->bf_state.bfs_paprd <<
1398 if (aggr && (bf == bf_first) &&
1410 ath_buf_set_rate(sc, bf, &info, len, rts);
1413 info.buf_addr[0] = bf->bf_buf_addr;
1420 if (bf == bf_first)
1422 else if (bf == bf_first->bf_lastbf)
1427 info.ndelim = bf->bf_state.ndelim;
1431 if (bf == bf_first->bf_lastbf)
1434 ath9k_hw_set_txdesc(ah, bf->bf_desc, &info);
1435 bf = bf->bf_next;
1444 struct ath_buf *bf = bf_first, *bf_prev = NULL;
1451 list_add_tail(&bf->list, bf_q);
1453 bf_prev->bf_next = bf;
1454 bf_prev = bf;
1459 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1463 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1465 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
1469 ath_set_rates(tid->an->vif, tid->an->sta, bf);
1476 struct ath_buf *bf = NULL;
1484 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1488 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1492 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
1496 ath_set_rates(tid->an->vif, tid->an->sta, bf);
1498 aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf);
1500 ath_tx_form_burst(sc, txq, tid, &bf_q, bf);
1510 ath_tx_fill_desc(sc, bf, txq, aggr_len);
1614 ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val)
1620 hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
1623 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
1639 struct ath_buf *bf_tail = NULL, *bf = NULL;
1655 tid, &bf);
1659 ath9k_set_moredata(sc, bf, true);
1660 list_add_tail(&bf->list, &bf_q);
1661 ath_set_rates(tid->an->vif, tid->an->sta, bf);
1662 if (bf_isampdu(bf))
1663 bf->bf_state.bf_type &= ~BUF_AGGR;
1665 bf_tail->bf_next = bf;
1667 bf_tail = bf;
1687 bf = list_first_entry(&bf_q, struct ath_buf, list);
1689 ath_tx_fill_desc(sc, bf, txq, 0);
1815 struct ath_buf *bf, *lastbf;
1824 bf = list_first_entry(list, struct ath_buf, list);
1826 if (bf->bf_state.stale) {
1827 list_del(&bf->list);
1829 ath_tx_return_buffer(sc, bf);
1833 lastbf = bf->bf_lastbf;
1835 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
1986 struct ath_buf *bf, *bf_last;
1999 bf = list_first_entry(head, struct ath_buf, list);
2013 ath9k_hw_set_desc_link(ah, txq->axq_link, bf->bf_daddr);
2016 ito64(bf->bf_daddr), bf->bf_desc);
2025 ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
2027 txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
2036 while (bf) {
2038 if (bf_is_ampdu_not_probing(bf))
2041 bf_last = bf->bf_lastbf;
2042 bf = bf_last->bf_next;
2054 struct ath_buf *bf = fi->bf;
2057 list_add_tail(&bf->list, &bf_head);
2058 bf->bf_state.bf_type = 0;
2060 bf->bf_state.bf_type = BUF_AMPDU;
2061 ath_tx_addto_baw(sc, tid, bf);
2064 bf->bf_next = NULL;
2065 bf->bf_lastbf = bf;
2066 ath_tx_fill_desc(sc, bf, txq, fi->framelen);
2161 struct ath_buf *bf;
2165 bf = ath_tx_get_buffer(sc);
2166 if (!bf) {
2171 ATH_TXBUF_RESET(bf);
2184 bf->bf_state.seqno = seqno;
2187 bf->bf_mpdu = skb;
2189 bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
2191 if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) {
2192 bf->bf_mpdu = NULL;
2193 bf->bf_buf_addr = 0;
2196 ath_tx_return_buffer(sc, bf);
2200 fi->bf = bf;
2202 return bf;
2285 struct ath_buf *bf;
2316 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
2317 if (!bf) {
2326 bf->bf_state.bfs_paprd = txctl->paprd;
2329 bf->bf_state.bfs_paprd_timestamp = jiffies;
2331 ath_set_rates(vif, sta, bf);
2349 struct ath_buf *bf;
2364 bf = ath_tx_setup_buffer(sc, txctl.txq, NULL, skb);
2365 if (!bf)
2368 bf->bf_lastbf = bf;
2369 ath_set_rates(vif, NULL, bf);
2370 ath_buf_set_rate(sc, bf, &info, fi->framelen, false);
2373 bf_tail->bf_next = bf;
2375 list_add_tail(&bf->list, &bf_q);
2376 bf_tail = bf;
2391 bf = list_last_entry(&bf_q, struct ath_buf, list);
2392 ath9k_set_moredata(sc, bf, false);
2394 bf = list_first_entry(&bf_q, struct ath_buf, list);
2396 ath_tx_fill_desc(sc, bf, txctl.txq, 0);
2458 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
2463 struct sk_buff *skb = bf->bf_mpdu;
2474 dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE);
2475 bf->bf_buf_addr = 0;
2479 if (bf->bf_state.bfs_paprd) {
2481 bf->bf_state.bfs_paprd_timestamp +
2487 ath_debug_stat_tx(sc, bf, ts, txq, tx_flags);
2491 /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
2494 bf->bf_mpdu = NULL;
2514 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
2518 struct sk_buff *skb = bf->bf_mpdu;
2575 struct ath_buf *bf, *lastbf, *bf_held = NULL;
2595 bf = list_first_entry(&txq->axq_q, struct ath_buf, list);
2606 if (bf->bf_state.stale) {
2607 bf_held = bf;
2611 bf = list_entry(bf_held->list.next, struct ath_buf,
2615 lastbf = bf->bf_lastbf;
2641 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
2666 struct ath_buf *bf, *lastbf;
2710 bf = list_first_entry(fifo_list, struct ath_buf, list);
2711 if (bf->bf_state.stale) {
2712 list_del(&bf->list);
2713 ath_tx_return_buffer(sc, bf);
2714 bf = list_first_entry(fifo_list, struct ath_buf, list);
2717 lastbf = bf->bf_lastbf;
2734 if (bf != lastbf)
2739 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
2866 struct ath_buf *bf;
2887 bf = ath_tx_setup_buffer(sc, txctl->txq, NULL, skb);
2888 if (!bf) {
2893 ath_set_rates(sc->tx99_vif, NULL, bf);
2895 ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);