aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2010-03-17 16:34:35 -0400
committerReinette Chatre <reinette.chatre@intel.com>2010-03-25 14:19:33 -0400
commit54b81550dd674466fe7d01629d2aab015c545a1e (patch)
treeed589d93ecef142f95379170e35e3224fd580fb4
parent74bcdb33e99f49ef5202dd2f8109945b4570edc2 (diff)
iwlwifi: move agn only rx functions from iwlcore to iwlagn
Identify the rx functions only used by agn driver and move those from iwlcore to iwlagn. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c200
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.h8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c203
5 files changed, 213 insertions, 215 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 6f9d52d04464..3117382cfd48 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -491,7 +491,7 @@ int iwlagn_hw_nic_init(struct iwl_priv *priv)
491 } else 491 } else
492 iwlagn_rx_queue_reset(priv, rxq); 492 iwlagn_rx_queue_reset(priv, rxq);
493 493
494 iwl_rx_replenish(priv); 494 iwlagn_rx_replenish(priv);
495 495
496 iwlagn_rx_init(priv, rxq); 496 iwlagn_rx_init(priv, rxq);
497 497
@@ -511,3 +511,201 @@ int iwlagn_hw_nic_init(struct iwl_priv *priv)
511 511
512 return 0; 512 return 0;
513} 513}
514
515/**
516 * iwlagn_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr
517 */
518static inline __le32 iwlagn_dma_addr2rbd_ptr(struct iwl_priv *priv,
519 dma_addr_t dma_addr)
520{
521 return cpu_to_le32((u32)(dma_addr >> 8));
522}
523
524/**
525 * iwlagn_rx_queue_restock - refill RX queue from pre-allocated pool
526 *
527 * If there are slots in the RX queue that need to be restocked,
528 * and we have free pre-allocated buffers, fill the ranks as much
529 * as we can, pulling from rx_free.
530 *
531 * This moves the 'write' index forward to catch up with 'processed', and
532 * also updates the memory address in the firmware to reference the new
533 * target buffer.
534 */
535void iwlagn_rx_queue_restock(struct iwl_priv *priv)
536{
537 struct iwl_rx_queue *rxq = &priv->rxq;
538 struct list_head *element;
539 struct iwl_rx_mem_buffer *rxb;
540 unsigned long flags;
541 int write;
542
543 spin_lock_irqsave(&rxq->lock, flags);
544 write = rxq->write & ~0x7;
545 while ((iwl_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
546 /* Get next free Rx buffer, remove from free list */
547 element = rxq->rx_free.next;
548 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
549 list_del(element);
550
551 /* Point to Rx buffer via next RBD in circular buffer */
552 rxq->bd[rxq->write] = iwlagn_dma_addr2rbd_ptr(priv,
553 rxb->page_dma);
554 rxq->queue[rxq->write] = rxb;
555 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK;
556 rxq->free_count--;
557 }
558 spin_unlock_irqrestore(&rxq->lock, flags);
559 /* If the pre-allocated buffer pool is dropping low, schedule to
560 * refill it */
561 if (rxq->free_count <= RX_LOW_WATERMARK)
562 queue_work(priv->workqueue, &priv->rx_replenish);
563
564
565 /* If we've added more space for the firmware to place data, tell it.
566 * Increment device's write pointer in multiples of 8. */
567 if (rxq->write_actual != (rxq->write & ~0x7)) {
568 spin_lock_irqsave(&rxq->lock, flags);
569 rxq->need_update = 1;
570 spin_unlock_irqrestore(&rxq->lock, flags);
571 iwl_rx_queue_update_write_ptr(priv, rxq);
572 }
573}
574
575/**
576 * iwlagn_rx_replenish - Move all used packet from rx_used to rx_free
577 *
578 * When moving to rx_free an SKB is allocated for the slot.
579 *
580 * Also restock the Rx queue via iwl_rx_queue_restock.
581 * This is called as a scheduled work item (except for during initialization)
582 */
583void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority)
584{
585 struct iwl_rx_queue *rxq = &priv->rxq;
586 struct list_head *element;
587 struct iwl_rx_mem_buffer *rxb;
588 struct page *page;
589 unsigned long flags;
590 gfp_t gfp_mask = priority;
591
592 while (1) {
593 spin_lock_irqsave(&rxq->lock, flags);
594 if (list_empty(&rxq->rx_used)) {
595 spin_unlock_irqrestore(&rxq->lock, flags);
596 return;
597 }
598 spin_unlock_irqrestore(&rxq->lock, flags);
599
600 if (rxq->free_count > RX_LOW_WATERMARK)
601 gfp_mask |= __GFP_NOWARN;
602
603 if (priv->hw_params.rx_page_order > 0)
604 gfp_mask |= __GFP_COMP;
605
606 /* Alloc a new receive buffer */
607 page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order);
608 if (!page) {
609 if (net_ratelimit())
610 IWL_DEBUG_INFO(priv, "alloc_pages failed, "
611 "order: %d\n",
612 priv->hw_params.rx_page_order);
613
614 if ((rxq->free_count <= RX_LOW_WATERMARK) &&
615 net_ratelimit())
616 IWL_CRIT(priv, "Failed to alloc_pages with %s. Only %u free buffers remaining.\n",
617 priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL",
618 rxq->free_count);
619 /* We don't reschedule replenish work here -- we will
620 * call the restock method and if it still needs
621 * more buffers it will schedule replenish */
622 return;
623 }
624
625 spin_lock_irqsave(&rxq->lock, flags);
626
627 if (list_empty(&rxq->rx_used)) {
628 spin_unlock_irqrestore(&rxq->lock, flags);
629 __free_pages(page, priv->hw_params.rx_page_order);
630 return;
631 }
632 element = rxq->rx_used.next;
633 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
634 list_del(element);
635
636 spin_unlock_irqrestore(&rxq->lock, flags);
637
638 rxb->page = page;
639 /* Get physical address of the RB */
640 rxb->page_dma = pci_map_page(priv->pci_dev, page, 0,
641 PAGE_SIZE << priv->hw_params.rx_page_order,
642 PCI_DMA_FROMDEVICE);
643 /* dma address must be no more than 36 bits */
644 BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36));
645 /* and also 256 byte aligned! */
646 BUG_ON(rxb->page_dma & DMA_BIT_MASK(8));
647
648 spin_lock_irqsave(&rxq->lock, flags);
649
650 list_add_tail(&rxb->list, &rxq->rx_free);
651 rxq->free_count++;
652 priv->alloc_rxb_page++;
653
654 spin_unlock_irqrestore(&rxq->lock, flags);
655 }
656}
657
658void iwlagn_rx_replenish(struct iwl_priv *priv)
659{
660 unsigned long flags;
661
662 iwlagn_rx_allocate(priv, GFP_KERNEL);
663
664 spin_lock_irqsave(&priv->lock, flags);
665 iwlagn_rx_queue_restock(priv);
666 spin_unlock_irqrestore(&priv->lock, flags);
667}
668
669void iwlagn_rx_replenish_now(struct iwl_priv *priv)
670{
671 iwlagn_rx_allocate(priv, GFP_ATOMIC);
672
673 iwlagn_rx_queue_restock(priv);
674}
675
676/* Assumes that the skb field of the buffers in 'pool' is kept accurate.
677 * If an SKB has been detached, the POOL needs to have its SKB set to NULL
678 * This free routine walks the list of POOL entries and if SKB is set to
679 * non NULL it is unmapped and freed
680 */
681void iwlagn_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
682{
683 int i;
684 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
685 if (rxq->pool[i].page != NULL) {
686 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
687 PAGE_SIZE << priv->hw_params.rx_page_order,
688 PCI_DMA_FROMDEVICE);
689 __iwl_free_pages(priv, rxq->pool[i].page);
690 rxq->pool[i].page = NULL;
691 }
692 }
693
694 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
695 rxq->dma_addr);
696 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status),
697 rxq->rb_stts, rxq->rb_stts_dma);
698 rxq->bd = NULL;
699 rxq->rb_stts = NULL;
700}
701
702int iwlagn_rxq_stop(struct iwl_priv *priv)
703{
704
705 /* stop Rx DMA */
706 iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
707 iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG,
708 FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
709
710 return 0;
711}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index a57933b8f6fa..d9a287b639bf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1015,7 +1015,7 @@ void iwl_rx_handle(struct iwl_priv *priv)
1015 count++; 1015 count++;
1016 if (count >= 8) { 1016 if (count >= 8) {
1017 rxq->read = i; 1017 rxq->read = i;
1018 iwl_rx_replenish_now(priv); 1018 iwlagn_rx_replenish_now(priv);
1019 count = 0; 1019 count = 0;
1020 } 1020 }
1021 } 1021 }
@@ -1024,9 +1024,9 @@ void iwl_rx_handle(struct iwl_priv *priv)
1024 /* Backtrack one entry */ 1024 /* Backtrack one entry */
1025 rxq->read = i; 1025 rxq->read = i;
1026 if (fill_rx) 1026 if (fill_rx)
1027 iwl_rx_replenish_now(priv); 1027 iwlagn_rx_replenish_now(priv);
1028 else 1028 else
1029 iwl_rx_queue_restock(priv); 1029 iwlagn_rx_queue_restock(priv);
1030} 1030}
1031 1031
1032/* call this function to flush any scheduled tasklet */ 1032/* call this function to flush any scheduled tasklet */
@@ -2250,7 +2250,7 @@ static void __iwl_down(struct iwl_priv *priv)
2250 iwl_disable_ict(priv); 2250 iwl_disable_ict(priv);
2251 2251
2252 iwlagn_txq_ctx_stop(priv); 2252 iwlagn_txq_ctx_stop(priv);
2253 iwl_rxq_stop(priv); 2253 iwlagn_rxq_stop(priv);
2254 2254
2255 /* Power-down device's busmaster DMA clocks */ 2255 /* Power-down device's busmaster DMA clocks */
2256 iwl_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT); 2256 iwl_write_prph(priv, APMG_CLK_DIS_REG, APMG_CLK_VAL_DMA_CLK_RQT);
@@ -2521,7 +2521,7 @@ static void iwl_bg_rx_replenish(struct work_struct *data)
2521 return; 2521 return;
2522 2522
2523 mutex_lock(&priv->mutex); 2523 mutex_lock(&priv->mutex);
2524 iwl_rx_replenish(priv); 2524 iwlagn_rx_replenish(priv);
2525 mutex_unlock(&priv->mutex); 2525 mutex_unlock(&priv->mutex);
2526} 2526}
2527 2527
@@ -3737,7 +3737,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
3737 iwl_dealloc_ucode_pci(priv); 3737 iwl_dealloc_ucode_pci(priv);
3738 3738
3739 if (priv->rxq.bd) 3739 if (priv->rxq.bd)
3740 iwl_rx_queue_free(priv, &priv->rxq); 3740 iwlagn_rx_queue_free(priv, &priv->rxq);
3741 iwlagn_hw_txq_ctx_free(priv); 3741 iwlagn_hw_txq_ctx_free(priv);
3742 3742
3743 iwl_eeprom_free(priv); 3743 iwl_eeprom_free(priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index c75a767872f7..48f7de0914cb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -117,6 +117,14 @@ void iwlagn_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq);
117int iwlagn_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq); 117int iwlagn_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq);
118int iwlagn_hw_nic_init(struct iwl_priv *priv); 118int iwlagn_hw_nic_init(struct iwl_priv *priv);
119 119
120/* rx */
121void iwlagn_rx_queue_restock(struct iwl_priv *priv);
122void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority);
123void iwlagn_rx_replenish(struct iwl_priv *priv);
124void iwlagn_rx_replenish_now(struct iwl_priv *priv);
125void iwlagn_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq);
126int iwlagn_rxq_stop(struct iwl_priv *priv);
127
120/* tx */ 128/* tx */
121int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb); 129int iwlagn_tx_skb(struct iwl_priv *priv, struct sk_buff *skb);
122int iwlagn_tx_agg_start(struct iwl_priv *priv, 130int iwlagn_tx_agg_start(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 446d27bd4301..7c6ac34940fe 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -419,17 +419,12 @@ void iwl_rx_reply_error(struct iwl_priv *priv,
419/***************************************************** 419/*****************************************************
420* RX 420* RX
421******************************************************/ 421******************************************************/
422void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq);
423void iwl_cmd_queue_free(struct iwl_priv *priv); 422void iwl_cmd_queue_free(struct iwl_priv *priv);
424int iwl_rx_queue_alloc(struct iwl_priv *priv); 423int iwl_rx_queue_alloc(struct iwl_priv *priv);
425void iwl_rx_handle(struct iwl_priv *priv); 424void iwl_rx_handle(struct iwl_priv *priv);
426void iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, 425void iwl_rx_queue_update_write_ptr(struct iwl_priv *priv,
427 struct iwl_rx_queue *q); 426 struct iwl_rx_queue *q);
428void iwl_rx_replenish(struct iwl_priv *priv);
429void iwl_rx_replenish_now(struct iwl_priv *priv);
430void iwl_rx_queue_restock(struct iwl_priv *priv);
431int iwl_rx_queue_space(const struct iwl_rx_queue *q); 427int iwl_rx_queue_space(const struct iwl_rx_queue *q);
432void iwl_rx_allocate(struct iwl_priv *priv, gfp_t priority);
433void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb); 428void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb);
434/* Handlers */ 429/* Handlers */
435void iwl_rx_missed_beacon_notif(struct iwl_priv *priv, 430void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index b75c3ccd1c43..45230c6a7899 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -162,197 +162,6 @@ void iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q
162 spin_unlock_irqrestore(&q->lock, flags); 162 spin_unlock_irqrestore(&q->lock, flags);
163} 163}
164EXPORT_SYMBOL(iwl_rx_queue_update_write_ptr); 164EXPORT_SYMBOL(iwl_rx_queue_update_write_ptr);
165/**
166 * iwl_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr
167 */
168static inline __le32 iwl_dma_addr2rbd_ptr(struct iwl_priv *priv,
169 dma_addr_t dma_addr)
170{
171 return cpu_to_le32((u32)(dma_addr >> 8));
172}
173
174/**
175 * iwl_rx_queue_restock - refill RX queue from pre-allocated pool
176 *
177 * If there are slots in the RX queue that need to be restocked,
178 * and we have free pre-allocated buffers, fill the ranks as much
179 * as we can, pulling from rx_free.
180 *
181 * This moves the 'write' index forward to catch up with 'processed', and
182 * also updates the memory address in the firmware to reference the new
183 * target buffer.
184 */
185void iwl_rx_queue_restock(struct iwl_priv *priv)
186{
187 struct iwl_rx_queue *rxq = &priv->rxq;
188 struct list_head *element;
189 struct iwl_rx_mem_buffer *rxb;
190 unsigned long flags;
191 int write;
192
193 spin_lock_irqsave(&rxq->lock, flags);
194 write = rxq->write & ~0x7;
195 while ((iwl_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
196 /* Get next free Rx buffer, remove from free list */
197 element = rxq->rx_free.next;
198 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
199 list_del(element);
200
201 /* Point to Rx buffer via next RBD in circular buffer */
202 rxq->bd[rxq->write] = iwl_dma_addr2rbd_ptr(priv, rxb->page_dma);
203 rxq->queue[rxq->write] = rxb;
204 rxq->write = (rxq->write + 1) & RX_QUEUE_MASK;
205 rxq->free_count--;
206 }
207 spin_unlock_irqrestore(&rxq->lock, flags);
208 /* If the pre-allocated buffer pool is dropping low, schedule to
209 * refill it */
210 if (rxq->free_count <= RX_LOW_WATERMARK)
211 queue_work(priv->workqueue, &priv->rx_replenish);
212
213
214 /* If we've added more space for the firmware to place data, tell it.
215 * Increment device's write pointer in multiples of 8. */
216 if (rxq->write_actual != (rxq->write & ~0x7)) {
217 spin_lock_irqsave(&rxq->lock, flags);
218 rxq->need_update = 1;
219 spin_unlock_irqrestore(&rxq->lock, flags);
220 iwl_rx_queue_update_write_ptr(priv, rxq);
221 }
222}
223EXPORT_SYMBOL(iwl_rx_queue_restock);
224
225
226/**
227 * iwl_rx_replenish - Move all used packet from rx_used to rx_free
228 *
229 * When moving to rx_free an SKB is allocated for the slot.
230 *
231 * Also restock the Rx queue via iwl_rx_queue_restock.
232 * This is called as a scheduled work item (except for during initialization)
233 */
234void iwl_rx_allocate(struct iwl_priv *priv, gfp_t priority)
235{
236 struct iwl_rx_queue *rxq = &priv->rxq;
237 struct list_head *element;
238 struct iwl_rx_mem_buffer *rxb;
239 struct page *page;
240 unsigned long flags;
241 gfp_t gfp_mask = priority;
242
243 while (1) {
244 spin_lock_irqsave(&rxq->lock, flags);
245 if (list_empty(&rxq->rx_used)) {
246 spin_unlock_irqrestore(&rxq->lock, flags);
247 return;
248 }
249 spin_unlock_irqrestore(&rxq->lock, flags);
250
251 if (rxq->free_count > RX_LOW_WATERMARK)
252 gfp_mask |= __GFP_NOWARN;
253
254 if (priv->hw_params.rx_page_order > 0)
255 gfp_mask |= __GFP_COMP;
256
257 /* Alloc a new receive buffer */
258 page = alloc_pages(gfp_mask, priv->hw_params.rx_page_order);
259 if (!page) {
260 if (net_ratelimit())
261 IWL_DEBUG_INFO(priv, "alloc_pages failed, "
262 "order: %d\n",
263 priv->hw_params.rx_page_order);
264
265 if ((rxq->free_count <= RX_LOW_WATERMARK) &&
266 net_ratelimit())
267 IWL_CRIT(priv, "Failed to alloc_pages with %s. Only %u free buffers remaining.\n",
268 priority == GFP_ATOMIC ? "GFP_ATOMIC" : "GFP_KERNEL",
269 rxq->free_count);
270 /* We don't reschedule replenish work here -- we will
271 * call the restock method and if it still needs
272 * more buffers it will schedule replenish */
273 return;
274 }
275
276 spin_lock_irqsave(&rxq->lock, flags);
277
278 if (list_empty(&rxq->rx_used)) {
279 spin_unlock_irqrestore(&rxq->lock, flags);
280 __free_pages(page, priv->hw_params.rx_page_order);
281 return;
282 }
283 element = rxq->rx_used.next;
284 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
285 list_del(element);
286
287 spin_unlock_irqrestore(&rxq->lock, flags);
288
289 rxb->page = page;
290 /* Get physical address of the RB */
291 rxb->page_dma = pci_map_page(priv->pci_dev, page, 0,
292 PAGE_SIZE << priv->hw_params.rx_page_order,
293 PCI_DMA_FROMDEVICE);
294 /* dma address must be no more than 36 bits */
295 BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36));
296 /* and also 256 byte aligned! */
297 BUG_ON(rxb->page_dma & DMA_BIT_MASK(8));
298
299 spin_lock_irqsave(&rxq->lock, flags);
300
301 list_add_tail(&rxb->list, &rxq->rx_free);
302 rxq->free_count++;
303 priv->alloc_rxb_page++;
304
305 spin_unlock_irqrestore(&rxq->lock, flags);
306 }
307}
308
309void iwl_rx_replenish(struct iwl_priv *priv)
310{
311 unsigned long flags;
312
313 iwl_rx_allocate(priv, GFP_KERNEL);
314
315 spin_lock_irqsave(&priv->lock, flags);
316 iwl_rx_queue_restock(priv);
317 spin_unlock_irqrestore(&priv->lock, flags);
318}
319EXPORT_SYMBOL(iwl_rx_replenish);
320
321void iwl_rx_replenish_now(struct iwl_priv *priv)
322{
323 iwl_rx_allocate(priv, GFP_ATOMIC);
324
325 iwl_rx_queue_restock(priv);
326}
327EXPORT_SYMBOL(iwl_rx_replenish_now);
328
329
330/* Assumes that the skb field of the buffers in 'pool' is kept accurate.
331 * If an SKB has been detached, the POOL needs to have its SKB set to NULL
332 * This free routine walks the list of POOL entries and if SKB is set to
333 * non NULL it is unmapped and freed
334 */
335void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
336{
337 int i;
338 for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
339 if (rxq->pool[i].page != NULL) {
340 pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
341 PAGE_SIZE << priv->hw_params.rx_page_order,
342 PCI_DMA_FROMDEVICE);
343 __iwl_free_pages(priv, rxq->pool[i].page);
344 rxq->pool[i].page = NULL;
345 }
346 }
347
348 dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd,
349 rxq->dma_addr);
350 dma_free_coherent(&priv->pci_dev->dev, sizeof(struct iwl_rb_status),
351 rxq->rb_stts, rxq->rb_stts_dma);
352 rxq->bd = NULL;
353 rxq->rb_stts = NULL;
354}
355EXPORT_SYMBOL(iwl_rx_queue_free);
356 165
357int iwl_rx_queue_alloc(struct iwl_priv *priv) 166int iwl_rx_queue_alloc(struct iwl_priv *priv)
358{ 167{
@@ -395,18 +204,6 @@ err_bd:
395} 204}
396EXPORT_SYMBOL(iwl_rx_queue_alloc); 205EXPORT_SYMBOL(iwl_rx_queue_alloc);
397 206
398int iwl_rxq_stop(struct iwl_priv *priv)
399{
400
401 /* stop Rx DMA */
402 iwl_write_direct32(priv, FH_MEM_RCSR_CHNL0_CONFIG_REG, 0);
403 iwl_poll_direct_bit(priv, FH_MEM_RSSR_RX_STATUS_REG,
404 FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
405
406 return 0;
407}
408EXPORT_SYMBOL(iwl_rxq_stop);
409
410void iwl_rx_missed_beacon_notif(struct iwl_priv *priv, 207void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
411 struct iwl_rx_mem_buffer *rxb) 208 struct iwl_rx_mem_buffer *rxb)
412 209