aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-08-26 02:11:32 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-29 15:33:01 -0400
commit8ad71bef4a9d8173cbcfbb2f796b08d33d4ca01b (patch)
treebce072b23b431864bda8f2d9efa3baad90309905 /drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
parente20d434170c3a7f388d5e916825499c9c0738606 (diff)
iwlagn: move tx queues to transport layer
This finalizes the move of the data path to the transport layer. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h50
1 files changed, 46 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
index 255b326bf0e9..ec4e73737681 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
@@ -125,6 +125,10 @@ struct iwl_dma_ptr {
125 * @ac_to_fifo: to what fifo is a specifc AC mapped ? 125 * @ac_to_fifo: to what fifo is a specifc AC mapped ?
126 * @ac_to_queue: to what tx queue is a specifc AC mapped ? 126 * @ac_to_queue: to what tx queue is a specifc AC mapped ?
127 * @mcast_queue: 127 * @mcast_queue:
128 * @txq: Tx DMA processing queues
129 * @txq_ctx_active_msk: what queue is active
130 * queue_stopped: tracks what queue is stopped
131 * queue_stop_count: tracks what SW queue is stopped
128 */ 132 */
129struct iwl_trans_pcie { 133struct iwl_trans_pcie {
130 struct iwl_rx_queue rxq; 134 struct iwl_rx_queue rxq;
@@ -150,6 +154,12 @@ struct iwl_trans_pcie {
150 const u8 *ac_to_fifo[NUM_IWL_RXON_CTX]; 154 const u8 *ac_to_fifo[NUM_IWL_RXON_CTX];
151 const u8 *ac_to_queue[NUM_IWL_RXON_CTX]; 155 const u8 *ac_to_queue[NUM_IWL_RXON_CTX];
152 u8 mcast_queue[NUM_IWL_RXON_CTX]; 156 u8 mcast_queue[NUM_IWL_RXON_CTX];
157
158 struct iwl_tx_queue *txq;
159 unsigned long txq_ctx_active_msk;
160#define IWL_MAX_HW_QUEUES 32
161 unsigned long queue_stopped[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)];
162 atomic_t queue_stop_count[4];
153}; 163};
154 164
155#define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \ 165#define IWL_TRANS_GET_PCIE_TRANS(_iwl_trans) \
@@ -207,6 +217,7 @@ void iwlagn_txq_free_tfd(struct iwl_trans *trans, struct iwl_tx_queue *txq,
207 int index); 217 int index);
208int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index, 218int iwl_tx_queue_reclaim(struct iwl_trans *trans, int txq_id, int index,
209 struct sk_buff_head *skbs); 219 struct sk_buff_head *skbs);
220int iwl_queue_space(const struct iwl_queue *q);
210 221
211/***************************************************** 222/*****************************************************
212* Error handling 223* Error handling
@@ -216,6 +227,9 @@ int iwl_dump_nic_event_log(struct iwl_trans *trans, bool full_log,
216int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display); 227int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display);
217void iwl_dump_csr(struct iwl_trans *trans); 228void iwl_dump_csr(struct iwl_trans *trans);
218 229
230/*****************************************************
231* Helpers
232******************************************************/
219static inline void iwl_disable_interrupts(struct iwl_trans *trans) 233static inline void iwl_disable_interrupts(struct iwl_trans *trans)
220{ 234{
221 clear_bit(STATUS_INT_ENABLED, &trans->shrd->status); 235 clear_bit(STATUS_INT_ENABLED, &trans->shrd->status);
@@ -265,12 +279,14 @@ static inline void iwl_wake_queue(struct iwl_trans *trans,
265 u8 queue = txq->swq_id; 279 u8 queue = txq->swq_id;
266 u8 ac = queue & 3; 280 u8 ac = queue & 3;
267 u8 hwq = (queue >> 2) & 0x1f; 281 u8 hwq = (queue >> 2) & 0x1f;
282 struct iwl_trans_pcie *trans_pcie =
283 IWL_TRANS_GET_PCIE_TRANS(trans);
268 284
269 if (unlikely(!trans->shrd->mac80211_registered)) 285 if (unlikely(!trans->shrd->mac80211_registered))
270 return; 286 return;
271 287
272 if (test_and_clear_bit(hwq, priv(trans)->queue_stopped)) 288 if (test_and_clear_bit(hwq, trans_pcie->queue_stopped))
273 if (atomic_dec_return(&priv(trans)->queue_stop_count[ac]) <= 0) 289 if (atomic_dec_return(&trans_pcie->queue_stop_count[ac]) <= 0)
274 ieee80211_wake_queue(trans->shrd->hw, ac); 290 ieee80211_wake_queue(trans->shrd->hw, ac);
275} 291}
276 292
@@ -280,12 +296,14 @@ static inline void iwl_stop_queue(struct iwl_trans *trans,
280 u8 queue = txq->swq_id; 296 u8 queue = txq->swq_id;
281 u8 ac = queue & 3; 297 u8 ac = queue & 3;
282 u8 hwq = (queue >> 2) & 0x1f; 298 u8 hwq = (queue >> 2) & 0x1f;
299 struct iwl_trans_pcie *trans_pcie =
300 IWL_TRANS_GET_PCIE_TRANS(trans);
283 301
284 if (unlikely(!trans->shrd->mac80211_registered)) 302 if (unlikely(!trans->shrd->mac80211_registered))
285 return; 303 return;
286 304
287 if (!test_and_set_bit(hwq, priv(trans)->queue_stopped)) 305 if (!test_and_set_bit(hwq, trans_pcie->queue_stopped))
288 if (atomic_inc_return(&priv(trans)->queue_stop_count[ac]) > 0) 306 if (atomic_inc_return(&trans_pcie->queue_stop_count[ac]) > 0)
289 ieee80211_stop_queue(trans->shrd->hw, ac); 307 ieee80211_stop_queue(trans->shrd->hw, ac);
290} 308}
291 309
@@ -301,4 +319,28 @@ static inline void iwl_stop_queue(struct iwl_trans *trans,
301 319
302#define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue 320#define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue
303 321
322static inline void iwl_txq_ctx_activate(struct iwl_trans_pcie *trans_pcie,
323 int txq_id)
324{
325 set_bit(txq_id, &trans_pcie->txq_ctx_active_msk);
326}
327
328static inline void iwl_txq_ctx_deactivate(struct iwl_trans_pcie *trans_pcie,
329 int txq_id)
330{
331 clear_bit(txq_id, &trans_pcie->txq_ctx_active_msk);
332}
333
334static inline int iwl_queue_used(const struct iwl_queue *q, int i)
335{
336 return q->write_ptr >= q->read_ptr ?
337 (i >= q->read_ptr && i < q->write_ptr) :
338 !(i < q->read_ptr && i >= q->write_ptr);
339}
340
341static inline u8 get_cmd_index(struct iwl_queue *q, u32 index)
342{
343 return index & (q->n_window - 1);
344}
345
304#endif /* __iwl_trans_int_pcie_h__ */ 346#endif /* __iwl_trans_int_pcie_h__ */