Lines Matching defs: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,
70 static void ath_tx_update_baw(struct ath_atx_tid *tid, struct ath_buf *bf);
162 static bool ath_merge_ratetbl(struct ieee80211_sta *sta, struct ath_buf *bf,
180 bf->rates[0] = tx_info->control.rates[0];
185 bf->rates[i].idx = ratetbl->rate[i].idx;
186 bf->rates[i].flags = ratetbl->rate[i].flags;
188 bf->rates[i].count = ratetbl->rate[i].count_rts;
190 bf->rates[i].count = ratetbl->rate[i].count_cts;
192 bf->rates[i].count = ratetbl->rate[i].count;
199 struct ath_buf *bf)
203 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
205 if (!ath_merge_ratetbl(sta, bf, tx_info))
206 ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
207 ARRAY_SIZE(bf->rates));
282 struct ath_buf *bf;
294 bf = fi->bf;
295 if (!bf) {
302 ath_tx_update_baw(tid, bf);
306 list_add_tail(&bf->list, &bf_head);
307 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
317 static void ath_tx_update_baw(struct ath_atx_tid *tid, struct ath_buf *bf)
319 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
320 u16 seqno = bf->bf_state.seqno;
339 static void ath_tx_addto_baw(struct ath_atx_tid *tid, struct ath_buf *bf)
341 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
342 u16 seqno = bf->bf_state.seqno;
365 struct ath_buf *bf;
375 bf = fi->bf;
377 if (!bf) {
382 list_add_tail(&bf->list, &bf_head);
383 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
391 struct ath_buf *bf = fi->bf;
403 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
409 struct ath_buf *bf = NULL;
418 bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
419 list_del(&bf->list);
423 return bf;
426 static void ath_tx_return_buffer(struct ath_softc *sc, struct ath_buf *bf)
429 list_add_tail(&bf->list, &sc->tx.txbuf);
433 static struct ath_buf* ath_clone_txbuf(struct ath_softc *sc, struct ath_buf *bf)
443 tbf->bf_mpdu = bf->bf_mpdu;
444 tbf->bf_buf_addr = bf->bf_buf_addr;
445 memcpy(tbf->bf_desc, bf->bf_desc, sc->sc_ah->caps.tx_desc_len);
446 tbf->bf_state = bf->bf_state;
452 static void ath_tx_count_frames(struct ath_buf *bf, struct ath_tx_status *ts,
463 isaggr = bf_isaggr(bf);
471 while (bf) {
472 ba_index = ATH_BA_INDEX(seq_st, bf->bf_state.seqno);
478 bf = bf->bf_next;
484 struct ath_buf *bf, struct list_head *bf_q,
492 struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
506 skb = bf->bf_mpdu;
509 memcpy(rates, bf->rates, sizeof(rates));
517 while (bf) {
518 bf_next = bf->bf_next;
520 if (!bf->bf_state.stale || bf_next != NULL)
521 list_move_tail(&bf->list, &bf_head);
523 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, ts, 0);
525 bf = bf_next;
545 isaggr = bf_isaggr(bf);
567 ath_tx_count_frames(bf, ts, txok, &nframes, &nbad);
568 while (bf) {
569 u16 seqno = bf->bf_state.seqno;
572 bf_next = bf->bf_next;
574 skb = bf->bf_mpdu;
596 ath_tx_set_retry(sc, txq, bf->bf_mpdu,
613 list_move_tail(&bf->list, &bf_head);
620 ath_tx_update_baw(tid, bf);
624 ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok);
626 if (bf == bf->bf_lastbf)
628 bf->bf_mpdu,
632 ath_tx_complete_buf(sc, bf, txq, &bf_head, sta, ts,
640 if (bf->bf_next == NULL && bf_last->bf_state.stale) {
650 ath_tx_update_baw(tid, bf);
652 ath_tx_complete_buf(sc, bf, txq,
660 fi->bf = tbf;
670 bf = bf_next;
701 static bool bf_is_ampdu_not_probing(struct ath_buf *bf)
703 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(bf->bf_mpdu);
704 return bf_isampdu(bf) && !(info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE);
709 struct ath_buf *bf,
718 int rate_dur = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc, i);
719 airtime += rate_dur * bf->rates[i].count;
726 struct ath_tx_status *ts, struct ath_buf *bf,
741 if (bf_is_ampdu_not_probing(bf))
744 ts->duration = ath9k_hw_get_duration(sc->sc_ah, bf->bf_desc,
747 hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
751 tid = ath_get_skb_tid(an, bf->bf_mpdu);
752 ath_tx_count_airtime(sc, sta, bf, ts, tid->tidno);
757 if (!bf_isampdu(bf)) {
759 info = IEEE80211_SKB_CB(bf->bf_mpdu);
760 memcpy(info->control.rates, bf->rates,
762 ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
763 ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts,
766 ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok);
768 ath_tx_complete_aggr(sc, txq, bf, bf_head, sta, tid, ts, txok);
774 static bool ath_lookup_legacy(struct ath_buf *bf)
781 skb = bf->bf_mpdu;
796 static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf,
807 skb = bf->bf_mpdu;
809 rates = bf->rates;
868 struct ath_buf *bf, u16 frmlen,
876 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
912 rix = bf->rates[0].idx;
913 flags = bf->rates[0].flags;
943 struct ath_buf *bf;
954 bf = fi->bf;
955 if (!fi->bf)
956 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
958 bf->bf_state.stale = false;
960 if (!bf) {
966 bf->bf_next = NULL;
967 bf->bf_lastbf = bf;
982 bf->bf_state.bf_type = 0;
986 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
987 seqno = bf->bf_state.seqno;
1010 list_add(&bf->list, &bf_head);
1011 ath_tx_update_baw(tid, bf);
1012 ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
1016 if (bf_isampdu(bf))
1017 ath_tx_addto_baw(tid, bf);
1022 *buf = bf;
1032 struct ath_buf *bf = bf_first, *bf_prev = NULL;
1041 bf = bf_first;
1042 aggr_limit = ath_lookup_rate(sc, bf, tid);
1044 while (bf)
1046 skb = bf->bf_mpdu;
1053 ath_lookup_legacy(bf) || nframes >= h_baw)
1056 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1074 bf->bf_next = NULL;
1077 bf->bf_state.ndelim = ndelim;
1079 list_add_tail(&bf->list, bf_q);
1081 bf_prev->bf_next = bf;
1083 bf_prev = bf;
1085 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1091 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
1093 bf = bf_first;
1094 bf->bf_lastbf = bf_prev;
1096 if (bf == bf_prev) {
1097 al = get_frame_info(bf->bf_mpdu)->framelen;
1098 bf->bf_state.bf_type = BUF_AMPDU;
1174 static u8 ath_get_rate_txpower(struct ath_softc *sc, struct ath_buf *bf,
1187 skb = bf->bf_mpdu;
1246 } else if (!bf->bf_state.bfs_paprd) {
1260 static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf,
1270 struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
1275 skb = bf->bf_mpdu;
1277 rates = bf->rates;
1284 for (i = 0; i < ARRAY_SIZE(bf->rates); i++) {
1297 if (bf_isampdu(bf) && !bf_isaggr(bf) &&
1336 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix,
1357 if (bf->bf_state.bfs_paprd)
1367 info->txpower[i] = ath_get_rate_txpower(sc, bf, rix, false,
1372 if (bf_isaggr(bf) && (len > sc->sc_ah->caps.rts_aggr_limit))
1403 static void ath_tx_fill_desc(struct ath_softc *sc, struct ath_buf *bf,
1417 while (bf) {
1418 struct sk_buff *skb = bf->bf_mpdu;
1421 bool aggr = !!(bf->bf_state.bf_type & BUF_AGGR);
1424 if (bf->bf_next)
1425 info.link = bf->bf_next->bf_daddr;
1427 info.link = (sc->tx99_state) ? bf->bf_daddr : 0;
1430 bf_first = bf;
1443 if (bf->bf_state.bfs_paprd)
1444 info.flags |= (u32) bf->bf_state.bfs_paprd <<
1454 if (aggr && (bf == bf_first) &&
1466 ath_buf_set_rate(sc, bf, &info, len, rts);
1469 info.buf_addr[0] = bf->bf_buf_addr;
1476 if (bf == bf_first)
1478 else if (bf == bf_first->bf_lastbf)
1483 info.ndelim = bf->bf_state.ndelim;
1487 if (bf == bf_first->bf_lastbf)
1490 ath9k_hw_set_txdesc(ah, bf->bf_desc, &info);
1491 bf = bf->bf_next;
1500 struct ath_buf *bf = bf_first, *bf_prev = NULL;
1507 list_add_tail(&bf->list, bf_q);
1509 bf_prev->bf_next = bf;
1510 bf_prev = bf;
1515 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1519 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1521 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
1525 ath_set_rates(tid->an->vif, tid->an->sta, bf);
1532 struct ath_buf *bf = NULL;
1540 ret = ath_tx_get_tid_subframe(sc, txq, tid, &bf);
1544 tx_info = IEEE80211_SKB_CB(bf->bf_mpdu);
1548 __skb_queue_tail(&tid->retry_q, bf->bf_mpdu);
1552 ath_set_rates(tid->an->vif, tid->an->sta, bf);
1554 aggr_len = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf);
1556 ath_tx_form_burst(sc, txq, tid, &bf_q, bf);
1566 ath_tx_fill_desc(sc, bf, txq, aggr_len);
1670 ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val)
1682 hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
1685 dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
1701 struct ath_buf *bf_tail = NULL, *bf = NULL;
1716 tid, &bf);
1720 ath9k_set_moredata(sc, bf, true);
1721 list_add_tail(&bf->list, &bf_q);
1722 ath_set_rates(tid->an->vif, tid->an->sta, bf);
1723 if (bf_isampdu(bf))
1724 bf->bf_state.bf_type &= ~BUF_AGGR;
1726 bf_tail->bf_next = bf;
1728 bf_tail = bf;
1747 bf = list_first_entry(&bf_q, struct ath_buf, list);
1749 ath_tx_fill_desc(sc, bf, txq, 0);
1875 struct ath_buf *bf, *lastbf;
1884 bf = list_first_entry(list, struct ath_buf, list);
1886 if (bf->bf_state.stale) {
1887 list_del(&bf->list);
1889 ath_tx_return_buffer(sc, bf);
1893 lastbf = bf->bf_lastbf;
1895 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
2046 struct ath_buf *bf, *bf_last;
2059 bf = list_first_entry(head, struct ath_buf, list);
2073 ath9k_hw_set_desc_link(ah, txq->axq_link, bf->bf_daddr);
2076 ito64(bf->bf_daddr), bf->bf_desc);
2085 ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
2087 txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
2096 while (bf) {
2098 if (bf_is_ampdu_not_probing(bf))
2101 bf_last = bf->bf_lastbf;
2102 bf = bf_last->bf_next;
2114 struct ath_buf *bf = fi->bf;
2117 list_add_tail(&bf->list, &bf_head);
2118 bf->bf_state.bf_type = 0;
2120 bf->bf_state.bf_type = BUF_AMPDU;
2121 ath_tx_addto_baw(tid, bf);
2124 bf->bf_next = NULL;
2125 bf->bf_lastbf = bf;
2126 ath_tx_fill_desc(sc, bf, txq, fi->framelen);
2221 struct ath_buf *bf;
2225 bf = ath_tx_get_buffer(sc);
2226 if (!bf) {
2231 ATH_TXBUF_RESET(bf);
2244 bf->bf_state.seqno = seqno;
2247 bf->bf_mpdu = skb;
2249 bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
2251 if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) {
2252 bf->bf_mpdu = NULL;
2253 bf->bf_buf_addr = 0;
2256 ath_tx_return_buffer(sc, bf);
2260 fi->bf = bf;
2262 return bf;
2345 struct ath_buf *bf;
2376 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
2377 if (!bf) {
2386 bf->bf_state.bfs_paprd = txctl->paprd;
2389 bf->bf_state.bfs_paprd_timestamp = jiffies;
2391 ath_set_rates(vif, sta, bf);
2409 struct ath_buf *bf;
2424 bf = ath_tx_setup_buffer(sc, txctl.txq, NULL, skb);
2425 if (!bf)
2428 bf->bf_lastbf = bf;
2429 ath_set_rates(vif, NULL, bf);
2430 ath_buf_set_rate(sc, bf, &info, fi->framelen, false);
2433 bf_tail->bf_next = bf;
2435 list_add_tail(&bf->list, &bf_q);
2436 bf_tail = bf;
2451 bf = list_last_entry(&bf_q, struct ath_buf, list);
2452 ath9k_set_moredata(sc, bf, false);
2454 bf = list_first_entry(&bf_q, struct ath_buf, list);
2456 ath_tx_fill_desc(sc, bf, txctl.txq, 0);
2518 static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
2523 struct sk_buff *skb = bf->bf_mpdu;
2534 dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE);
2535 bf->bf_buf_addr = 0;
2539 if (bf->bf_state.bfs_paprd) {
2541 bf->bf_state.bfs_paprd_timestamp +
2547 ath_debug_stat_tx(sc, bf, ts, txq, tx_flags);
2551 /* At this point, skb (bf->bf_mpdu) is consumed...make sure we don't
2554 bf->bf_mpdu = NULL;
2574 static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf,
2578 struct sk_buff *skb = bf->bf_mpdu;
2635 struct ath_buf *bf, *lastbf, *bf_held = NULL;
2655 bf = list_first_entry(&txq->axq_q, struct ath_buf, list);
2666 if (bf->bf_state.stale) {
2667 bf_held = bf;
2671 bf = list_entry(bf_held->list.next, struct ath_buf,
2675 lastbf = bf->bf_lastbf;
2701 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
2726 struct ath_buf *bf, *lastbf;
2770 bf = list_first_entry(fifo_list, struct ath_buf, list);
2771 if (bf->bf_state.stale) {
2772 list_del(&bf->list);
2773 ath_tx_return_buffer(sc, bf);
2774 bf = list_first_entry(fifo_list, struct ath_buf, list);
2777 lastbf = bf->bf_lastbf;
2794 if (bf != lastbf)
2799 ath_tx_process_buffer(sc, txq, &ts, bf, &bf_head);
2926 struct ath_buf *bf;
2947 bf = ath_tx_setup_buffer(sc, txctl->txq, NULL, skb);
2948 if (!bf) {
2953 ath_set_rates(sc->tx99_vif, NULL, bf);
2955 ath9k_hw_set_desc_link(sc->sc_ah, bf->bf_desc, bf->bf_daddr);