iwlwifi: allocated rx page accounting cleanup

In iwlwifi, priv->alloc_rxb_page is used to keep track of the Rx
pages allocated by the driver. This cleans up the page free routines
by introducing __iwl_free_pages/iwl_free_pages so that the accounting
is more accurate and less error prone. This also fixes two instances where
the counter was not updated.

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>
This commit is contained in:
Zhu Yi 2009-12-10 14:37:21 -08:00 committed by John W. Linville
parent d24deb2580
commit 64a76b504b
7 changed files with 21 additions and 24 deletions

View File

@ -1835,8 +1835,7 @@ static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
rc = -EIO;
}
priv->alloc_rxb_page--;
free_pages(cmd.reply_page, priv->hw_params.rx_page_order);
iwl_free_pages(priv, cmd.reply_page);
return rc;
}

View File

@ -1353,4 +1353,15 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch)
return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
}
static inline void __iwl_free_pages(struct iwl_priv *priv, struct page *page)
{
__free_pages(page, priv->hw_params.rx_page_order);
priv->alloc_rxb_page--;
}
static inline void iwl_free_pages(struct iwl_priv *priv, unsigned long page)
{
free_pages(page, priv->hw_params.rx_page_order);
priv->alloc_rxb_page--;
}
#endif /* __iwl_dev_h__ */

View File

@ -234,7 +234,7 @@ cancel:
}
fail:
if (cmd->reply_page) {
free_pages(cmd->reply_page, priv->hw_params.rx_page_order);
iwl_free_pages(priv, cmd->reply_page);
cmd->reply_page = 0;
}
out:

View File

@ -345,10 +345,8 @@ void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
PAGE_SIZE << priv->hw_params.rx_page_order,
PCI_DMA_FROMDEVICE);
__free_pages(rxq->pool[i].page,
priv->hw_params.rx_page_order);
__iwl_free_pages(priv, rxq->pool[i].page);
rxq->pool[i].page = NULL;
priv->alloc_rxb_page--;
}
}
@ -416,9 +414,7 @@ void iwl_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
PAGE_SIZE << priv->hw_params.rx_page_order,
PCI_DMA_FROMDEVICE);
priv->alloc_rxb_page--;
__free_pages(rxq->pool[i].page,
priv->hw_params.rx_page_order);
__iwl_free_pages(priv, rxq->pool[i].page);
rxq->pool[i].page = NULL;
}
list_add_tail(&rxq->pool[i].list, &rxq->rx_used);

View File

@ -144,8 +144,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
clear_bit(STATUS_SCAN_HW, &priv->status);
}
priv->alloc_rxb_page--;
free_pages(cmd.reply_page, priv->hw_params.rx_page_order);
iwl_free_pages(priv, cmd.reply_page);
return ret;
}

View File

@ -164,9 +164,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
break;
}
}
priv->alloc_rxb_page--;
free_pages(cmd.reply_page, priv->hw_params.rx_page_order);
iwl_free_pages(priv, cmd.reply_page);
return ret;
}
@ -391,9 +389,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr,
break;
}
}
priv->alloc_rxb_page--;
free_pages(cmd.reply_page, priv->hw_params.rx_page_order);
iwl_free_pages(priv, cmd.reply_page);
return ret;
}

View File

@ -812,7 +812,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv,
break;
}
free_pages(cmd.reply_page, priv->hw_params.rx_page_order);
iwl_free_pages(priv, cmd.reply_page);
return rc;
}
@ -1198,9 +1198,7 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
PAGE_SIZE << priv->hw_params.rx_page_order,
PCI_DMA_FROMDEVICE);
priv->alloc_rxb_page--;
__free_pages(rxq->pool[i].page,
priv->hw_params.rx_page_order);
__iwl_free_pages(priv, rxq->pool[i].page);
rxq->pool[i].page = NULL;
}
list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
@ -1247,10 +1245,8 @@ static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rx
pci_unmap_page(priv->pci_dev, rxq->pool[i].page_dma,
PAGE_SIZE << priv->hw_params.rx_page_order,
PCI_DMA_FROMDEVICE);
__free_pages(rxq->pool[i].page,
priv->hw_params.rx_page_order);
__iwl_free_pages(priv, rxq->pool[i].page);
rxq->pool[i].page = NULL;
priv->alloc_rxb_page--;
}
}