aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/wireless/p54/p54pci.c
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@web.de>2008-09-01 22:48:41 +0200
committerJohn W. Linville <linville@tuxdriver.com>2008-09-05 16:17:47 -0400
commit4e416a6f49b710bfe162f0cb24bc68c74493d2a0 (patch)
tree76e4a5e4a7e1cd65b142d841e5134404f970a99d /drivers/net/wireless/p54/p54pci.c
parent0c25970dc1b0d46f2357e7c4b267ab7b93eb7cdd (diff)
p54: enhance firmware parser to reduce memory waste
This patch greatly reduces one of biggest memory waste in the driver. The firmware headers provides the right values for extra head-/tailroom and mtu size which are usually much lower than the old hardcoded ones. Signed-off-by: Christian Lamparter <chunkeey@web.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54/p54pci.c')
-rw-r--r--drivers/net/wireless/p54/p54pci.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index a0395af74c2..fdfc7189f0f 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -81,7 +81,11 @@ static int p54p_upload_firmware(struct ieee80211_hw *dev)
return err;
}
- p54_parse_firmware(dev, fw_entry);
+ err = p54_parse_firmware(dev, fw_entry);
+ if (err) {
+ release_firmware(fw_entry);
+ return err;
+ }
data = (__le32 *) fw_entry->data;
remains = fw_entry->size;
@@ -258,17 +262,17 @@ static void p54p_refill_rx_ring(struct ieee80211_hw *dev,
if (!desc->host_addr) {
struct sk_buff *skb;
dma_addr_t mapping;
- skb = dev_alloc_skb(MAX_RX_SIZE);
+ skb = dev_alloc_skb(priv->common.rx_mtu + 32);
if (!skb)
break;
mapping = pci_map_single(priv->pdev,
skb_tail_pointer(skb),
- MAX_RX_SIZE,
+ priv->common.rx_mtu + 32,
PCI_DMA_FROMDEVICE);
desc->host_addr = cpu_to_le32(mapping);
desc->device_addr = 0; // FIXME: necessary?
- desc->len = cpu_to_le16(MAX_RX_SIZE);
+ desc->len = cpu_to_le16(priv->common.rx_mtu + 32);
desc->flags = 0;
rx_buf[i] = skb;
}
@@ -311,12 +315,13 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index,
if (p54_rx(dev, skb)) {
pci_unmap_single(priv->pdev,
le32_to_cpu(desc->host_addr),
- MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
+ priv->common.rx_mtu + 32,
+ PCI_DMA_FROMDEVICE);
rx_buf[i] = NULL;
desc->host_addr = 0;
} else {
skb_trim(skb, 0);
- desc->len = cpu_to_le16(MAX_RX_SIZE);
+ desc->len = cpu_to_le16(priv->common.rx_mtu + 32);
}
i++;
@@ -534,7 +539,8 @@ static void p54p_stop(struct ieee80211_hw *dev)
if (desc->host_addr)
pci_unmap_single(priv->pdev,
le32_to_cpu(desc->host_addr),
- MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
+ priv->common.rx_mtu + 32,
+ PCI_DMA_FROMDEVICE);
kfree_skb(priv->rx_buf_data[i]);
priv->rx_buf_data[i] = NULL;
}
@@ -544,7 +550,8 @@ static void p54p_stop(struct ieee80211_hw *dev)
if (desc->host_addr)
pci_unmap_single(priv->pdev,
le32_to_cpu(desc->host_addr),
- MAX_RX_SIZE, PCI_DMA_FROMDEVICE);
+ priv->common.rx_mtu + 32,
+ PCI_DMA_FROMDEVICE);
kfree_skb(priv->rx_buf_mgmt[i]);
priv->rx_buf_mgmt[i] = NULL;
}