diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-09-14 15:24:26 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-16 16:45:41 -0400 |
commit | 3afd21e7c5b3b6312193fbee628b000dce82ecf5 (patch) | |
tree | 1d2ec443c77b14bcd9cbad4ce4612091c387292e /drivers | |
parent | bdf2dbfb084f421dc6dc2f2234194ddb6ec2ea8d (diff) |
ath9k: optimize ath_tx_rc_status usage
The only flag that needs to be set when ath_tx_rc_status is called with
rc_update == false is the IEEE80211_TX_STAT_TX_FILTERED flag. All other
data is ignored in that case.
This flag can be set from ath_tx_complete_buf instead, so that we can
drop a few redundant calls to ath_tx_rc_status and remove the rc_update
function parameter
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/xmit.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 634a29a946d3..a0cd51f28596 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -58,7 +58,7 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq, | |||
58 | struct list_head *head, bool internal); | 58 | struct list_head *head, bool internal); |
59 | static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, | 59 | static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, |
60 | struct ath_tx_status *ts, int nframes, int nbad, | 60 | struct ath_tx_status *ts, int nframes, int nbad, |
61 | int txok, bool update_rc); | 61 | int txok); |
62 | static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, | 62 | static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, |
63 | int seqno); | 63 | int seqno); |
64 | static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | 64 | static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, |
@@ -392,7 +392,6 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
392 | if (!bf->bf_stale || bf_next != NULL) | 392 | if (!bf->bf_stale || bf_next != NULL) |
393 | list_move_tail(&bf->list, &bf_head); | 393 | list_move_tail(&bf->list, &bf_head); |
394 | 394 | ||
395 | ath_tx_rc_status(sc, bf, ts, 1, 1, 0, false); | ||
396 | ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, | 395 | ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, |
397 | 0, 0); | 396 | 0, 0); |
398 | 397 | ||
@@ -494,10 +493,8 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
494 | 493 | ||
495 | if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { | 494 | if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { |
496 | memcpy(tx_info->control.rates, rates, sizeof(rates)); | 495 | memcpy(tx_info->control.rates, rates, sizeof(rates)); |
497 | ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok, true); | 496 | ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok); |
498 | rc_update = false; | 497 | rc_update = false; |
499 | } else { | ||
500 | ath_tx_rc_status(sc, bf, ts, nframes, nbad, txok, false); | ||
501 | } | 498 | } |
502 | 499 | ||
503 | ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, | 500 | ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, |
@@ -519,8 +516,6 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
519 | ath_tx_update_baw(sc, tid, seqno); | 516 | ath_tx_update_baw(sc, tid, seqno); |
520 | spin_unlock_bh(&txq->axq_lock); | 517 | spin_unlock_bh(&txq->axq_lock); |
521 | 518 | ||
522 | ath_tx_rc_status(sc, bf, ts, nframes, | ||
523 | nbad, 0, false); | ||
524 | ath_tx_complete_buf(sc, bf, txq, | 519 | ath_tx_complete_buf(sc, bf, txq, |
525 | &bf_head, | 520 | &bf_head, |
526 | ts, 0, 1); | 521 | ts, 0, 1); |
@@ -1983,6 +1978,7 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, | |||
1983 | struct ath_tx_status *ts, int txok, int sendbar) | 1978 | struct ath_tx_status *ts, int txok, int sendbar) |
1984 | { | 1979 | { |
1985 | struct sk_buff *skb = bf->bf_mpdu; | 1980 | struct sk_buff *skb = bf->bf_mpdu; |
1981 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | ||
1986 | unsigned long flags; | 1982 | unsigned long flags; |
1987 | int tx_flags = 0; | 1983 | int tx_flags = 0; |
1988 | 1984 | ||
@@ -1992,6 +1988,9 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, | |||
1992 | if (!txok) | 1988 | if (!txok) |
1993 | tx_flags |= ATH_TX_ERROR; | 1989 | tx_flags |= ATH_TX_ERROR; |
1994 | 1990 | ||
1991 | if (ts->ts_status & ATH9K_TXERR_FILT) | ||
1992 | tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; | ||
1993 | |||
1995 | dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE); | 1994 | dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE); |
1996 | bf->bf_buf_addr = 0; | 1995 | bf->bf_buf_addr = 0; |
1997 | 1996 | ||
@@ -2021,7 +2020,7 @@ static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, | |||
2021 | 2020 | ||
2022 | static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, | 2021 | static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, |
2023 | struct ath_tx_status *ts, int nframes, int nbad, | 2022 | struct ath_tx_status *ts, int nframes, int nbad, |
2024 | int txok, bool update_rc) | 2023 | int txok) |
2025 | { | 2024 | { |
2026 | struct sk_buff *skb = bf->bf_mpdu; | 2025 | struct sk_buff *skb = bf->bf_mpdu; |
2027 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 2026 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
@@ -2036,9 +2035,7 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, | |||
2036 | tx_rateindex = ts->ts_rateindex; | 2035 | tx_rateindex = ts->ts_rateindex; |
2037 | WARN_ON(tx_rateindex >= hw->max_rates); | 2036 | WARN_ON(tx_rateindex >= hw->max_rates); |
2038 | 2037 | ||
2039 | if (ts->ts_status & ATH9K_TXERR_FILT) | 2038 | if (tx_info->flags & IEEE80211_TX_CTL_AMPDU) { |
2040 | tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; | ||
2041 | if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && update_rc) { | ||
2042 | tx_info->flags |= IEEE80211_TX_STAT_AMPDU; | 2039 | tx_info->flags |= IEEE80211_TX_STAT_AMPDU; |
2043 | 2040 | ||
2044 | BUG_ON(nbad > nframes); | 2041 | BUG_ON(nbad > nframes); |
@@ -2048,7 +2045,7 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, | |||
2048 | } | 2045 | } |
2049 | 2046 | ||
2050 | if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 && | 2047 | if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 && |
2051 | (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) == 0 && update_rc) { | 2048 | (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) == 0) { |
2052 | /* | 2049 | /* |
2053 | * If an underrun error is seen assume it as an excessive | 2050 | * If an underrun error is seen assume it as an excessive |
2054 | * retry only if max frame trigger level has been reached | 2051 | * retry only if max frame trigger level has been reached |
@@ -2061,9 +2058,9 @@ static void ath_tx_rc_status(struct ath_softc *sc, struct ath_buf *bf, | |||
2061 | * successfully by eventually preferring slower rates. | 2058 | * successfully by eventually preferring slower rates. |
2062 | * This itself should also alleviate congestion on the bus. | 2059 | * This itself should also alleviate congestion on the bus. |
2063 | */ | 2060 | */ |
2064 | if (ieee80211_is_data(hdr->frame_control) && | 2061 | if (unlikely(ts->ts_flags & (ATH9K_TX_DATA_UNDERRUN | |
2065 | (ts->ts_flags & (ATH9K_TX_DATA_UNDERRUN | | 2062 | ATH9K_TX_DELIM_UNDERRUN)) && |
2066 | ATH9K_TX_DELIM_UNDERRUN)) && | 2063 | ieee80211_is_data(hdr->frame_control) && |
2067 | ah->tx_trig_level >= sc->sc_ah->config.max_txtrig_level) | 2064 | ah->tx_trig_level >= sc->sc_ah->config.max_txtrig_level) |
2068 | tx_info->status.rates[tx_rateindex].count = | 2065 | tx_info->status.rates[tx_rateindex].count = |
2069 | hw->max_rate_tries; | 2066 | hw->max_rate_tries; |
@@ -2094,7 +2091,7 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq, | |||
2094 | spin_unlock_bh(&txq->axq_lock); | 2091 | spin_unlock_bh(&txq->axq_lock); |
2095 | 2092 | ||
2096 | if (!bf_isampdu(bf)) { | 2093 | if (!bf_isampdu(bf)) { |
2097 | ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok, true); | 2094 | ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok); |
2098 | ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok, 0); | 2095 | ath_tx_complete_buf(sc, bf, txq, bf_head, ts, txok, 0); |
2099 | } else | 2096 | } else |
2100 | ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok, true); | 2097 | ath_tx_complete_aggr(sc, txq, bf, bf_head, ts, txok, true); |