aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
index abb2ce68deec..255b326bf0e9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
@@ -240,4 +240,65 @@ static inline void iwl_enable_interrupts(struct iwl_trans *trans)
240 iwl_write32(bus(trans), CSR_INT_MASK, trans_pcie->inta_mask); 240 iwl_write32(bus(trans), CSR_INT_MASK, trans_pcie->inta_mask);
241} 241}
242 242
243/*
244 * we have 8 bits used like this:
245 *
246 * 7 6 5 4 3 2 1 0
247 * | | | | | | | |
248 * | | | | | | +-+-------- AC queue (0-3)
249 * | | | | | |
250 * | +-+-+-+-+------------ HW queue ID
251 * |
252 * +---------------------- unused
253 */
254static inline void iwl_set_swq_id(struct iwl_tx_queue *txq, u8 ac, u8 hwq)
255{
256 BUG_ON(ac > 3); /* only have 2 bits */
257 BUG_ON(hwq > 31); /* only use 5 bits */
258
259 txq->swq_id = (hwq << 2) | ac;
260}
261
262static inline void iwl_wake_queue(struct iwl_trans *trans,
263 struct iwl_tx_queue *txq)
264{
265 u8 queue = txq->swq_id;
266 u8 ac = queue & 3;
267 u8 hwq = (queue >> 2) & 0x1f;
268
269 if (unlikely(!trans->shrd->mac80211_registered))
270 return;
271
272 if (test_and_clear_bit(hwq, priv(trans)->queue_stopped))
273 if (atomic_dec_return(&priv(trans)->queue_stop_count[ac]) <= 0)
274 ieee80211_wake_queue(trans->shrd->hw, ac);
275}
276
277static inline void iwl_stop_queue(struct iwl_trans *trans,
278 struct iwl_tx_queue *txq)
279{
280 u8 queue = txq->swq_id;
281 u8 ac = queue & 3;
282 u8 hwq = (queue >> 2) & 0x1f;
283
284 if (unlikely(!trans->shrd->mac80211_registered))
285 return;
286
287 if (!test_and_set_bit(hwq, priv(trans)->queue_stopped))
288 if (atomic_inc_return(&priv(trans)->queue_stop_count[ac]) > 0)
289 ieee80211_stop_queue(trans->shrd->hw, ac);
290}
291
292#ifdef ieee80211_stop_queue
293#undef ieee80211_stop_queue
294#endif
295
296#define ieee80211_stop_queue DO_NOT_USE_ieee80211_stop_queue
297
298#ifdef ieee80211_wake_queue
299#undef ieee80211_wake_queue
300#endif
301
302#define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue
303
243#endif /* __iwl_trans_int_pcie_h__ */ 304#endif /* __iwl_trans_int_pcie_h__ */