Commit a119cc49 authored by Sujith's avatar Sujith Committed by John W. Linville

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: default avatarSujith <Sujith.Manoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent a22be22a
...@@ -74,13 +74,17 @@ struct ath_config { ...@@ -74,13 +74,17 @@ struct ath_config {
/*************************/ /*************************/
#define ATH_TXBUF_RESET(_bf) do { \ #define ATH_TXBUF_RESET(_bf) do { \
(_bf)->bf_status = 0; \ (_bf)->bf_stale = false; \
(_bf)->bf_lastbf = NULL; \ (_bf)->bf_lastbf = NULL; \
(_bf)->bf_next = NULL; \ (_bf)->bf_next = NULL; \
memset(&((_bf)->bf_state), 0, \ memset(&((_bf)->bf_state), 0, \
sizeof(struct ath_buf_state)); \ sizeof(struct ath_buf_state)); \
} while (0) } while (0)
#define ATH_RXBUF_RESET(_bf) do { \
(_bf)->bf_stale = false; \
} while (0)
/** /**
* enum buffer_type - Buffer type flags * enum buffer_type - Buffer type flags
* *
...@@ -106,7 +110,7 @@ struct ath_buf_state { ...@@ -106,7 +110,7 @@ struct ath_buf_state {
int bfs_seqno; int bfs_seqno;
int bfs_tidno; int bfs_tidno;
int bfs_retries; int bfs_retries;
u32 bf_type; u8 bf_type;
u32 bfs_keyix; u32 bfs_keyix;
enum ath9k_key_type bfs_keytype; enum ath9k_key_type bfs_keytype;
}; };
...@@ -134,15 +138,12 @@ struct ath_buf { ...@@ -134,15 +138,12 @@ struct ath_buf {
struct ath_desc *bf_desc; /* virtual addr of desc */ struct ath_desc *bf_desc; /* virtual addr of desc */
dma_addr_t bf_daddr; /* physical addr of desc */ dma_addr_t bf_daddr; /* physical addr of desc */
dma_addr_t bf_buf_addr; /* physical addr of data buffer */ dma_addr_t bf_buf_addr; /* physical addr of data buffer */
u32 bf_status; bool bf_stale;
u16 bf_flags; u16 bf_flags;
struct ath_buf_state bf_state; struct ath_buf_state bf_state;
dma_addr_t bf_dmacontext; dma_addr_t bf_dmacontext;
}; };
#define ATH_RXBUF_RESET(_bf) ((_bf)->bf_status = 0)
#define ATH_BUFSTATUS_STALE 0x00000002
struct ath_descdma { struct ath_descdma {
const char *dd_name; const char *dd_name;
struct ath_desc *dd_desc; struct ath_desc *dd_desc;
......
...@@ -380,8 +380,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, ...@@ -380,8 +380,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
ath_tx_complete_buf(sc, bf, &bf_head, !txfail, sendbar); ath_tx_complete_buf(sc, bf, &bf_head, !txfail, sendbar);
} else { } else {
/* retry the un-acked ones */ /* retry the un-acked ones */
if (bf->bf_next == NULL && if (bf->bf_next == NULL && bf_last->bf_stale) {
bf_last->bf_status & ATH_BUFSTATUS_STALE) {
struct ath_buf *tbf; struct ath_buf *tbf;
tbf = ath_clone_txbuf(sc, bf_last); 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,7 +1003,7 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)
bf = list_first_entry(&txq->axq_q, struct ath_buf, list); bf = list_first_entry(&txq->axq_q, struct ath_buf, list);
if (bf->bf_status & ATH_BUFSTATUS_STALE) { if (bf->bf_stale) {
list_del(&bf->list); list_del(&bf->list);
spin_unlock_bh(&txq->axq_lock); spin_unlock_bh(&txq->axq_lock);
...@@ -1941,7 +1940,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) ...@@ -1941,7 +1940,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
* it with the STALE flag. * it with the STALE flag.
*/ */
bf_held = NULL; bf_held = NULL;
if (bf->bf_status & ATH_BUFSTATUS_STALE) { if (bf->bf_stale) {
bf_held = bf; bf_held = bf;
if (list_is_last(&bf_held->list, &txq->axq_q)) { if (list_is_last(&bf_held->list, &txq->axq_q)) {
txq->axq_link = NULL; txq->axq_link = NULL;
...@@ -1982,7 +1981,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) ...@@ -1982,7 +1981,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
* however leave the last descriptor back as the holding * however leave the last descriptor back as the holding
* descriptor for hw. * descriptor for hw.
*/ */
lastbf->bf_status |= ATH_BUFSTATUS_STALE; lastbf->bf_stale = true;
INIT_LIST_HEAD(&bf_head); INIT_LIST_HEAD(&bf_head);
if (!list_is_singular(&lastbf->list)) if (!list_is_singular(&lastbf->list))
list_cut_position(&bf_head, list_cut_position(&bf_head,
......
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