diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2008-10-29 00:45:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-11-10 15:14:56 -0500 |
commit | a37c2c79404940dfc5e88c851c3de5328975b1a9 (patch) | |
tree | 7c83a9ae42a1a062e740b187997108c611f6e5fd /drivers/net | |
parent | 102e0572d330e6cdb89a8f8fbd3999e3c67a1f9e (diff) |
ath9k: Use bitfields to store tid's state in a single variable
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/ath9k/core.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/rc.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/xmit.c | 49 |
3 files changed, 27 insertions, 34 deletions
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h index 27ed084d85cd..d89dd03eaed7 100644 --- a/drivers/net/wireless/ath9k/core.h +++ b/drivers/net/wireless/ath9k/core.h | |||
@@ -447,6 +447,10 @@ struct ath_txq { | |||
447 | struct list_head axq_acq; | 447 | struct list_head axq_acq; |
448 | }; | 448 | }; |
449 | 449 | ||
450 | #define AGGR_CLEANUP BIT(1) | ||
451 | #define AGGR_ADDBA_COMPLETE BIT(2) | ||
452 | #define AGGR_ADDBA_PROGRESS BIT(3) | ||
453 | |||
450 | /* per TID aggregate tx state for a destination */ | 454 | /* per TID aggregate tx state for a destination */ |
451 | struct ath_atx_tid { | 455 | struct ath_atx_tid { |
452 | struct list_head list; /* round-robin tid entry */ | 456 | struct list_head list; /* round-robin tid entry */ |
@@ -462,9 +466,7 @@ struct ath_atx_tid { | |||
462 | int baw_tail; /* next unused tx buffer slot */ | 466 | int baw_tail; /* next unused tx buffer slot */ |
463 | int sched; | 467 | int sched; |
464 | int paused; | 468 | int paused; |
465 | int cleanup_inprogress; | 469 | u8 state; |
466 | u32 addba_exchangecomplete:1; | ||
467 | int32_t addba_exchangeinprogress; | ||
468 | int addba_exchangeattempts; | 470 | int addba_exchangeattempts; |
469 | }; | 471 | }; |
470 | 472 | ||
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c index 02931a111f1a..ff283dca7328 100644 --- a/drivers/net/wireless/ath9k/rc.c +++ b/drivers/net/wireless/ath9k/rc.c | |||
@@ -1909,8 +1909,8 @@ static void ath_tx_aggr_resp(struct ath_softc *sc, | |||
1909 | state = si->ampdu_mlme.tid_state_tx[tidno]; | 1909 | state = si->ampdu_mlme.tid_state_tx[tidno]; |
1910 | 1910 | ||
1911 | if (state & HT_ADDBA_RECEIVED_MSK) { | 1911 | if (state & HT_ADDBA_RECEIVED_MSK) { |
1912 | txtid->addba_exchangecomplete = 1; | 1912 | txtid->state |= AGGR_ADDBA_COMPLETE; |
1913 | txtid->addba_exchangeinprogress = 0; | 1913 | txtid->state &= ~AGGR_ADDBA_PROGRESS; |
1914 | txtid->baw_size = buffersize; | 1914 | txtid->baw_size = buffersize; |
1915 | 1915 | ||
1916 | DPRINTF(sc, ATH_DBG_AGGR, | 1916 | DPRINTF(sc, ATH_DBG_AGGR, |
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c index bd902468868f..f41030d1a687 100644 --- a/drivers/net/wireless/ath9k/xmit.c +++ b/drivers/net/wireless/ath9k/xmit.c | |||
@@ -125,13 +125,13 @@ static int ath_tx_findindex(const struct ath9k_rate_table *rt, int rate) | |||
125 | 125 | ||
126 | /* Check if it's okay to send out aggregates */ | 126 | /* Check if it's okay to send out aggregates */ |
127 | 127 | ||
128 | static int ath_aggr_query(struct ath_softc *sc, | 128 | static int ath_aggr_query(struct ath_softc *sc, struct ath_node *an, u8 tidno) |
129 | struct ath_node *an, u8 tidno) | ||
130 | { | 129 | { |
131 | struct ath_atx_tid *tid; | 130 | struct ath_atx_tid *tid; |
132 | tid = ATH_AN_2_TID(an, tidno); | 131 | tid = ATH_AN_2_TID(an, tidno); |
133 | 132 | ||
134 | if (tid->addba_exchangecomplete || tid->addba_exchangeinprogress) | 133 | if (tid->state & AGGR_ADDBA_COMPLETE || |
134 | tid->state & AGGR_ADDBA_PROGRESS) | ||
135 | return 1; | 135 | return 1; |
136 | else | 136 | else |
137 | return 0; | 137 | return 0; |
@@ -886,7 +886,7 @@ static void ath_tx_complete_aggr_rifs(struct ath_softc *sc, | |||
886 | /* transmit completion */ | 886 | /* transmit completion */ |
887 | } else { | 887 | } else { |
888 | 888 | ||
889 | if (!tid->cleanup_inprogress && | 889 | if (!(tid->state & AGGR_CLEANUP) && |
890 | ds->ds_txstat.ts_flags != ATH9K_TX_SW_ABORTED) { | 890 | ds->ds_txstat.ts_flags != ATH9K_TX_SW_ABORTED) { |
891 | if (bf->bf_retries < ATH_MAX_SW_RETRIES) { | 891 | if (bf->bf_retries < ATH_MAX_SW_RETRIES) { |
892 | ath_tx_set_retry(sc, bf); | 892 | ath_tx_set_retry(sc, bf); |
@@ -1014,16 +1014,16 @@ static void ath_tx_complete_aggr_rifs(struct ath_softc *sc, | |||
1014 | bf = bf_next; | 1014 | bf = bf_next; |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | if (tid->cleanup_inprogress) { | 1017 | if (tid->state & AGGR_CLEANUP) { |
1018 | /* check to see if we're done with cleaning the h/w queue */ | 1018 | /* check to see if we're done with cleaning the h/w queue */ |
1019 | spin_lock_bh(&txq->axq_lock); | 1019 | spin_lock_bh(&txq->axq_lock); |
1020 | 1020 | ||
1021 | if (tid->baw_head == tid->baw_tail) { | 1021 | if (tid->baw_head == tid->baw_tail) { |
1022 | tid->addba_exchangecomplete = 0; | 1022 | tid->state &= ~AGGR_ADDBA_COMPLETE; |
1023 | tid->addba_exchangeattempts = 0; | 1023 | tid->addba_exchangeattempts = 0; |
1024 | spin_unlock_bh(&txq->axq_lock); | 1024 | spin_unlock_bh(&txq->axq_lock); |
1025 | 1025 | ||
1026 | tid->cleanup_inprogress = false; | 1026 | tid->state &= ~AGGR_CLEANUP; |
1027 | 1027 | ||
1028 | /* send buffered frames as singles */ | 1028 | /* send buffered frames as singles */ |
1029 | ath_tx_flush_tid(sc, tid); | 1029 | ath_tx_flush_tid(sc, tid); |
@@ -2335,17 +2335,8 @@ enum ATH_AGGR_CHECK ath_tx_aggr_check(struct ath_softc *sc, | |||
2335 | /* ADDBA exchange must be completed before sending aggregates */ | 2335 | /* ADDBA exchange must be completed before sending aggregates */ |
2336 | txtid = ATH_AN_2_TID(an, tidno); | 2336 | txtid = ATH_AN_2_TID(an, tidno); |
2337 | 2337 | ||
2338 | if (txtid->addba_exchangecomplete) | 2338 | if (!(txtid->state & AGGR_ADDBA_COMPLETE)) { |
2339 | return AGGR_EXCHANGE_DONE; | 2339 | if (!(txtid->state & AGGR_ADDBA_PROGRESS) && |
2340 | |||
2341 | if (txtid->cleanup_inprogress) | ||
2342 | return AGGR_CLEANUP_PROGRESS; | ||
2343 | |||
2344 | if (txtid->addba_exchangeinprogress) | ||
2345 | return AGGR_EXCHANGE_PROGRESS; | ||
2346 | |||
2347 | if (!txtid->addba_exchangecomplete) { | ||
2348 | if (!txtid->addba_exchangeinprogress && | ||
2349 | (txtid->addba_exchangeattempts < ADDBA_EXCHANGE_ATTEMPTS)) { | 2340 | (txtid->addba_exchangeattempts < ADDBA_EXCHANGE_ATTEMPTS)) { |
2350 | txtid->addba_exchangeattempts++; | 2341 | txtid->addba_exchangeattempts++; |
2351 | return AGGR_REQUIRED; | 2342 | return AGGR_REQUIRED; |
@@ -2367,7 +2358,7 @@ int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
2367 | 2358 | ||
2368 | if (sc->sc_flags & SC_OP_TXAGGR) { | 2359 | if (sc->sc_flags & SC_OP_TXAGGR) { |
2369 | txtid = ATH_AN_2_TID(an, tid); | 2360 | txtid = ATH_AN_2_TID(an, tid); |
2370 | txtid->addba_exchangeinprogress = 1; | 2361 | txtid->state |= AGGR_ADDBA_PROGRESS; |
2371 | ath_tx_pause_tid(sc, txtid); | 2362 | ath_tx_pause_tid(sc, txtid); |
2372 | } | 2363 | } |
2373 | 2364 | ||
@@ -2401,10 +2392,10 @@ void ath_tx_aggr_teardown(struct ath_softc *sc, struct ath_node *an, u8 tid) | |||
2401 | 2392 | ||
2402 | DPRINTF(sc, ATH_DBG_AGGR, "%s: teardown TX aggregation\n", __func__); | 2393 | DPRINTF(sc, ATH_DBG_AGGR, "%s: teardown TX aggregation\n", __func__); |
2403 | 2394 | ||
2404 | if (txtid->cleanup_inprogress) /* cleanup is in progress */ | 2395 | if (txtid->state & AGGR_CLEANUP) /* cleanup is in progress */ |
2405 | return; | 2396 | return; |
2406 | 2397 | ||
2407 | if (!txtid->addba_exchangecomplete) { | 2398 | if (!(txtid->state & AGGR_ADDBA_COMPLETE)) { |
2408 | txtid->addba_exchangeattempts = 0; | 2399 | txtid->addba_exchangeattempts = 0; |
2409 | return; | 2400 | return; |
2410 | } | 2401 | } |
@@ -2434,9 +2425,9 @@ void ath_tx_aggr_teardown(struct ath_softc *sc, struct ath_node *an, u8 tid) | |||
2434 | 2425 | ||
2435 | if (txtid->baw_head != txtid->baw_tail) { | 2426 | if (txtid->baw_head != txtid->baw_tail) { |
2436 | spin_unlock_bh(&txq->axq_lock); | 2427 | spin_unlock_bh(&txq->axq_lock); |
2437 | txtid->cleanup_inprogress = true; | 2428 | txtid->state |= AGGR_CLEANUP; |
2438 | } else { | 2429 | } else { |
2439 | txtid->addba_exchangecomplete = 0; | 2430 | txtid->state &= ~AGGR_ADDBA_COMPLETE; |
2440 | txtid->addba_exchangeattempts = 0; | 2431 | txtid->addba_exchangeattempts = 0; |
2441 | spin_unlock_bh(&txq->axq_lock); | 2432 | spin_unlock_bh(&txq->axq_lock); |
2442 | ath_tx_flush_tid(sc, txtid); | 2433 | ath_tx_flush_tid(sc, txtid); |
@@ -2527,16 +2518,16 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an) | |||
2527 | tid->baw_head = tid->baw_tail = 0; | 2518 | tid->baw_head = tid->baw_tail = 0; |
2528 | tid->sched = false; | 2519 | tid->sched = false; |
2529 | tid->paused = false; | 2520 | tid->paused = false; |
2530 | tid->cleanup_inprogress = false; | 2521 | tid->state &= ~AGGR_CLEANUP; |
2531 | INIT_LIST_HEAD(&tid->buf_q); | 2522 | INIT_LIST_HEAD(&tid->buf_q); |
2532 | 2523 | ||
2533 | acno = TID_TO_WME_AC(tidno); | 2524 | acno = TID_TO_WME_AC(tidno); |
2534 | tid->ac = &an->an_aggr.tx.ac[acno]; | 2525 | tid->ac = &an->an_aggr.tx.ac[acno]; |
2535 | 2526 | ||
2536 | /* ADDBA state */ | 2527 | /* ADDBA state */ |
2537 | tid->addba_exchangecomplete = 0; | 2528 | tid->state &= ~AGGR_ADDBA_COMPLETE; |
2538 | tid->addba_exchangeinprogress = 0; | 2529 | tid->state &= ~AGGR_ADDBA_PROGRESS; |
2539 | tid->addba_exchangeattempts = 0; | 2530 | tid->addba_exchangeattempts = 0; |
2540 | } | 2531 | } |
2541 | 2532 | ||
2542 | /* | 2533 | /* |
@@ -2596,9 +2587,9 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an) | |||
2596 | list_del(&tid->list); | 2587 | list_del(&tid->list); |
2597 | tid->sched = false; | 2588 | tid->sched = false; |
2598 | ath_tid_drain(sc, txq, tid); | 2589 | ath_tid_drain(sc, txq, tid); |
2599 | tid->addba_exchangecomplete = 0; | 2590 | tid->state &= ~AGGR_ADDBA_COMPLETE; |
2600 | tid->addba_exchangeattempts = 0; | 2591 | tid->addba_exchangeattempts = 0; |
2601 | tid->cleanup_inprogress = false; | 2592 | tid->state &= ~AGGR_CLEANUP; |
2602 | } | 2593 | } |
2603 | } | 2594 | } |
2604 | 2595 | ||