[PATCH] fix natsemi PCI mapping

STALE8223d

3 messages, 2 authors, 2004-03-16 · open the first message on its own page

[PATCH] fix natsemi PCI mapping

From: Jeff Garzik <hidden>
Date: 2004-03-16 18:07:03

Somebody wanna review and/or test?

Changes:
* Define RX_OFFSET constant (value==2) for uses related to SKB 
allocation and skb_reserve() calls

* RX skb's are always allocated maximally-sized, since we don't know the 
size of an RX packet in advance.  This means that we always alloc and 
map RX skbs based on "np->rx_buf_sz + RX_OFFSET".  natsemi got this 
really wrong in refill_rx(), where it mapped skb->len just after 
dev_alloc_skb(), which was very incorrect.

* call skb_reserve() in refill_rx(), our main skb allocation function, 
just after dev_alloc_skb() returns successfully

Re: [PATCH] fix natsemi PCI mapping

From: Steven J. Hill <hidden>
Date: 2004-03-16 19:19:23

Jeff Garzik wrote:
Somebody wanna review and/or test?
Hey Jeff.

I have tested this on 2.4 and it works great on MIPS with one
minor change below. Remove the 16 byte alignment of the IP
header. I discovered this when trying to do a BOOTP and mount
my NFS root filesystem. The BOOTP never succeeds. Patch against
latest 2.4.25 attached.

-Steve
@@ -1467,13 +1469,16 @@
  		struct sk_buff *skb;
  		int entry = np->dirty_rx % RX_RING_SIZE;
  		if (np->rx_skbuff[entry] == NULL) {
-			skb = dev_alloc_skb(np->rx_buf_sz);
+			unsigned int buflen = np->rx_buf_sz + RX_OFFSET;
+			skb = dev_alloc_skb(buflen);
  			np->rx_skbuff[entry] = skb;
  			if (skb == NULL)
  				break; /* Better luck next round. */
  			skb->dev = dev; /* Mark as being used by this device. */
+			/* 16 byte align the IP header */
+			skb_reserve(skb, RX_OFFSET);
  			np->rx_dma[entry] = pci_map_single(np->pci_dev,
-				skb->data, skb->len, PCI_DMA_FROMDEVICE);
+				skb->tail, buflen, PCI_DMA_FROMDEVICE);
  			np->rx_ring[entry].addr = cpu_to_le32(np->rx_dma[entry]);
  		}

Re: [PATCH] fix natsemi PCI mapping

From: Jeff Garzik <hidden>
Date: 2004-03-16 19:21:34

Steven J. Hill wrote:
Jeff Garzik wrote:
quoted
Somebody wanna review and/or test?
Hey Jeff.

I have tested this on 2.4 and it works great on MIPS with one
minor change below. Remove the 16 byte alignment of the IP
header. I discovered this when trying to do a BOOTP and mount
my NFS root filesystem. The BOOTP never succeeds. Patch against
latest 2.4.25 attached.

Interesting, thanks.

WRT skb_reserve(), I wonder if

(a) RX_OFFSET value passed to skb_reserve() needs to be per-arch
(b) the pre-existing skb_reserve() call is wrong too
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help