diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-11-14 09:20:08 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-11-17 16:19:19 -0500 |
commit | 76e4522177de81ac89ade01a394aeb3704a66f1b (patch) | |
tree | a6c49c15603d92749137741a80b31fdb02593de6 | |
parent | b572d0335fcb26e526f6ae087a9a09371b22e739 (diff) |
ath9k: remove bfs_frmlen from struct ath_buf_state
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/ath9k.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/xmit.c | 63 |
2 files changed, 38 insertions, 27 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index b1c45b8e49c8..84518dc0925f 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -101,7 +101,6 @@ enum buffer_type { | |||
101 | BUF_XRETRY = BIT(5), | 101 | BUF_XRETRY = BIT(5), |
102 | }; | 102 | }; |
103 | 103 | ||
104 | #define bf_frmlen bf_state.bfs_frmlen | ||
105 | #define bf_retries bf_state.bfs_retries | 104 | #define bf_retries bf_state.bfs_retries |
106 | #define bf_isht(bf) (bf->bf_state.bf_type & BUF_HT) | 105 | #define bf_isht(bf) (bf->bf_state.bf_type & BUF_HT) |
107 | #define bf_isampdu(bf) (bf->bf_state.bf_type & BUF_AMPDU) | 106 | #define bf_isampdu(bf) (bf->bf_state.bf_type & BUF_AMPDU) |
@@ -215,7 +214,6 @@ struct ath_buf_state { | |||
215 | int bfs_retries; | 214 | int bfs_retries; |
216 | u8 bf_type; | 215 | u8 bf_type; |
217 | u8 bfs_paprd; | 216 | u8 bfs_paprd; |
218 | u16 bfs_frmlen; | ||
219 | enum ath9k_internal_frame_type bfs_ftype; | 217 | enum ath9k_internal_frame_type bfs_ftype; |
220 | }; | 218 | }; |
221 | 219 | ||
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 87b79ef9dbef..527151e44f10 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -50,7 +50,7 @@ static u16 bits_per_symbol[][2] = { | |||
50 | 50 | ||
51 | static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, | 51 | static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, |
52 | struct ath_atx_tid *tid, | 52 | struct ath_atx_tid *tid, |
53 | struct list_head *bf_head); | 53 | struct list_head *bf_head, int frmlen); |
54 | static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, | 54 | static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, |
55 | struct ath_txq *txq, struct list_head *bf_q, | 55 | struct ath_txq *txq, struct list_head *bf_q, |
56 | struct ath_tx_status *ts, int txok, int sendbar); | 56 | struct ath_tx_status *ts, int txok, int sendbar); |
@@ -144,6 +144,26 @@ static u16 ath_frame_seqno(struct sk_buff *skb) | |||
144 | return le16_to_cpu(hdr->seq_ctrl) >> IEEE80211_SEQ_SEQ_SHIFT; | 144 | return le16_to_cpu(hdr->seq_ctrl) >> IEEE80211_SEQ_SEQ_SHIFT; |
145 | } | 145 | } |
146 | 146 | ||
147 | static int ath_frame_len(struct sk_buff *skb) | ||
148 | { | ||
149 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | ||
150 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
151 | int frmlen = skb->len + FCS_LEN; | ||
152 | int padpos, padsize; | ||
153 | |||
154 | /* Remove the padding size, if any */ | ||
155 | padpos = ath9k_cmn_padpos(hdr->frame_control); | ||
156 | padsize = padpos & 3; | ||
157 | |||
158 | if (padsize && skb->len > padpos + padsize) | ||
159 | frmlen -= padsize; | ||
160 | |||
161 | if (tx_info->control.hw_key) | ||
162 | frmlen += tx_info->control.hw_key->icv_len; | ||
163 | |||
164 | return frmlen; | ||
165 | } | ||
166 | |||
147 | static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) | 167 | static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) |
148 | { | 168 | { |
149 | struct ath_txq *txq = tid->ac->txq; | 169 | 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 | ath_tx_update_baw(sc, tid, ath_frame_seqno(bf->bf_mpdu)); | 184 | ath_tx_update_baw(sc, tid, ath_frame_seqno(bf->bf_mpdu)); |
165 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0); | 185 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0); |
166 | } else { | 186 | } else { |
167 | ath_tx_send_normal(sc, txq, tid, &bf_head); | 187 | ath_tx_send_normal(sc, txq, tid, &bf_head, |
188 | ath_frame_len(bf->bf_mpdu)); | ||
168 | } | 189 | } |
169 | } | 190 | } |
170 | 191 | ||
@@ -713,6 +734,7 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc, | |||
713 | al_delta, h_baw = tid->baw_size / 2; | 734 | al_delta, h_baw = tid->baw_size / 2; |
714 | enum ATH_AGGR_STATUS status = ATH_AGGR_DONE; | 735 | enum ATH_AGGR_STATUS status = ATH_AGGR_DONE; |
715 | struct ieee80211_tx_info *tx_info; | 736 | struct ieee80211_tx_info *tx_info; |
737 | int frmlen; | ||
716 | u16 bf_seqno; | 738 | u16 bf_seqno; |
717 | 739 | ||
718 | bf_first = list_first_entry(&tid->buf_q, struct ath_buf, list); | 740 | 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 | } | 755 | } |
734 | 756 | ||
735 | /* do not exceed aggregation limit */ | 757 | /* do not exceed aggregation limit */ |
736 | al_delta = ATH_AGGR_DELIM_SZ + bf->bf_frmlen; | 758 | frmlen = ath_frame_len(bf->bf_mpdu); |
759 | al_delta = ATH_AGGR_DELIM_SZ + frmlen; | ||
737 | 760 | ||
738 | if (nframes && | 761 | if (nframes && |
739 | (aggr_limit < (al + bpad + al_delta + prev_al))) { | 762 | (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 | * Get the delimiters needed to meet the MPDU | 783 | * Get the delimiters needed to meet the MPDU |
761 | * density for this node. | 784 | * density for this node. |
762 | */ | 785 | */ |
763 | ndelim = ath_compute_num_delims(sc, tid, bf_first, bf->bf_frmlen); | 786 | ndelim = ath_compute_num_delims(sc, tid, bf_first, frmlen); |
764 | bpad = PADBYTES(al_delta) + (ndelim << 2); | 787 | bpad = PADBYTES(al_delta) + (ndelim << 2); |
765 | 788 | ||
766 | bf->bf_next = NULL; | 789 | bf->bf_next = NULL; |
@@ -816,7 +839,7 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
816 | if (bf == bf->bf_lastbf) { | 839 | if (bf == bf->bf_lastbf) { |
817 | bf->bf_state.bf_type &= ~BUF_AGGR; | 840 | bf->bf_state.bf_type &= ~BUF_AGGR; |
818 | ath9k_hw_clr11n_aggr(sc->sc_ah, bf->bf_desc); | 841 | ath9k_hw_clr11n_aggr(sc->sc_ah, bf->bf_desc); |
819 | ath_buf_set_rate(sc, bf, bf->bf_frmlen); | 842 | ath_buf_set_rate(sc, bf, ath_frame_len(bf->bf_mpdu)); |
820 | ath_tx_txqaddbuf(sc, txq, &bf_q); | 843 | ath_tx_txqaddbuf(sc, txq, &bf_q); |
821 | continue; | 844 | continue; |
822 | } | 845 | } |
@@ -1327,7 +1350,7 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, | |||
1327 | 1350 | ||
1328 | static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, | 1351 | static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, |
1329 | struct list_head *bf_head, | 1352 | struct list_head *bf_head, |
1330 | struct ath_tx_control *txctl) | 1353 | struct ath_tx_control *txctl, int frmlen) |
1331 | { | 1354 | { |
1332 | struct ath_buf *bf; | 1355 | struct ath_buf *bf; |
1333 | u16 bf_seqno; | 1356 | u16 bf_seqno; |
@@ -1362,13 +1385,13 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid, | |||
1362 | 1385 | ||
1363 | /* Queue to h/w without aggregation */ | 1386 | /* Queue to h/w without aggregation */ |
1364 | bf->bf_lastbf = bf; | 1387 | bf->bf_lastbf = bf; |
1365 | ath_buf_set_rate(sc, bf, bf->bf_frmlen); | 1388 | ath_buf_set_rate(sc, bf, frmlen); |
1366 | ath_tx_txqaddbuf(sc, txctl->txq, bf_head); | 1389 | ath_tx_txqaddbuf(sc, txctl->txq, bf_head); |
1367 | } | 1390 | } |
1368 | 1391 | ||
1369 | static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, | 1392 | static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, |
1370 | struct ath_atx_tid *tid, | 1393 | struct ath_atx_tid *tid, |
1371 | struct list_head *bf_head) | 1394 | struct list_head *bf_head, int frmlen) |
1372 | { | 1395 | { |
1373 | struct ath_buf *bf; | 1396 | struct ath_buf *bf; |
1374 | 1397 | ||
@@ -1380,7 +1403,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, | |||
1380 | INCR(tid->seq_start, IEEE80211_SEQ_MAX); | 1403 | INCR(tid->seq_start, IEEE80211_SEQ_MAX); |
1381 | 1404 | ||
1382 | bf->bf_lastbf = bf; | 1405 | bf->bf_lastbf = bf; |
1383 | ath_buf_set_rate(sc, bf, bf->bf_frmlen); | 1406 | ath_buf_set_rate(sc, bf, frmlen); |
1384 | ath_tx_txqaddbuf(sc, txq, bf_head); | 1407 | ath_tx_txqaddbuf(sc, txq, bf_head); |
1385 | TX_STAT_INC(txq->axq_qnum, queued); | 1408 | TX_STAT_INC(txq->axq_qnum, queued); |
1386 | } | 1409 | } |
@@ -1595,12 +1618,10 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw, | |||
1595 | struct ath_wiphy *aphy = hw->priv; | 1618 | struct ath_wiphy *aphy = hw->priv; |
1596 | struct ath_softc *sc = aphy->sc; | 1619 | struct ath_softc *sc = aphy->sc; |
1597 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1620 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1598 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | ||
1599 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1621 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1600 | struct ath_buf *bf; | 1622 | struct ath_buf *bf; |
1601 | int hdrlen; | 1623 | int hdrlen; |
1602 | __le16 fc; | 1624 | __le16 fc; |
1603 | int padpos, padsize; | ||
1604 | 1625 | ||
1605 | bf = ath_tx_get_buffer(sc); | 1626 | bf = ath_tx_get_buffer(sc); |
1606 | if (!bf) { | 1627 | if (!bf) { |
@@ -1614,13 +1635,6 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw, | |||
1614 | ATH_TXBUF_RESET(bf); | 1635 | ATH_TXBUF_RESET(bf); |
1615 | 1636 | ||
1616 | bf->aphy = aphy; | 1637 | bf->aphy = aphy; |
1617 | bf->bf_frmlen = skb->len + FCS_LEN; | ||
1618 | /* Remove the padding size from bf_frmlen, if any */ | ||
1619 | padpos = ath9k_cmn_padpos(hdr->frame_control); | ||
1620 | padsize = padpos & 3; | ||
1621 | if (padsize && skb->len>padpos+padsize) { | ||
1622 | bf->bf_frmlen -= padsize; | ||
1623 | } | ||
1624 | 1638 | ||
1625 | if (ieee80211_is_data_qos(fc) && conf_is_ht(&hw->conf)) { | 1639 | if (ieee80211_is_data_qos(fc) && conf_is_ht(&hw->conf)) { |
1626 | bf->bf_state.bf_type |= BUF_HT; | 1640 | bf->bf_state.bf_type |= BUF_HT; |
@@ -1630,9 +1644,6 @@ static struct ath_buf *ath_tx_setup_buffer(struct ieee80211_hw *hw, | |||
1630 | 1644 | ||
1631 | bf->bf_flags = setup_tx_flags(skb); | 1645 | bf->bf_flags = setup_tx_flags(skb); |
1632 | 1646 | ||
1633 | if (tx_info->control.hw_key) | ||
1634 | bf->bf_frmlen += tx_info->control.hw_key->icv_len; | ||
1635 | |||
1636 | bf->bf_mpdu = skb; | 1647 | bf->bf_mpdu = skb; |
1637 | 1648 | ||
1638 | bf->bf_buf_addr = dma_map_single(sc->dev, skb->data, | 1649 | 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 | int frm_type; | 1679 | int frm_type; |
1669 | __le16 fc; | 1680 | __le16 fc; |
1670 | u8 tidno; | 1681 | u8 tidno; |
1682 | int frmlen; | ||
1671 | 1683 | ||
1672 | frm_type = get_hw_packet_type(skb); | 1684 | frm_type = get_hw_packet_type(skb); |
1673 | fc = hdr->frame_control; | 1685 | fc = hdr->frame_control; |
@@ -1684,7 +1696,8 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, | |||
1684 | else | 1696 | else |
1685 | keyix = ATH9K_TXKEYIX_INVALID; | 1697 | keyix = ATH9K_TXKEYIX_INVALID; |
1686 | 1698 | ||
1687 | ath9k_hw_set11n_txdesc(ah, ds, bf->bf_frmlen, frm_type, MAX_RATE_POWER, | 1699 | frmlen = ath_frame_len(bf->bf_mpdu); |
1700 | ath9k_hw_set11n_txdesc(ah, ds, frmlen, frm_type, MAX_RATE_POWER, | ||
1688 | keyix, keytype, bf->bf_flags); | 1701 | keyix, keytype, bf->bf_flags); |
1689 | 1702 | ||
1690 | ath9k_hw_filltxdesc(ah, ds, | 1703 | ath9k_hw_filltxdesc(ah, ds, |
@@ -1711,13 +1724,13 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf, | |||
1711 | * Try aggregation if it's a unicast data frame | 1724 | * Try aggregation if it's a unicast data frame |
1712 | * and the destination is HT capable. | 1725 | * and the destination is HT capable. |
1713 | */ | 1726 | */ |
1714 | ath_tx_send_ampdu(sc, tid, &bf_head, txctl); | 1727 | ath_tx_send_ampdu(sc, tid, &bf_head, txctl, frmlen); |
1715 | } else { | 1728 | } else { |
1716 | /* | 1729 | /* |
1717 | * Send this frame as regular when ADDBA | 1730 | * Send this frame as regular when ADDBA |
1718 | * exchange is neither complete nor pending. | 1731 | * exchange is neither complete nor pending. |
1719 | */ | 1732 | */ |
1720 | ath_tx_send_normal(sc, txctl->txq, tid, &bf_head); | 1733 | ath_tx_send_normal(sc, txctl->txq, tid, &bf_head, frmlen); |
1721 | } | 1734 | } |
1722 | } else { | 1735 | } else { |
1723 | bf->bf_state.bfs_ftype = txctl->frame_type; | 1736 | 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 | if (bf->bf_state.bfs_paprd) | 1739 | if (bf->bf_state.bfs_paprd) |
1727 | ar9003_hw_set_paprd_txdesc(ah, ds, bf->bf_state.bfs_paprd); | 1740 | ar9003_hw_set_paprd_txdesc(ah, ds, bf->bf_state.bfs_paprd); |
1728 | 1741 | ||
1729 | ath_tx_send_normal(sc, txctl->txq, NULL, &bf_head); | 1742 | ath_tx_send_normal(sc, txctl->txq, NULL, &bf_head, frmlen); |
1730 | } | 1743 | } |
1731 | 1744 | ||
1732 | spin_unlock_bh(&txctl->txq->axq_lock); | 1745 | spin_unlock_bh(&txctl->txq->axq_lock); |