diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2013-06-12 10:44:48 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-06-12 15:06:56 -0400 |
commit | c6af8074fd3654b2a8d7b31304d686519b062e14 (patch) | |
tree | e16bf5725825ba7ac83013811ea3ff9b1f0ff4ef /drivers/net/wireless | |
parent | 42ce8943e14734dd388e6934fff31a11c1adad8f (diff) |
iwlegacy: add il_{stop,wake}_queues_by_reason functions
Add functions that will stop/wake all queues. Make them safe
regarding multiple calls and when some ac are stopped/woke
independently.
Tested-by: Jake Edge <jake@lwn.net>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/iwlegacy/common.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index 67da89b39e11..83f8ed8a5528 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h | |||
@@ -1299,6 +1299,8 @@ struct il_priv { | |||
1299 | /* queue refcounts */ | 1299 | /* queue refcounts */ |
1300 | #define IL_MAX_HW_QUEUES 32 | 1300 | #define IL_MAX_HW_QUEUES 32 |
1301 | unsigned long queue_stopped[BITS_TO_LONGS(IL_MAX_HW_QUEUES)]; | 1301 | unsigned long queue_stopped[BITS_TO_LONGS(IL_MAX_HW_QUEUES)]; |
1302 | #define IL_STOP_REASON_PASSIVE 0 | ||
1303 | unsigned long stop_reason; | ||
1302 | /* for each AC */ | 1304 | /* for each AC */ |
1303 | atomic_t queue_stop_count[4]; | 1305 | atomic_t queue_stop_count[4]; |
1304 | 1306 | ||
@@ -2291,6 +2293,26 @@ il_stop_queue(struct il_priv *il, struct il_tx_queue *txq) | |||
2291 | _il_stop_queue(il, ac); | 2293 | _il_stop_queue(il, ac); |
2292 | } | 2294 | } |
2293 | 2295 | ||
2296 | static inline void | ||
2297 | il_wake_queues_by_reason(struct il_priv *il, int reason) | ||
2298 | { | ||
2299 | u8 ac; | ||
2300 | |||
2301 | if (test_and_clear_bit(reason, &il->stop_reason)) | ||
2302 | for (ac = 0; ac < 4; ac++) | ||
2303 | _il_wake_queue(il, ac); | ||
2304 | } | ||
2305 | |||
2306 | static inline void | ||
2307 | il_stop_queues_by_reason(struct il_priv *il, int reason) | ||
2308 | { | ||
2309 | u8 ac; | ||
2310 | |||
2311 | if (!test_and_set_bit(reason, &il->stop_reason)) | ||
2312 | for (ac = 0; ac < 4; ac++) | ||
2313 | _il_stop_queue(il, ac); | ||
2314 | } | ||
2315 | |||
2294 | #ifdef ieee80211_stop_queue | 2316 | #ifdef ieee80211_stop_queue |
2295 | #undef ieee80211_stop_queue | 2317 | #undef ieee80211_stop_queue |
2296 | #endif | 2318 | #endif |