aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-lib.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index 1d2e84c1fad..6fe1d937187 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -403,6 +403,9 @@ void iwlagn_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
403 list_add_tail(&rxq->pool[i].list, &rxq->rx_used); 403 list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
404 } 404 }
405 405
406 for (i = 0; i < RX_QUEUE_SIZE; i++)
407 rxq->queue[i] = NULL;
408
406 /* Set us so that we have processed and used all buffers, but have 409 /* Set us so that we have processed and used all buffers, but have
407 * not restocked the Rx queue with fresh buffers */ 410 * not restocked the Rx queue with fresh buffers */
408 rxq->read = rxq->write = 0; 411 rxq->read = rxq->write = 0;
@@ -538,11 +541,13 @@ void iwlagn_rx_queue_restock(struct iwl_priv *priv)
538 struct list_head *element; 541 struct list_head *element;
539 struct iwl_rx_mem_buffer *rxb; 542 struct iwl_rx_mem_buffer *rxb;
540 unsigned long flags; 543 unsigned long flags;
541 int write;
542 544
543 spin_lock_irqsave(&rxq->lock, flags); 545 spin_lock_irqsave(&rxq->lock, flags);
544 write = rxq->write & ~0x7;
545 while ((iwl_rx_queue_space(rxq) > 0) && (rxq->free_count)) { 546 while ((iwl_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
547 /* The overwritten rxb must be a used one */
548 rxb = rxq->queue[rxq->write];
549 BUG_ON(rxb && rxb->page);
550
546 /* Get next free Rx buffer, remove from free list */ 551 /* Get next free Rx buffer, remove from free list */
547 element = rxq->rx_free.next; 552 element = rxq->rx_free.next;
548 rxb = list_entry(element, struct iwl_rx_mem_buffer, list); 553 rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
@@ -635,6 +640,7 @@ void iwlagn_rx_allocate(struct iwl_priv *priv, gfp_t priority)
635 640
636 spin_unlock_irqrestore(&rxq->lock, flags); 641 spin_unlock_irqrestore(&rxq->lock, flags);
637 642
643 BUG_ON(rxb->page);
638 rxb->page = page; 644 rxb->page = page;
639 /* Get physical address of the RB */ 645 /* Get physical address of the RB */
640 rxb->page_dma = pci_map_page(priv->pci_dev, page, 0, 646 rxb->page_dma = pci_map_page(priv->pci_dev, page, 0,