Commit 64a76b50 authored by Zhu Yi's avatar Zhu Yi Committed by John W. Linville
Browse files

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: default avatarZhu Yi <yi.zhu@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d24deb25
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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;
}
+11 −0
Original line number Diff line number Diff line
@@ -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__ */
+1 −1
Original line number Diff line number Diff line
@@ -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:
+2 −6
Original line number Diff line number Diff line
@@ -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);
+1 −2
Original line number Diff line number Diff line
@@ -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;
}
Loading