diff options
author | Christian Lamparter <chunkeey@web.de> | 2008-09-01 16:48:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-05 16:17:47 -0400 |
commit | 4e416a6f49b710bfe162f0cb24bc68c74493d2a0 (patch) | |
tree | 76e4a5e4a7e1cd65b142d841e5134404f970a99d /drivers/net/wireless/p54/p54pci.c | |
parent | 0c25970dc1b0d46f2357e7c4b267ab7b93eb7cdd (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.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index a0395af74c2d..fdfc7189f0ff 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) | |||
81 | return err; | 81 | return err; |
82 | } | 82 | } |
83 | 83 | ||
84 | p54_parse_firmware(dev, fw_entry); | 84 | err = p54_parse_firmware(dev, fw_entry); |
85 | if (err) { | ||
86 | release_firmware(fw_entry); | ||
87 | return err; | ||
88 | } | ||
85 | 89 | ||
86 | data = (__le32 *) fw_entry->data; | 90 | data = (__le32 *) fw_entry->data; |
87 | remains = fw_entry->size; | 91 | remains = fw_entry->size; |
@@ -258,17 +262,17 @@ static void p54p_refill_rx_ring(struct ieee80211_hw *dev, | |||
258 | if (!desc->host_addr) { | 262 | if (!desc->host_addr) { |
259 | struct sk_buff *skb; | 263 | struct sk_buff *skb; |
260 | dma_addr_t mapping; | 264 | dma_addr_t mapping; |
261 | skb = dev_alloc_skb(MAX_RX_SIZE); | 265 | skb = dev_alloc_skb(priv->common.rx_mtu + 32); |
262 | if (!skb) | 266 | if (!skb) |
263 | break; | 267 | break; |
264 | 268 | ||
265 | mapping = pci_map_single(priv->pdev, | 269 | mapping = pci_map_single(priv->pdev, |
266 | skb_tail_pointer(skb), | 270 | skb_tail_pointer(skb), |
267 | MAX_RX_SIZE, | 271 | priv->common.rx_mtu + 32, |
268 | PCI_DMA_FROMDEVICE); | 272 | PCI_DMA_FROMDEVICE); |
269 | desc->host_addr = cpu_to_le32(mapping); | 273 | desc->host_addr = cpu_to_le32(mapping); |
270 | desc->device_addr = 0; // FIXME: necessary? | 274 | desc->device_addr = 0; // FIXME: necessary? |
271 | desc->len = cpu_to_le16(MAX_RX_SIZE); | 275 | desc->len = cpu_to_le16(priv->common.rx_mtu + 32); |
272 | desc->flags = 0; | 276 | desc->flags = 0; |
273 | rx_buf[i] = skb; | 277 | rx_buf[i] = skb; |
274 | } | 278 | } |
@@ -311,12 +315,13 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index, | |||
311 | if (p54_rx(dev, skb)) { | 315 | if (p54_rx(dev, skb)) { |
312 | pci_unmap_single(priv->pdev, | 316 | pci_unmap_single(priv->pdev, |
313 | le32_to_cpu(desc->host_addr), | 317 | le32_to_cpu(desc->host_addr), |
314 | MAX_RX_SIZE, PCI_DMA_FROMDEVICE); | 318 | priv->common.rx_mtu + 32, |
319 | PCI_DMA_FROMDEVICE); | ||
315 | rx_buf[i] = NULL; | 320 | rx_buf[i] = NULL; |
316 | desc->host_addr = 0; | 321 | desc->host_addr = 0; |
317 | } else { | 322 | } else { |
318 | skb_trim(skb, 0); | 323 | skb_trim(skb, 0); |
319 | desc->len = cpu_to_le16(MAX_RX_SIZE); | 324 | desc->len = cpu_to_le16(priv->common.rx_mtu + 32); |
320 | } | 325 | } |
321 | 326 | ||
322 | i++; | 327 | i++; |
@@ -534,7 +539,8 @@ static void p54p_stop(struct ieee80211_hw *dev) | |||
534 | if (desc->host_addr) | 539 | if (desc->host_addr) |
535 | pci_unmap_single(priv->pdev, | 540 | pci_unmap_single(priv->pdev, |
536 | le32_to_cpu(desc->host_addr), | 541 | le32_to_cpu(desc->host_addr), |
537 | MAX_RX_SIZE, PCI_DMA_FROMDEVICE); | 542 | priv->common.rx_mtu + 32, |
543 | PCI_DMA_FROMDEVICE); | ||
538 | kfree_skb(priv->rx_buf_data[i]); | 544 | kfree_skb(priv->rx_buf_data[i]); |
539 | priv->rx_buf_data[i] = NULL; | 545 | priv->rx_buf_data[i] = NULL; |
540 | } | 546 | } |
@@ -544,7 +550,8 @@ static void p54p_stop(struct ieee80211_hw *dev) | |||
544 | if (desc->host_addr) | 550 | if (desc->host_addr) |
545 | pci_unmap_single(priv->pdev, | 551 | pci_unmap_single(priv->pdev, |
546 | le32_to_cpu(desc->host_addr), | 552 | le32_to_cpu(desc->host_addr), |
547 | MAX_RX_SIZE, PCI_DMA_FROMDEVICE); | 553 | priv->common.rx_mtu + 32, |
554 | PCI_DMA_FROMDEVICE); | ||
548 | kfree_skb(priv->rx_buf_mgmt[i]); | 555 | kfree_skb(priv->rx_buf_mgmt[i]); |
549 | priv->rx_buf_mgmt[i] = NULL; | 556 | priv->rx_buf_mgmt[i] = NULL; |
550 | } | 557 | } |