aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn.c
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2009-10-23 16:42:32 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-27 16:50:03 -0400
commit7300515d1095aa11731866da7c9b000f2edb4626 (patch)
tree1b01fe8ba04d476169f2da66951807b67f647091 /drivers/net/wireless/iwlwifi/iwl-agn.c
parent71c55d90f9733abdf5e4e0bc24f71e189cefeea6 (diff)
iwlwifi: reuse page for notification packets
For notification packets and SKBs that fail to rx correctly, add them back into the rx_free list so that the pages can be reused later. This avoids allocating new rx pages unnecessarily. Signed-off-by: Zhu Yi <yi.zhu@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/iwl-agn.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c27
1 files changed, 15 insertions, 12 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