* [PATCH] forcedeth: Fix incorrect parameters in pci_unmap_single calls
@ 2005-12-22 22:05 Manfred Spraul
0 siblings, 0 replies; only message in thread
From: Manfred Spraul @ 2005-12-22 22:05 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Netdev
[-- Attachment #1: Type: text/plain, Size: 202 bytes --]
Hi,
The natsemi rx codepath calls pci_unmap_single with a different size
than the initial pci_map_single call.
The attached patch fixes that.
Signed-Off-By: Manfred Spraul <manfred@colorfullife.com>
[-- Attachment #2: patch-natsemi-rxunmapsize --]
[-- Type: text/plain, Size: 1489 bytes --]
--- 2.6/drivers/net/natsemi.c 2005-12-19 01:36:54.000000000 +0100
+++ x64/drivers/net/natsemi.c 2005-12-22 22:10:56.000000000 +0100
@@ -1920,6 +1920,7 @@
int entry = np->dirty_rx % RX_RING_SIZE;
if (np->rx_skbuff[entry] == NULL) {
unsigned int buflen = np->rx_buf_sz+NATSEMI_PADDING;
+
skb = dev_alloc_skb(buflen);
np->rx_skbuff[entry] = skb;
if (skb == NULL)
@@ -2006,7 +2007,6 @@
static void drain_rx(struct net_device *dev)
{
struct netdev_private *np = netdev_priv(dev);
- unsigned int buflen = np->rx_buf_sz;
int i;
/* Free all the skbuffs in the Rx queue. */
@@ -2014,6 +2014,8 @@
np->rx_ring[i].cmd_status = 0;
np->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */
if (np->rx_skbuff[i]) {
+ unsigned int buflen = np->rx_buf_sz+NATSEMI_PADDING;
+
pci_unmap_single(np->pci_dev,
np->rx_dma[i], buflen,
PCI_DMA_FROMDEVICE);
@@ -2225,7 +2227,6 @@
int entry = np->cur_rx % RX_RING_SIZE;
int boguscnt = np->dirty_rx + RX_RING_SIZE - np->cur_rx;
s32 desc_status = le32_to_cpu(np->rx_head_desc->cmd_status);
- unsigned int buflen = np->rx_buf_sz;
void __iomem * ioaddr = ns_ioaddr(dev);
/* If the driver owns the next entry it's a new packet. Send it up. */
@@ -2267,6 +2268,8 @@
*/
} else {
struct sk_buff *skb;
+ unsigned int buflen = np->rx_buf_sz+NATSEMI_PADDING;
+
/* Omit CRC size. */
/* Check if the packet is long enough to accept
* without copying to a minimally-sized skbuff. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-12-22 22:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-22 22:05 [PATCH] forcedeth: Fix incorrect parameters in pci_unmap_single calls Manfred Spraul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).