aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl4965-base.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-03-06 20:36:53 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-03-07 16:03:01 -0500
commitc54b679ddcd91604fd0d144cd793a0ddbd0ae03d (patch)
tree3ebbedc13d2a64a1c6491ac29c5c3a18e934bc6b /drivers/net/wireless/iwlwifi/iwl4965-base.c
parent34cf6ff6dd42cbc61fd652f893dcf71eed6052a5 (diff)
iwlwifi: queue functions cleanup
This patch moves 1. iwl_queue_inc_wrap and int iwl_queue_dec_wrap into iwl-helpers.h these two functions are identical to common for both iwl3956 and iwl4965 2. renames x2_queue_used to iwl3945_x2_queue_used 3. exports iwl3945_queue_space out of iwl3964-base.c Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c37
1 files changed, 9 insertions, 28 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index af95626a611..28c64c39ef0 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -194,25 +194,6 @@ int iwl4965_queue_space(const struct iwl4965_queue *q)
194 return s; 194 return s;
195} 195}
196 196
197/**
198 * iwl4965_queue_inc_wrap - increment queue index, wrap back to beginning
199 * @index -- current index
200 * @n_bd -- total number of entries in queue (must be power of 2)
201 */
202static inline int iwl4965_queue_inc_wrap(int index, int n_bd)
203{
204 return ++index & (n_bd - 1);
205}
206
207/**
208 * iwl4965_queue_dec_wrap - decrement queue index, wrap back to end
209 * @index -- current index
210 * @n_bd -- total number of entries in queue (must be power of 2)
211 */
212static inline int iwl4965_queue_dec_wrap(int index, int n_bd)
213{
214 return --index & (n_bd - 1);
215}
216 197
217static inline int x2_queue_used(const struct iwl4965_queue *q, int i) 198static inline int x2_queue_used(const struct iwl4965_queue *q, int i)
218{ 199{
@@ -241,8 +222,8 @@ static int iwl4965_queue_init(struct iwl4965_priv *priv, struct iwl4965_queue *q
241 q->n_window = slots_num; 222 q->n_window = slots_num;
242 q->id = id; 223 q->id = id;
243 224
244 /* count must be power-of-two size, otherwise iwl4965_queue_inc_wrap 225 /* count must be power-of-two size, otherwise iwl_queue_inc_wrap
245 * and iwl4965_queue_dec_wrap are broken. */ 226 * and iwl_queue_dec_wrap are broken. */
246 BUG_ON(!is_power_of_2(count)); 227 BUG_ON(!is_power_of_2(count));
247 228
248 /* slots_num must be power-of-two size, otherwise 229 /* slots_num must be power-of-two size, otherwise
@@ -342,7 +323,7 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv,
342 txq->need_update = 0; 323 txq->need_update = 0;
343 324
344 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise 325 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
345 * iwl4965_queue_inc_wrap and iwl4965_queue_dec_wrap are broken. */ 326 * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */
346 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); 327 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
347 328
348 /* Initialize queue's high/low-water marks, and head/tail indexes */ 329 /* Initialize queue's high/low-water marks, and head/tail indexes */
@@ -373,7 +354,7 @@ void iwl4965_tx_queue_free(struct iwl4965_priv *priv, struct iwl4965_tx_queue *t
373 354
374 /* first, empty all BD's */ 355 /* first, empty all BD's */
375 for (; q->write_ptr != q->read_ptr; 356 for (; q->write_ptr != q->read_ptr;
376 q->read_ptr = iwl4965_queue_inc_wrap(q->read_ptr, q->n_bd)) 357 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd))
377 iwl4965_hw_txq_free_tfd(priv, txq); 358 iwl4965_hw_txq_free_tfd(priv, txq);
378 359
379 len = sizeof(struct iwl4965_cmd) * q->n_window; 360 len = sizeof(struct iwl4965_cmd) * q->n_window;
@@ -714,7 +695,7 @@ static int iwl4965_enqueue_hcmd(struct iwl4965_priv *priv, struct iwl4965_host_c
714 ret = iwl4965_tx_queue_update_wr_ptr(priv, txq, 0); 695 ret = iwl4965_tx_queue_update_wr_ptr(priv, txq, 0);
715 696
716 /* Increment and update queue's write index */ 697 /* Increment and update queue's write index */
717 q->write_ptr = iwl4965_queue_inc_wrap(q->write_ptr, q->n_bd); 698 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
718 iwl4965_tx_queue_update_write_ptr(priv, txq); 699 iwl4965_tx_queue_update_write_ptr(priv, txq);
719 700
720 spin_unlock_irqrestore(&priv->hcmd_lock, flags); 701 spin_unlock_irqrestore(&priv->hcmd_lock, flags);
@@ -2897,7 +2878,7 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv,
2897 iwl4965_tx_queue_update_wr_ptr(priv, txq, len); 2878 iwl4965_tx_queue_update_wr_ptr(priv, txq, len);
2898 2879
2899 /* Tell device the write index *just past* this latest filled TFD */ 2880 /* Tell device the write index *just past* this latest filled TFD */
2900 q->write_ptr = iwl4965_queue_inc_wrap(q->write_ptr, q->n_bd); 2881 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
2901 rc = iwl4965_tx_queue_update_write_ptr(priv, txq); 2882 rc = iwl4965_tx_queue_update_write_ptr(priv, txq);
2902 spin_unlock_irqrestore(&priv->lock, flags); 2883 spin_unlock_irqrestore(&priv->lock, flags);
2903 2884
@@ -3291,9 +3272,9 @@ int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index)
3291 return 0; 3272 return 0;
3292 } 3273 }
3293 3274
3294 for (index = iwl4965_queue_inc_wrap(index, q->n_bd); 3275 for (index = iwl_queue_inc_wrap(index, q->n_bd);
3295 q->read_ptr != index; 3276 q->read_ptr != index;
3296 q->read_ptr = iwl4965_queue_inc_wrap(q->read_ptr, q->n_bd)) { 3277 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
3297 if (txq_id != IWL_CMD_QUEUE_NUM) { 3278 if (txq_id != IWL_CMD_QUEUE_NUM) {
3298 iwl4965_txstatus_to_ieee(priv, 3279 iwl4965_txstatus_to_ieee(priv,
3299 &(txq->txb[txq->q.read_ptr])); 3280 &(txq->txb[txq->q.read_ptr]));
@@ -3538,7 +3519,7 @@ static void iwl4965_rx_reply_tx(struct iwl4965_priv *priv,
3538 3519
3539 if (txq->q.read_ptr != (scd_ssn & 0xff)) { 3520 if (txq->q.read_ptr != (scd_ssn & 0xff)) {
3540 int freed; 3521 int freed;
3541 index = iwl4965_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); 3522 index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd);
3542 IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn " 3523 IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn "
3543 "%d index %d\n", scd_ssn , index); 3524 "%d index %d\n", scd_ssn , index);
3544 freed = iwl4965_tx_queue_reclaim(priv, txq_id, index); 3525 freed = iwl4965_tx_queue_reclaim(priv, txq_id, index);