Re: weired NE2K ether problem - help!

From: Paul Gortmaker (p_gortmaker@yahoo.com)
Date: Wed Jul 26 2000 - 16:14:50 EST


Jun Sun wrote:

>
> BTW, I believe I have already found one bug in ne2k-pci.c. The bug
> is in ne2k_pci_block_input() and ne2k_pci_block_output(). The code
> checks if ONLY_16BIT_IO is set or not. If not, it will try to read/write
> using 32bit mode, into/from the buffer (skb->data). However,
> skb->data is NOT aligned along 4-byte boundary (See related sbk_reserve(2)
> calls in 8390.c). This causes bus error on my MIPS board.
>
> What should be the right fix? I currently use a separate buffer, which is
> aligned along 4-byte boundary, to copy into/from skb->data to do the IO.
> Obviously, this is not good.
>
> I also tried to change from skb_reserve(2) skb_reserve(4). That seems
> to causes some other problem. (OK, I admit I am quite ignorant about
> ether driver.)

The reserve of 2 is because src addr(6) + dst addr(6) + type code(2)=14.
Adding 2 makes it an even 16 to the start of of the IP header.

In your case you may need to test with something like this.

Paul.

--- drivers/net/8390.c~ Sat Jul 22 12:59:17 2000
+++ drivers/net/8390.c Wed Jul 26 16:59:38 2000
@@ -739,7 +739,7 @@
                 {
                         struct sk_buff *skb;
                         
- skb = dev_alloc_skb(pkt_len+2);
+ skb = dev_alloc_skb(pkt_len+4);
                         if (skb == NULL)
                         {
                                 if (ei_debug > 1)
@@ -750,7 +750,8 @@
                         }
                         else
                         {
- skb_reserve(skb,2); /* IP headers on 16 byte boundaries */
+ unsigned long offset = (((unsigned long)(skb->data) + 3) & ~3UL) - (unsigned long)(skb->data);
+ skb_reserve(skb,offset);
                                 skb->dev = dev;
                                 skb_put(skb, pkt_len); /* Make room */
                                 ei_block_input(dev, pkt_len, skb, current_offset + sizeof(rx_frame));

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:22 EST