sky2: hw checksum failures
Subsystems (2)
Hi Stephen !
So I now have the driver working with the patches I gave you. However, when I set it up with a 100bT link and transfer a huge file from another machine (about 10MB/sec throughput), I get a few of these in dmesg
eth2: hw csum failure.
Call Trace: [C00000000FFEF8D0] [C00000000000F460] .show_stack+0x6c/0x1a0
(unreliable)
[C00000000FFEF970] [C000000000365E48] .netdev_rx_csum_fault+0x4c/0x68 [C00000000FFEFA00] [C000000000362DB8] .__skb_checksum_complete+0x60/0x90 [C00000000FFEFA90] [C0000000003A8A48] .tcp_v4_rcv+0x1a0/0xc18 [C00000000FFEFB60] [C000000000386A54] .ip_local_deliver+0x20c/0x33c [C00000000FFEFBF0] [C0000000003870D0] .ip_rcv+0x54c/0x5c0 [C00000000FFEFC90] [C000000000369E8C] .netif_receive_skb+0x2a8/0x2e8 [C00000000FFEFD30] [D00000000010E99C] .sky2_poll+0x6e8/0x9dc [sky2] [C00000000FFEFE40] [C00000000036696C] .net_rx_action+0xb4/0x1b8 [C00000000FFEFEF0] [C000000000048404] .__do_softirq+0xa8/0x168 [C00000000FFEFF90] [C00000000001E3F8] .call_do_softirq+0x14/0x24 [C00000000FFAB9F0] [C00000000000C1F0] .do_softirq+0x78/0xa0 [C00000000FFABA80] [C000000000047F9C] .irq_exit+0x5c/0x74 [C00000000FFABB00] [C00000000000C154] .do_IRQ+0x160/0x184 [C00000000FFABB90] [C0000000000041EC] hardware_interrupt_entry+0xc/0x10 --- Exception: 501 at .cpu_idle+0xd4/0x12c
In fact, the dmesg trace is interesting:
benh@grosgo:~/kernels/linux-work$ dmesg | grep failure eth2: hw csum failure. eth2: hw csum failure. eth2: hw csum failure. eth2: hw csum failure. <unknown>: hw csum failure. <unknown>: hw csum failure. <unknown>: hw csum failure. eth2: hw csum failure. eth2: hw csum failure. <unknown>: hw csum failure. <unknown>: hw csum failure. <unknown>: hw csum failure. <unknown>: hw csum failure. <unknown>: hw csum failure. <unknown>: hw csum failure. <unknown>: hw csum failure. <unknown>: hw csum failure. <unknown>: hw csum failure. <unknown>: hw csum failure.
(That's what I get for about 600MB transfered).
The other side is a sungem, I haven't yet had a chance to test with something else, in case it's actually a problem there, though.
Any idea ? I'll do some tests with some other chips at the other end (will try 1000bT too) later.
Cheers,
Ben.
Unneeded byte swap was occurring.
drivers/net/sky2.c +1 -1
@@ -2001,7 +2001,7 @@ static int sky2_status_intr(struct sky2_case OP_RXCHKS : skb = sky2->rx_ring[sky2->rx_next].skb; skb->ip_summed =CHECKSUM_HW ; - skb->csum =le16_to_cpu (status); + skb->csum = status;break ;case OP_TXINDEXLE :
drivers/net/sky2.c static int sky2_status_intr(struct sky2_ · line 2007
Quoted 13 lines · Stephen Hemminger
Unneeded byte swap was occurring.
drivers/net/sky2.c +1
-1@@ -2001,7 +2001,7 @@ static int sky2_status_intr(struct sky2_case OP_RXCHKS : skb = sky2->rx_ring[sky2->rx_next].skb; skb->ip_summed =CHECKSUM_HW ; - skb->csum =le16_to_cpu (status); + skb->csum = status;break ;case OP_TXINDEXLE :
I've removed it in my paches (have you seen the other patches I sent for this driver ?), though I'm pre-swapping status and lenght now before the switch/case so there might still be an issue there. I'll have a look.
Thanks,
Ben.
Quoted 13 lines · On Tue, 05 Sep 2006 13:42:38 +1000 Benjamin Herrenschmidt…
Quoted 12 lines · Stephen Hemminger
Unneeded byte swap was occurring.
drivers/net/sky2.c +1
-1@@ -2001,7 +2001,7 @@ static int sky2_status_intr(struct sky2_case OP_RXCHKS : skb = sky2->rx_ring[sky2->rx_next].skb; skb->ip_summed =CHECKSUM_HW ; - skb->csum =le16_to_cpu (status); + skb->csum = status;break ;
Quoted 5 lines
drivers/net/sky2.c static int sky2_status_intr(struct sky2_ · line 2007
Quoted 1 line
drivers/net/sky2.c +0
-0case OP_TXINDEXLE :I've removed it in my paches (have you seen the other patches I sent for this driver ?), though I'm pre-swapping status and lenght now before the switch/case so there might still be an issue there. I'll have a look.
The other tack would be to leave the "reverse in hw" flag on and take out all the existing swap calls but then you have to add an ifdef to re-order all the structures for tx_le, rx_le, status_le. That is what the vendor (GPL) version of sk98lin does.
Quoted 22 lines · Stephen Hemminger
Quoted 13 lines · On Tue, 05 Sep 2006 13:42:38 +1000 Benjamin Herrenschmidt…
Quoted 12 lines · Stephen Hemminger
Unneeded byte swap was occurring.
drivers/net/sky2.c +1
-1@@ -2001,7 +2001,7 @@ static int sky2_status_intr(struct sky2_case OP_RXCHKS : skb = sky2->rx_ring[sky2->rx_next].skb; skb->ip_summed =CHECKSUM_HW ; - skb->csum =le16_to_cpu (status); + skb->csum = status;break ;Quoted 5 lines
drivers/net/sky2.c static int sky2_status_intr(struct sky2_ · line 2007
Quoted 1 line
drivers/net/sky2.c +0
-0case OP_TXINDEXLE :I've removed it in my paches (have you seen the other patches I sent for this driver ?), though I'm pre-swapping status and lenght now before the switch/case so there might still be an issue there. I'll have a look.
Quoted 3 lines
The other tack would be to leave the "reverse in hw" flag on and take out all the existing swap calls but then you have to add an ifdef to re-order all the structures for
tx_le,rx_le,status_le. That is what the vendor (GPL) version of sk98lin does.
I prefer keeping the HW swap out of the way for now... that way, I know the card will react exactly like in an x86, and I avoid those ugly ifdef's. At least on powerpc, there is no cost in doing swap in software (well, pretty much no cost).
Which means that if it worked on x86 with le16_to_cpu, it should work on powerpc... The main difference here however is that you called le16_to_cpu (which is basically a nop) on a 32 bits field, while I called le32_to_cpu() on it. But both should lead to the same ... (x86 will do a swapped 16 bits load of the 2 first bytes, while ppc will do a load of 4 bytes and swap that, thus ending up with the first 2 bytes swapped in the low order of the result). I'll dump the values and have a look to be sure. Another possibility would be a problem with the bits telling the chip where to calculate the checksum.
Ben.
Quoted 36 lines · Benjamin Herrenschmidt
Quoted 24 lines · Stephen Hemminger
Quoted 14 lines · On Tue, 05 Sep 2006 13:42:38 +1000 Benjamin Herrenschmidt…
Quoted 12 lines · Stephen Hemminger
Unneeded byte swap was occurring.
drivers/net/sky2.c +1
-1@@ -2001,7 +2001,7 @@ static int sky2_status_intr(struct sky2_case OP_RXCHKS : skb = sky2->rx_ring[sky2->rx_next].skb; skb->ip_summed =CHECKSUM_HW ; - skb->csum =le16_to_cpu (status); + skb->csum = status;break ;Quoted 6 lines
drivers/net/sky2.c static int sky2_status_intr(struct sky2_ · line 2007
Quoted 2 lines
drivers/net/sky2.c +0
-0case OP_TXINDEXLE :I've removed it in my paches (have you seen the other patches I sent for this driver ?), though I'm pre-swapping status and lenght now before the switch/case so there might still be an issue there. I'll have a look.
Quoted 4 lines
The other tack would be to leave the "reverse in hw" flag on and take out all the existing swap calls but then you have to add an ifdef to re-order all the structures for
tx_le,rx_le,status_le. That is what the vendor (GPL) version of sk98lin does.I prefer keeping the HW swap out of the way for now... that way, I know the card will react exactly like in an x86, and I avoid those ugly ifdef's. At least on powerpc, there is no cost in doing swap in software (well, pretty much no cost).
Quoted 10 lines
Which means that if it worked on x86 with
le16_to_cpu, it should work on powerpc... The main difference here however is that you calledle16_to_cpu(which is basically a nop) on a 32 bits field, while I calledle32_to_cpu()on it. But both should lead to the same ... (x86 will do a swapped 16 bits load of the 2 first bytes, while ppc will do a load of 4 bytes and swap that, thus ending up with the first 2 bytes swapped in the low order of the result). I'll dump the values and have a look to be sure. Another possibility would be a problem with the bits telling the chip where to calculate the checksum.
Hardware only computes 16 bit checksum.
Quoted 11 lines
Quoted 11 lines
Which means that if it worked on x86 with
le16_to_cpu, it should work on powerpc... The main difference here however is that you calledle16_to_cpu(which is basically a nop) on a 32 bits field, while I calledle32_to_cpu()on it. But both should lead to the same ... (x86 will do a swapped 16 bits load of the 2 first bytes, while ppc will do a load of 4 bytes and swap that, thus ending up with the first 2 bytes swapped in the low order of the result). I'll dump the values and have a look to be sure. Another possibility would be a problem with the bits telling the chip where to calculate the checksum.
Quoted 1 line
Hardware only computes 16 bit checksum.
Oh I know that, but calling 16 bits swapping macros on a 32 bits field is a bit dodgy... might work in this case, I'll verify, but you may end up with the wrong half of the 32 bits word being used :)
Ben.
Quoted 11 lines · On Wed, 06 Sep 2006 07:12:43 +1000 Benjamin Herrenschmidt…
Quoted 11 lines
Quoted 11 lines
Which means that if it worked on x86 with
le16_to_cpu, it should work on powerpc... The main difference here however is that you calledle16_to_cpu(which is basically a nop) on a 32 bits field, while I calledle32_to_cpu()on it. But both should lead to the same ... (x86 will do a swapped 16 bits load of the 2 first bytes, while ppc will do a load of 4 bytes and swap that, thus ending up with the first 2 bytes swapped in the low order of the result). I'll dump the values and have a look to be sure. Another possibility would be a problem with the bits telling the chip where to calculate the checksum.
Quoted 9 lines
Quoted 1 line
Hardware only computes 16 bit checksum.
Oh I know that, but calling 16 bits swapping macros on a 32 bits field is a bit dodgy... might work in this case, I'll verify, but you may end up with the wrong half of the 32 bits word being used :)
Ben.
Agreed. Actually the checksum value is same hi/lo because there are two checksum units and we ask for the same offset on both.
Signature · 1 line
Stephen Hemminger <[email protected]>
Quoted 3 lines
Agreed. Actually the checksum value is same hi/lo because there are two checksum units and we ask for the same offset on both.
Ok, that explains the (HLEN << 16) | HLEN thing when configuring it... At this point, best is I dig into the actual values and see what's up. I'll let you know (I don't have the HW at hand right now)
Ben.