aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-03-30 05:58:38 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 16:54:33 -0400
commita119cc492fc720de7fcaf7c1b9394d6c025d276d (patch)
tree9a755b4c68bda8afef7b7f19a23805728a3750e7
parenta22be22ab8fe571cce88d0d30b49f297a563c4a7 (diff)
ath9k: Cleanup buffer status handling
Using a u32 to store a single flag is overkill. Use a bool to store whether the buffer is stale or not. Also, use u8 instead of u32 to store the buffer type. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath9k/ath9k.h13
-rw-r--r--drivers/net/wireless/ath9k/xmit.c9
2 files changed, 11 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath9k/ath9k.h b/drivers/net/wireless/ath9k/ath9k.h
index 9adc991cb05f..e6c39c1c1a28 100644
--- a/drivers/net/wireless/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath9k/ath9k.h
@@ -74,13 +74,17 @@ struct ath_config {
74/*************************/ 74/*************************/
75 75
76#define ATH_TXBUF_RESET(_bf) do { \ 76#define ATH_TXBUF_RESET(_bf) do { \
77 (_bf)->bf_status = 0; \ 77 (_bf)->bf_stale = false; \
78 (_bf)->bf_lastbf = NULL; \ 78 (_bf)->bf_lastbf = NULL; \
79 (_bf)->bf_next = NULL; \ 79 (_bf)->bf_next = NULL; \
80 memset(&((_bf)->bf_state), 0, \ 80 memset(&((_bf)->bf_state), 0, \
81 sizeof(struct ath_buf_state)); \ 81 sizeof(struct ath_buf_state)); \
82 } while (0) 82 } while (0)
83 83
84#define ATH_RXBUF_RESET(_bf) do { \
85 (_bf)->bf_stale = false; \
86 } while (0)
87
84/** 88/**
85 * enum buffer_type - Buffer type flags 89 * enum buffer_type - Buffer type flags
86 * 90 *
@@ -106,7 +110,7 @@ struct ath_buf_state {
106 int bfs_seqno; 110 int bfs_seqno;
107 int bfs_tidno; 111 int bfs_tidno;
108 int bfs_retries; 112 int bfs_retries;
109 u32 bf_type; 113 u8 bf_type;
110 u32 bfs_keyix; 114 u32 bfs_keyix;
111 enum ath9k_key_type bfs_keytype; 115 enum ath9k_key_type bfs_keytype;
112}; 116};
@@ -134,15 +138,12 @@ struct ath_buf {
134 struct ath_desc *bf_desc; /* virtual addr of desc */ 138 struct ath_desc *bf_desc; /* virtual addr of desc */
135 dma_addr_t bf_daddr; /* physical addr of desc */ 139 dma_addr_t bf_daddr; /* physical addr of desc */
136 dma_addr_t bf_buf_addr; /* physical addr of data buffer */ 140 dma_addr_t bf_buf_addr; /* physical addr of data buffer */
137 u32 bf_status; 141 bool bf_stale;
138 u16 bf_flags; 142 u16 bf_flags;
139 struct ath_buf_state bf_state; 143 struct ath_buf_state bf_state;
140 dma_addr_t bf_dmacontext; 144 dma_addr_t bf_dmacontext;
141}; 145};
142 146
143#define ATH_RXBUF_RESET(_bf) ((_bf)->bf_status = 0)
144#define ATH_BUFSTATUS_STALE 0x00000002
145
146struct ath_descdma { 147struct ath_descdma {
147 const char *dd_name; 148 const char *dd_name;
148 struct ath_desc *dd_desc; 149 struct ath_desc *dd_desc;
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 87bbeaa6432f..735256faa0b2 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -380,8 +380,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
380 ath_tx_complete_buf(sc, bf, &bf_head, !txfail, sendbar); 380 ath_tx_complete_buf(sc, bf, &bf_head, !txfail, sendbar);
381 } else { 381 } else {
382 /* retry the un-acked ones */ 382 /* retry the un-acked ones */
383 if (bf->bf_next == NULL && 383 if (bf->bf_next == NULL && bf_last->bf_stale) {
384 bf_last->bf_status & ATH_BUFSTATUS_STALE) {
385 struct ath_buf *tbf; 384 struct ath_buf *tbf;
386 385
387 tbf = ath_clone_txbuf(sc, bf_last); 386 tbf = ath_clone_txbuf(sc, bf_last);
@@ -1004,7 +1003,7 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)
1004 1003
1005 bf = list_first_entry(&txq->axq_q, struct ath_buf, list); 1004 bf = list_first_entry(&txq->axq_q, struct ath_buf, list);
1006 1005
1007 if (bf->bf_status & ATH_BUFSTATUS_STALE) { 1006 if (bf->bf_stale) {
1008 list_del(&bf->list); 1007 list_del(&bf->list);
1009 spin_unlock_bh(&txq->axq_lock); 1008 spin_unlock_bh(&txq->axq_lock);
1010 1009
@@ -1941,7 +1940,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
1941 * it with the STALE flag. 1940 * it with the STALE flag.
1942 */ 1941 */
1943 bf_held = NULL; 1942 bf_held = NULL;
1944 if (bf->bf_status & ATH_BUFSTATUS_STALE) { 1943 if (bf->bf_stale) {
1945 bf_held = bf; 1944 bf_held = bf;
1946 if (list_is_last(&bf_held->list, &txq->axq_q)) { 1945 if (list_is_last(&bf_held->list, &txq->axq_q)) {
1947 txq->axq_link = NULL; 1946 txq->axq_link = NULL;
@@ -1982,7 +1981,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
1982 * however leave the last descriptor back as the holding 1981 * however leave the last descriptor back as the holding
1983 * descriptor for hw. 1982 * descriptor for hw.
1984 */ 1983 */
1985 lastbf->bf_status |= ATH_BUFSTATUS_STALE; 1984 lastbf->bf_stale = true;
1986 INIT_LIST_HEAD(&bf_head); 1985 INIT_LIST_HEAD(&bf_head);
1987 if (!list_is_singular(&lastbf->list)) 1986 if (!list_is_singular(&lastbf->list))
1988 list_cut_position(&bf_head, 1987 list_cut_position(&bf_head,