diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-03-29 23:14:23 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-31 14:46:41 -0400 |
commit | 29bffa96e9bef4fb84740a49e93d5bd6ca126bac (patch) | |
tree | acfa30d0f0568457e70317dd8315a141dda2e6eb /drivers | |
parent | 8e6f5aa250d6013ec0d66f9f45f376678d3fc4ab (diff) |
ath9k: allocate tx and rx status information on stack
ath_tx_status and ath_rx_status data are only necessary for a short
time, until they have been processed and converted into mac80211 data
structures.
Because of that, it makes no sense to keep them tied to the DMA
descriptor, that only wastes precious memory.
This patch allocates the data on stack in the functions that call the
conversion functions from ath9k_hw.
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/mac.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/recv.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/xmit.c | 20 |
3 files changed, 22 insertions, 25 deletions
diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h index d1d5b238cdee..68dbd7a8ddca 100644 --- a/drivers/net/wireless/ath/ath9k/mac.h +++ b/drivers/net/wireless/ath/ath9k/mac.h | |||
@@ -233,11 +233,6 @@ struct ath_desc { | |||
233 | u32 ds_ctl0; | 233 | u32 ds_ctl0; |
234 | u32 ds_ctl1; | 234 | u32 ds_ctl1; |
235 | u32 ds_hw[20]; | 235 | u32 ds_hw[20]; |
236 | union { | ||
237 | struct ath_tx_status tx; | ||
238 | struct ath_rx_status rx; | ||
239 | void *stats; | ||
240 | } ds_us; | ||
241 | void *ds_vdata; | 236 | void *ds_vdata; |
242 | } __packed; | 237 | } __packed; |
243 | 238 | ||
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 9617887907b7..94560e2fe376 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -477,7 +477,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
477 | 477 | ||
478 | struct ath_buf *bf; | 478 | struct ath_buf *bf; |
479 | struct ath_desc *ds; | 479 | struct ath_desc *ds; |
480 | struct ath_rx_status *rx_stats; | ||
481 | struct sk_buff *skb = NULL, *requeue_skb; | 480 | struct sk_buff *skb = NULL, *requeue_skb; |
482 | struct ieee80211_rx_status *rxs; | 481 | struct ieee80211_rx_status *rxs; |
483 | struct ath_hw *ah = sc->sc_ah; | 482 | struct ath_hw *ah = sc->sc_ah; |
@@ -491,6 +490,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
491 | struct ieee80211_hdr *hdr; | 490 | struct ieee80211_hdr *hdr; |
492 | int retval; | 491 | int retval; |
493 | bool decrypt_error = false; | 492 | bool decrypt_error = false; |
493 | struct ath_rx_status rs; | ||
494 | 494 | ||
495 | spin_lock_bh(&sc->rx.rxbuflock); | 495 | spin_lock_bh(&sc->rx.rxbuflock); |
496 | 496 | ||
@@ -506,7 +506,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
506 | 506 | ||
507 | bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); | 507 | bf = list_first_entry(&sc->rx.rxbuf, struct ath_buf, list); |
508 | ds = bf->bf_desc; | 508 | ds = bf->bf_desc; |
509 | rx_stats = &ds->ds_us.rx; | ||
510 | 509 | ||
511 | /* | 510 | /* |
512 | * Must provide the virtual address of the current | 511 | * Must provide the virtual address of the current |
@@ -519,11 +518,14 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
519 | * on. All this is necessary because of our use of | 518 | * on. All this is necessary because of our use of |
520 | * a self-linked list to avoid rx overruns. | 519 | * a self-linked list to avoid rx overruns. |
521 | */ | 520 | */ |
522 | retval = ath9k_hw_rxprocdesc(ah, ds, rx_stats, 0); | 521 | memset(&rs, 0, sizeof(rs)); |
522 | retval = ath9k_hw_rxprocdesc(ah, ds, &rs, 0); | ||
523 | if (retval == -EINPROGRESS) { | 523 | if (retval == -EINPROGRESS) { |
524 | struct ath_rx_status trs; | ||
524 | struct ath_buf *tbf; | 525 | struct ath_buf *tbf; |
525 | struct ath_desc *tds; | 526 | struct ath_desc *tds; |
526 | 527 | ||
528 | memset(&trs, 0, sizeof(trs)); | ||
527 | if (list_is_last(&bf->list, &sc->rx.rxbuf)) { | 529 | if (list_is_last(&bf->list, &sc->rx.rxbuf)) { |
528 | sc->rx.rxlink = NULL; | 530 | sc->rx.rxlink = NULL; |
529 | break; | 531 | break; |
@@ -543,7 +545,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
543 | */ | 545 | */ |
544 | 546 | ||
545 | tds = tbf->bf_desc; | 547 | tds = tbf->bf_desc; |
546 | retval = ath9k_hw_rxprocdesc(ah, tds, &tds->ds_us.rx, 0); | 548 | retval = ath9k_hw_rxprocdesc(ah, tds, &trs, 0); |
547 | if (retval == -EINPROGRESS) { | 549 | if (retval == -EINPROGRESS) { |
548 | break; | 550 | break; |
549 | } | 551 | } |
@@ -567,7 +569,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
567 | 569 | ||
568 | hw = ath_get_virt_hw(sc, hdr); | 570 | hw = ath_get_virt_hw(sc, hdr); |
569 | 571 | ||
570 | ath_debug_stat_rx(sc, rx_stats); | 572 | ath_debug_stat_rx(sc, &rs); |
571 | 573 | ||
572 | /* | 574 | /* |
573 | * If we're asked to flush receive queue, directly | 575 | * If we're asked to flush receive queue, directly |
@@ -576,7 +578,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
576 | if (flush) | 578 | if (flush) |
577 | goto requeue; | 579 | goto requeue; |
578 | 580 | ||
579 | retval = ath9k_cmn_rx_skb_preprocess(common, hw, skb, rx_stats, | 581 | retval = ath9k_cmn_rx_skb_preprocess(common, hw, skb, &rs, |
580 | rxs, &decrypt_error); | 582 | rxs, &decrypt_error); |
581 | if (retval) | 583 | if (retval) |
582 | goto requeue; | 584 | goto requeue; |
@@ -597,9 +599,9 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
597 | common->rx_bufsize, | 599 | common->rx_bufsize, |
598 | DMA_FROM_DEVICE); | 600 | DMA_FROM_DEVICE); |
599 | 601 | ||
600 | skb_put(skb, rx_stats->rs_datalen); | 602 | skb_put(skb, rs.rs_datalen); |
601 | 603 | ||
602 | ath9k_cmn_rx_skb_postprocess(common, skb, rx_stats, | 604 | ath9k_cmn_rx_skb_postprocess(common, skb, &rs, |
603 | rxs, decrypt_error); | 605 | rxs, decrypt_error); |
604 | 606 | ||
605 | /* We will now give hardware our shiny new allocated skb */ | 607 | /* We will now give hardware our shiny new allocated skb */ |
@@ -622,9 +624,9 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
622 | * change the default rx antenna if rx diversity chooses the | 624 | * change the default rx antenna if rx diversity chooses the |
623 | * other antenna 3 times in a row. | 625 | * other antenna 3 times in a row. |
624 | */ | 626 | */ |
625 | if (sc->rx.defant != rx_stats->rs_antenna) { | 627 | if (sc->rx.defant != rs.rs_antenna) { |
626 | if (++sc->rx.rxotherant >= 3) | 628 | if (++sc->rx.rxotherant >= 3) |
627 | ath_setdefantenna(sc, rx_stats->rs_antenna); | 629 | ath_setdefantenna(sc, rs.rs_antenna); |
628 | } else { | 630 | } else { |
629 | sc->rx.rxotherant = 0; | 631 | sc->rx.rxotherant = 0; |
630 | } | 632 | } |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 9d5d102b23bd..1d04ca86df56 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -2000,7 +2000,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2000 | struct ath_buf *bf, *lastbf, *bf_held = NULL; | 2000 | struct ath_buf *bf, *lastbf, *bf_held = NULL; |
2001 | struct list_head bf_head; | 2001 | struct list_head bf_head; |
2002 | struct ath_desc *ds; | 2002 | struct ath_desc *ds; |
2003 | struct ath_tx_status *ts; | 2003 | struct ath_tx_status ts; |
2004 | int txok; | 2004 | int txok; |
2005 | int status; | 2005 | int status; |
2006 | 2006 | ||
@@ -2039,9 +2039,9 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2039 | 2039 | ||
2040 | lastbf = bf->bf_lastbf; | 2040 | lastbf = bf->bf_lastbf; |
2041 | ds = lastbf->bf_desc; | 2041 | ds = lastbf->bf_desc; |
2042 | ts = &ds->ds_us.tx; | ||
2043 | 2042 | ||
2044 | status = ath9k_hw_txprocdesc(ah, ds, ts); | 2043 | memset(&ts, 0, sizeof(ts)); |
2044 | status = ath9k_hw_txprocdesc(ah, ds, &ts); | ||
2045 | if (status == -EINPROGRESS) { | 2045 | if (status == -EINPROGRESS) { |
2046 | spin_unlock_bh(&txq->axq_lock); | 2046 | spin_unlock_bh(&txq->axq_lock); |
2047 | break; | 2047 | break; |
@@ -2052,7 +2052,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2052 | * can disable RX. | 2052 | * can disable RX. |
2053 | */ | 2053 | */ |
2054 | if (bf->bf_isnullfunc && | 2054 | if (bf->bf_isnullfunc && |
2055 | (ts->ts_status & ATH9K_TX_ACKED)) { | 2055 | (ts.ts_status & ATH9K_TX_ACKED)) { |
2056 | if ((sc->ps_flags & PS_ENABLED)) | 2056 | if ((sc->ps_flags & PS_ENABLED)) |
2057 | ath9k_enable_ps(sc); | 2057 | ath9k_enable_ps(sc); |
2058 | else | 2058 | else |
@@ -2071,7 +2071,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2071 | &txq->axq_q, lastbf->list.prev); | 2071 | &txq->axq_q, lastbf->list.prev); |
2072 | 2072 | ||
2073 | txq->axq_depth--; | 2073 | txq->axq_depth--; |
2074 | txok = !(ts->ts_status & ATH9K_TXERR_MASK); | 2074 | txok = !(ts.ts_status & ATH9K_TXERR_MASK); |
2075 | txq->axq_tx_inprogress = false; | 2075 | txq->axq_tx_inprogress = false; |
2076 | spin_unlock_bh(&txq->axq_lock); | 2076 | spin_unlock_bh(&txq->axq_lock); |
2077 | 2077 | ||
@@ -2086,16 +2086,16 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) | |||
2086 | * This frame is sent out as a single frame. | 2086 | * This frame is sent out as a single frame. |
2087 | * Use hardware retry status for this frame. | 2087 | * Use hardware retry status for this frame. |
2088 | */ | 2088 | */ |
2089 | bf->bf_retries = ts->ts_longretry; | 2089 | bf->bf_retries = ts.ts_longretry; |
2090 | if (ts->ts_status & ATH9K_TXERR_XRETRY) | 2090 | if (ts.ts_status & ATH9K_TXERR_XRETRY) |
2091 | bf->bf_state.bf_type |= BUF_XRETRY; | 2091 | bf->bf_state.bf_type |= BUF_XRETRY; |
2092 | ath_tx_rc_status(bf, ts, 0, txok, true); | 2092 | ath_tx_rc_status(bf, &ts, 0, txok, true); |
2093 | } | 2093 | } |
2094 | 2094 | ||
2095 | if (bf_isampdu(bf)) | 2095 | if (bf_isampdu(bf)) |
2096 | ath_tx_complete_aggr(sc, txq, bf, &bf_head, ts, txok); | 2096 | ath_tx_complete_aggr(sc, txq, bf, &bf_head, &ts, txok); |
2097 | else | 2097 | else |
2098 | ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, txok, 0); | 2098 | ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, txok, 0); |
2099 | 2099 | ||
2100 | ath_wake_mac80211_queue(sc, txq); | 2100 | ath_wake_mac80211_queue(sc, txq); |
2101 | 2101 | ||