Commit 76e45221 authored by Felix Fietkau's avatar Felix Fietkau Committed by John W. Linville

ath9k: remove bfs_frmlen from struct ath_buf_state

Signed-off-by: default avatarFelix Fietkau <nbd@openwrt.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent b572d033
...@@ -101,7 +101,6 @@ enum buffer_type { ...@@ -101,7 +101,6 @@ enum buffer_type {
BUF_XRETRY = BIT(5), BUF_XRETRY = BIT(5),
}; };
#define bf_frmlen bf_state.bfs_frmlen
#define bf_retries bf_state.bfs_retries #define bf_retries bf_state.bfs_retries
#define bf_isht(bf) (bf->bf_state.bf_type & BUF_HT) #define bf_isht(bf) (bf->bf_state.bf_type & BUF_HT)
#define bf_isampdu(bf) (bf->bf_state.bf_type & BUF_AMPDU) #define bf_isampdu(bf) (bf->bf_state.bf_type & BUF_AMPDU)
...@@ -215,7 +214,6 @@ struct ath_buf_state { ...@@ -215,7 +214,6 @@ struct ath_buf_state {
int bfs_retries; int bfs_retries;
u8 bf_type; u8 bf_type;
u8 bfs_paprd; u8 bfs_paprd;
u16 bfs_frmlen;
enum ath9k_internal_frame_type bfs_ftype; enum ath9k_internal_frame_type bfs_ftype;
}; };
......
...@@ -50,7 +50,7 @@ static u16 bits_per_symbol[][2] = { ...@@ -50,7 +50,7 @@ static u16 bits_per_symbol[][2] = {
static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
struct ath_atx_tid *tid, 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, 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_txq *txq, struct list_head *bf_q,
struct ath_tx_status *ts, int txok, int sendbar); struct ath_tx_status *ts, int txok, int sendbar);
...@@ -144,6 +144,26 @@ static u16 ath_frame_seqno(struct sk_buff *skb) ...@@ -144,6 +144,26 @@ static u16 ath_frame_seqno(struct sk_buff *skb)
return le16_to_cpu(hdr->seq_ctrl) >> IEEE80211_SEQ_SEQ_SHIFT; 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) static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
{ {
struct ath_txq *txq = tid->ac->txq; struct ath_txq *txq = tid->ac->txq;
...@@ -164,7 +184,8 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) ...@@ -164,7 +184,8 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
ath_tx_update_baw(sc, tid, ath_frame_seqno(bf->bf_mpdu)); ath_tx_update_baw(sc, tid, ath_frame_seqno(bf->bf_mpdu));
ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0); ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0);
} else { } 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));
} }
} }
...@@ -713,6 +734,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, ...@@ -713,6 +734,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
al_delta, h_baw = tid->baw_size / 2; al_delta, h_baw = tid->baw_size / 2;
enum ATH_AGGR_STATUS status = ATH_AGGR_DONE; enum ATH_AGGR_STATUS status = ATH_AGGR_DONE;
struct ieee80211_tx_info *tx_info; struct ieee80211_tx_info *tx_info;
int frmlen;
u16 bf_seqno; u16 bf_seqno;
bf_first = list_first_entry(&tid->buf_q, struct ath_buf, list); bf_first = list_first_entry(&tid->buf_q, struct ath_buf, list);
...@@ -733,7 +755,8 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, ...@@ -733,7 +755,8 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
} }
/* do not exceed aggregation limit */ /* 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 && if (nframes &&
(aggr_limit < (al + bpad + al_delta + prev_al))) { (aggr_limit < (al + bpad + al_delta + prev_al))) {
...@@ -760,7 +783,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, ...@@ -760,7 +783,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
* Get the delimiters needed to meet the MPDU * Get the delimiters needed to meet the MPDU
* density for this node. * 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); bpad = PADBYTES(al_delta) + (ndelim << 2);
bf->bf_next = NULL; bf->bf_next = NULL;
...@@ -816,7 +839,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -816,7 +839,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
if (bf == bf->bf_lastbf) { if (bf == bf->bf_lastbf) {
bf->bf_state.bf_type &= ~BUF_AGGR; bf->bf_state.bf_type &= ~BUF_AGGR;
ath9k_hw_clr11n_aggr(sc->sc_ah, bf->bf_desc); 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); ath_tx_txqaddbuf(sc, txq, &bf_q);
continue; continue;
} }
...@@ -1327,7 +1350,7 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, ...@@ -1327,7 +1350,7 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
struct list_head *bf_head, struct list_head *bf_head,
struct ath_tx_control *txctl) struct ath_tx_control *txctl, int frmlen)
{ {
struct ath_buf *bf; struct ath_buf *bf;
u16 bf_seqno; u16 bf_seqno;
...@@ -1362,13 +1385,13 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, ...@@ -1362,13 +1385,13 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
/* Queue to h/w without aggregation */ /* Queue to h/w without aggregation */
bf->bf_lastbf = bf; 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); ath_tx_txqaddbuf(sc, txctl->txq, bf_head);
} }
static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
struct ath_atx_tid *tid, struct ath_atx_tid *tid,
struct list_head *bf_head) struct list_head *bf_head, int frmlen)
{ {
struct ath_buf *bf; struct ath_buf *bf;
...@@ -1380,7 +1403,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, ...@@ -1380,7 +1403,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
INCR(tid->seq_start, IEEE80211_SEQ_MAX); INCR(tid->seq_start, IEEE80211_SEQ_MAX);
bf->bf_lastbf = bf; 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); ath_tx_txqaddbuf(sc, txq, bf_head);
TX_STAT_INC(txq->axq_qnum, queued); TX_STAT_INC(txq->axq_qnum, queued);
} }
...@@ -1595,12 +1618,10 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw, ...@@ -1595,12 +1618,10 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw,
struct ath_wiphy *aphy = hw->priv; struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc; struct ath_softc *sc = aphy->sc;
struct ath_common *common = ath9k_hw_common(sc->sc_ah); 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 ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ath_buf *bf; struct ath_buf *bf;
int hdrlen; int hdrlen;
__le16 fc; __le16 fc;
int padpos, padsize;
bf = ath_tx_get_buffer(sc); bf = ath_tx_get_buffer(sc);
if (!bf) { if (!bf) {
...@@ -1614,13 +1635,6 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw, ...@@ -1614,13 +1635,6 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw,
ATH_TXBUF_RESET(bf); ATH_TXBUF_RESET(bf);
bf->aphy = aphy; 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)) { if (ieee80211_is_data_qos(fc) && conf_is_ht(&hw->conf)) {
bf->bf_state.bf_type |= BUF_HT; bf->bf_state.bf_type |= BUF_HT;
...@@ -1630,9 +1644,6 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw, ...@@ -1630,9 +1644,6 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw,
bf->bf_flags = setup_tx_flags(skb); 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_mpdu = skb;
bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
...@@ -1668,6 +1679,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, ...@@ -1668,6 +1679,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
int frm_type; int frm_type;
__le16 fc; __le16 fc;
u8 tidno; u8 tidno;
int frmlen;
frm_type = get_hw_packet_type(skb); frm_type = get_hw_packet_type(skb);
fc = hdr->frame_control; fc = hdr->frame_control;
...@@ -1684,7 +1696,8 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, ...@@ -1684,7 +1696,8 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
else else
keyix = ATH9K_TXKEYIX_INVALID; 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); keyix, keytype, bf->bf_flags);
ath9k_hw_filltxdesc(ah, ds, ath9k_hw_filltxdesc(ah, ds,
...@@ -1711,13 +1724,13 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, ...@@ -1711,13 +1724,13 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
* Try aggregation if it's a unicast data frame * Try aggregation if it's a unicast data frame
* and the destination is HT capable. * 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 { } else {
/* /*
* Send this frame as regular when ADDBA * Send this frame as regular when ADDBA
* exchange is neither complete nor pending. * 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 { } else {
bf->bf_state.bfs_ftype = txctl->frame_type; bf->bf_state.bfs_ftype = txctl->frame_type;
...@@ -1726,7 +1739,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, ...@@ -1726,7 +1739,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
if (bf->bf_state.bfs_paprd) if (bf->bf_state.bfs_paprd)
ar9003_hw_set_paprd_txdesc(ah, ds, 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); spin_unlock_bh(&txctl->txq->axq_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment