static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
struct ath_atx_tid *tid,
- struct list_head *bf_head);
+ struct list_head *bf_head, int frmlen);
static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
struct ath_txq *txq, struct list_head *bf_q,
struct ath_tx_status *ts, int txok, int sendbar);
return le16_to_cpu(hdr->seq_ctrl) >> IEEE80211_SEQ_SEQ_SHIFT;
}
+static int ath_frame_len(struct sk_buff *skb)
+{
+ struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+ int frmlen = skb->len + FCS_LEN;
+ int padpos, padsize;
+
+ /* Remove the padding size, if any */
+ padpos = ath9k_cmn_padpos(hdr->frame_control);
+ padsize = padpos & 3;
+
+ if (padsize && skb->len > padpos + padsize)
+ frmlen -= padsize;
+
+ if (tx_info->control.hw_key)
+ frmlen += tx_info->control.hw_key->icv_len;
+
+ return frmlen;
+}
+
static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
{
struct ath_txq *txq = tid->ac->txq;
ath_tx_update_baw(sc, tid, ath_frame_seqno(bf->bf_mpdu));
ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
} else {
- ath_tx_send_normal(sc, txq, tid, &bf_head);
+ ath_tx_send_normal(sc, txq, tid, &bf_head,
+ ath_frame_len(bf->bf_mpdu));
}
}
al_delta, h_baw = tid->baw_size / 2;
enum ATH_AGGR_STATUS status = ATH_AGGR_DONE;
struct ieee80211_tx_info *tx_info;
+ int frmlen;
u16 bf_seqno;
bf_first = list_first_entry(&tid->buf_q, struct ath_buf, list);
}
/* do not exceed aggregation limit */
- al_delta = ATH_AGGR_DELIM_SZ + bf->bf_frmlen;
+ frmlen = ath_frame_len(bf->bf_mpdu);
+ al_delta = ATH_AGGR_DELIM_SZ + frmlen;
if (nframes &&
(aggr_limit < (al + bpad + al_delta + prev_al))) {
* Get the delimiters needed to meet the MPDU
* density for this node.
*/
- ndelim = ath_compute_num_delims(sc, tid, bf_first, bf->bf_frmlen);
+ ndelim = ath_compute_num_delims(sc, tid, bf_first, frmlen);
bpad = PADBYTES(al_delta) + (ndelim << 2);
bf->bf_next = NULL;
if (bf == bf->bf_lastbf) {
bf->bf_state.bf_type &= ~BUF_AGGR;
ath9k_hw_clr11n_aggr(sc->sc_ah, bf->bf_desc);
- ath_buf_set_rate(sc, bf, bf->bf_frmlen);
+ ath_buf_set_rate(sc, bf, ath_frame_len(bf->bf_mpdu));
ath_tx_txqaddbuf(sc, txq, &bf_q);
continue;
}
static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
struct list_head *bf_head,
- struct ath_tx_control *txctl)
+ struct ath_tx_control *txctl, int frmlen)
{
struct ath_buf *bf;
u16 bf_seqno;
/* Queue to h/w without aggregation */
bf->bf_lastbf = bf;
- ath_buf_set_rate(sc, bf, bf->bf_frmlen);
+ ath_buf_set_rate(sc, bf, frmlen);
ath_tx_txqaddbuf(sc, txctl->txq, bf_head);
}
static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
struct ath_atx_tid *tid,
- struct list_head *bf_head)
+ struct list_head *bf_head, int frmlen)
{
struct ath_buf *bf;
INCR(tid->seq_start, IEEE80211_SEQ_MAX);
bf->bf_lastbf = bf;
- ath_buf_set_rate(sc, bf, bf->bf_frmlen);
+ ath_buf_set_rate(sc, bf, frmlen);
ath_tx_txqaddbuf(sc, txq, bf_head);
TX_STAT_INC(txq->axq_qnum, queued);
}
struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc;
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
- struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ath_buf *bf;
int hdrlen;
__le16 fc;
- int padpos, padsize;
bf = ath_tx_get_buffer(sc);
if (!bf) {
ATH_TXBUF_RESET(bf);
bf->aphy = aphy;
- bf->bf_frmlen = skb->len + FCS_LEN;
- /* Remove the padding size from bf_frmlen, if any */
- padpos = ath9k_cmn_padpos(hdr->frame_control);
- padsize = padpos & 3;
- if (padsize && skb->len>padpos+padsize) {
- bf->bf_frmlen -= padsize;
- }
if (ieee80211_is_data_qos(fc) && conf_is_ht(&hw->conf)) {
bf->bf_state.bf_type |= BUF_HT;
bf->bf_flags = setup_tx_flags(skb);
- if (tx_info->control.hw_key)
- bf->bf_frmlen += tx_info->control.hw_key->icv_len;
-
bf->bf_mpdu = skb;
bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
int frm_type;
__le16 fc;
u8 tidno;
+ int frmlen;
frm_type = get_hw_packet_type(skb);
fc = hdr->frame_control;
else
keyix = ATH9K_TXKEYIX_INVALID;
- ath9k_hw_set11n_txdesc(ah, ds, bf->bf_frmlen, frm_type, MAX_RATE_POWER,
+ frmlen = ath_frame_len(bf->bf_mpdu);
+ ath9k_hw_set11n_txdesc(ah, ds, frmlen, frm_type, MAX_RATE_POWER,
keyix, keytype, bf->bf_flags);
ath9k_hw_filltxdesc(ah, ds,
* Try aggregation if it's a unicast data frame
* and the destination is HT capable.
*/
- ath_tx_send_ampdu(sc, tid, &bf_head, txctl);
+ ath_tx_send_ampdu(sc, tid, &bf_head, txctl, frmlen);
} else {
/*
* Send this frame as regular when ADDBA
* exchange is neither complete nor pending.
*/
- ath_tx_send_normal(sc, txctl->txq, tid, &bf_head);
+ ath_tx_send_normal(sc, txctl->txq, tid, &bf_head, frmlen);
}
} else {
bf->bf_state.bfs_ftype = txctl->frame_type;
if (bf->bf_state.bfs_paprd)
ar9003_hw_set_paprd_txdesc(ah, ds, bf->bf_state.bfs_paprd);
- ath_tx_send_normal(sc, txctl->txq, NULL, &bf_head);
+ ath_tx_send_normal(sc, txctl->txq, NULL, &bf_head, frmlen);
}
spin_unlock_bh(&txctl->txq->axq_lock);