diff options
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 27 |
2 files changed, 30 insertions, 24 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 0d3886505205..ea1b9315f17c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -769,7 +769,7 @@ void iwl_rx_handle(struct iwl_priv *priv) | |||
769 | IWL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); | 769 | IWL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i); |
770 | 770 | ||
771 | /* calculate total frames need to be restock after handling RX */ | 771 | /* calculate total frames need to be restock after handling RX */ |
772 | total_empty = r - priv->rxq.write_actual; | 772 | total_empty = r - rxq->write_actual; |
773 | if (total_empty < 0) | 773 | if (total_empty < 0) |
774 | total_empty += RX_QUEUE_SIZE; | 774 | total_empty += RX_QUEUE_SIZE; |
775 | 775 | ||
@@ -841,25 +841,28 @@ void iwl_rx_handle(struct iwl_priv *priv) | |||
841 | IWL_WARN(priv, "Claim null rxb?\n"); | 841 | IWL_WARN(priv, "Claim null rxb?\n"); |
842 | } | 842 | } |
843 | 843 | ||
844 | /* For now we just don't re-use anything. We can tweak this | 844 | /* Reuse the page if possible. For notification packets and |
845 | * later to try and re-use notification packets and SKBs that | 845 | * SKBs that fail to Rx correctly, add them back into the |
846 | * fail to Rx correctly */ | 846 | * rx_free list for reuse later. */ |
847 | spin_lock_irqsave(&rxq->lock, flags); | ||
847 | if (rxb->page != NULL) { | 848 | if (rxb->page != NULL) { |
848 | priv->alloc_rxb_page--; | 849 | rxb->page_dma = pci_map_page(priv->pci_dev, rxb->page, |
849 | __free_pages(rxb->page, priv->hw_params.rx_page_order); | 850 | 0, PAGE_SIZE << priv->hw_params.rx_page_order, |
850 | rxb->page = NULL; | 851 | PCI_DMA_FROMDEVICE); |
851 | } | 852 | list_add_tail(&rxb->list, &rxq->rx_free); |
853 | rxq->free_count++; | ||
854 | } else | ||
855 | list_add_tail(&rxb->list, &rxq->rx_used); | ||
852 | 856 | ||
853 | spin_lock_irqsave(&rxq->lock, flags); | ||
854 | list_add_tail(&rxb->list, &priv->rxq.rx_used); | ||
855 | spin_unlock_irqrestore(&rxq->lock, flags); | 857 | spin_unlock_irqrestore(&rxq->lock, flags); |
858 | |||
856 | i = (i + 1) & RX_QUEUE_MASK; | 859 | i = (i + 1) & RX_QUEUE_MASK; |
857 | /* If there are a lot of unused frames, | 860 | /* If there are a lot of unused frames, |
858 | * restock the Rx queue so ucode wont assert. */ | 861 | * restock the Rx queue so ucode wont assert. */ |
859 | if (fill_rx) { | 862 | if (fill_rx) { |
860 | count++; | 863 | count++; |
861 | if (count >= 8) { | 864 | if (count >= 8) { |
862 | priv->rxq.read = i; | 865 | rxq->read = i; |
863 | iwl_rx_replenish_now(priv); | 866 | iwl_rx_replenish_now(priv); |
864 | count = 0; | 867 | count = 0; |
865 | } | 868 | } |
@@ -867,7 +870,7 @@ void iwl_rx_handle(struct iwl_priv *priv) | |||
867 | } | 870 | } |
868 | 871 | ||
869 | /* Backtrack one entry */ | 872 | /* Backtrack one entry */ |
870 | priv->rxq.read = i; | 873 | rxq->read = i; |
871 | if (fill_rx) | 874 | if (fill_rx) |
872 | iwl_rx_replenish_now(priv); | 875 | iwl_rx_replenish_now(priv); |
873 | else | 876 | else |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 8b08bdc10bc9..9a430eed34ad 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -1367,7 +1367,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv) | |||
1367 | i = rxq->read; | 1367 | i = rxq->read; |
1368 | 1368 | ||
1369 | /* calculate total frames need to be restock after handling RX */ | 1369 | /* calculate total frames need to be restock after handling RX */ |
1370 | total_empty = r - priv->rxq.write_actual; | 1370 | total_empty = r - rxq->write_actual; |
1371 | if (total_empty < 0) | 1371 | if (total_empty < 0) |
1372 | total_empty += RX_QUEUE_SIZE; | 1372 | total_empty += RX_QUEUE_SIZE; |
1373 | 1373 | ||
@@ -1438,25 +1438,28 @@ static void iwl3945_rx_handle(struct iwl_priv *priv) | |||
1438 | IWL_WARN(priv, "Claim null rxb?\n"); | 1438 | IWL_WARN(priv, "Claim null rxb?\n"); |
1439 | } | 1439 | } |
1440 | 1440 | ||
1441 | /* For now we just don't re-use anything. We can tweak this | 1441 | /* Reuse the page if possible. For notification packets and |
1442 | * later to try and re-use notification packets and SKBs that | 1442 | * SKBs that fail to Rx correctly, add them back into the |
1443 | * fail to Rx correctly */ | 1443 | * rx_free list for reuse later. */ |
1444 | spin_lock_irqsave(&rxq->lock, flags); | ||
1444 | if (rxb->page != NULL) { | 1445 | if (rxb->page != NULL) { |
1445 | priv->alloc_rxb_page--; | 1446 | rxb->page_dma = pci_map_page(priv->pci_dev, rxb->page, |
1446 | __free_pages(rxb->page, priv->hw_params.rx_page_order); | 1447 | 0, PAGE_SIZE << priv->hw_params.rx_page_order, |
1447 | rxb->page = NULL; | 1448 | PCI_DMA_FROMDEVICE); |
1448 | } | 1449 | list_add_tail(&rxb->list, &rxq->rx_free); |
1450 | rxq->free_count++; | ||
1451 | } else | ||
1452 | list_add_tail(&rxb->list, &rxq->rx_used); | ||
1449 | 1453 | ||
1450 | spin_lock_irqsave(&rxq->lock, flags); | ||
1451 | list_add_tail(&rxb->list, &priv->rxq.rx_used); | ||
1452 | spin_unlock_irqrestore(&rxq->lock, flags); | 1454 | spin_unlock_irqrestore(&rxq->lock, flags); |
1455 | |||
1453 | i = (i + 1) & RX_QUEUE_MASK; | 1456 | i = (i + 1) & RX_QUEUE_MASK; |
1454 | /* If there are a lot of unused frames, | 1457 | /* If there are a lot of unused frames, |
1455 | * restock the Rx queue so ucode won't assert. */ | 1458 | * restock the Rx queue so ucode won't assert. */ |
1456 | if (fill_rx) { | 1459 | if (fill_rx) { |
1457 | count++; | 1460 | count++; |
1458 | if (count >= 8) { | 1461 | if (count >= 8) { |
1459 | priv->rxq.read = i; | 1462 | rxq->read = i; |
1460 | iwl3945_rx_replenish_now(priv); | 1463 | iwl3945_rx_replenish_now(priv); |
1461 | count = 0; | 1464 | count = 0; |
1462 | } | 1465 | } |
@@ -1464,7 +1467,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv) | |||
1464 | } | 1467 | } |
1465 | 1468 | ||
1466 | /* Backtrack one entry */ | 1469 | /* Backtrack one entry */ |
1467 | priv->rxq.read = i; | 1470 | rxq->read = i; |
1468 | if (fill_rx) | 1471 | if (fill_rx) |
1469 | iwl3945_rx_replenish_now(priv); | 1472 | iwl3945_rx_replenish_now(priv); |
1470 | else | 1473 | else |