aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.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/iwl3945-base.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/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c27
1 files changed, 15 insertions, 12 deletions
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