Skip to contentSkip to conversation

forcedeth: fix checksum flag

PATCH In review Ayaz Abdulla 3 participants 3 messages Aug 15, 2008 – Aug 19, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 forcedeth: fix checksum flag

This patch fixes the checksum feature advertised in device flags. The hardware support TCP/UDP over IPv4 and TCP/UDP over IPv6 (without IPv6 extension headers). However, the kernel feature flags do not distinguish
IPv6 with/without extension headers.

Therefore, the driver needs to use NETIF_F_IP_CSUM instead of NETIF_F_HW_CSUM since the latter includes all IPv6 packets.

A future patch can created to check for extension headers and perform software checksum calculation.

drivers/net/forcedeth.c +2 -2
@@ -5522,7 +5522,7 @@
 	if (id->driver_data & DEV_HAS_CHECKSUM) {
 		np->rx_csum = 1;
 		np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK;
-		dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
+		dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
 		dev->features |= NETIF_F_TSO;
 	}
 
@@ -5835,7 +5835,7 @@
 
 	dev_printk(KERN_INFO, &pci_dev->dev, "%s%s%s%s%s%s%s%s%s%sdesc-v%u\n",
 		   dev->features & NETIF_F_HIGHDMA ? "highdma " : "",
-		   dev->features & (NETIF_F_HW_CSUM | NETIF_F_SG) ?
+		   dev->features & (NETIF_F_IP_CSUM | NETIF_F_SG) ?
 		   	"csum " : "",
 		   dev->features & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX) ?
 		   	"vlan " : "",
#1 lore raw
Quoted 28 lines · On Thu, 14 Aug 2008 18:49:09 -0400 Ayaz Abdulla <[email protected]> wrote:

This patch fixes the checksum feature advertised in device flags. The hardware support TCP/UDP over IPv4 and TCP/UDP over IPv6 (without IPv6 extension headers). However, the kernel feature flags do not distinguish
IPv6 with/without extension headers.

Therefore, the driver needs to use NETIF_F_IP_CSUM instead of NETIF_F_HW_CSUM since the latter includes all IPv6 packets.

A future patch can created to check for extension headers and perform software checksum calculation.

[patch-forcedeth-ipv4csum text/plain (780B)]

drivers/net/forcedeth.c +1 -1
@@ -5522,7 +5522,7 @@
 	if (id->driver_data & DEV_HAS_CHECKSUM) {
 		np->rx_csum = 1;
 		np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK;
-		dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
+		dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
 		dev->features |= NETIF_F_TSO;
 	}
 

drivers/net/forcedeth.c line 5841

Quoted 8 lines
drivers/net/forcedeth.c +1 -1
@@ -5835,7 +5835,7 @@
 
 	dev_printk(KERN_INFO, &pci_dev->dev, "%s%s%s%s%s%s%s%s%s%sdesc-v%u\n",
 		   dev->features & NETIF_F_HIGHDMA ? "highdma " : "",
-		   dev->features & (NETIF_F_HW_CSUM | NETIF_F_SG) ?
+		   dev->features & (NETIF_F_IP_CSUM | NETIF_F_SG) ?
 		   	"csum " : "",
 		   dev->features & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX) ?
 		   	"vlan " : "",

Is this fix needed in 2.6.25.x and 2.6.26.x?

#2 lore raw
Quoted 14 lines · Andrew Morton
Quoted 14 lines
drivers/net/forcedeth.c 2008-08-14 18:37:05.000000000 -0400 renamed from drivers/net/forcedeth.c 2008-08-14 18:37:11.000000000 -0400 +1 -1
@@ -5522,7 +5522,7 @@
      if (id->driver_data & DEV_HAS_CHECKSUM) {
              np->rx_csum = 1;
              np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK;
-             dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
+             dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
              dev->features |= NETIF_F_TSO;
      }
 
@@ -5835,7 +5835,7 @@
 
Quoted 9 lines

drivers/net/forcedeth.c 2008-08-14 18:37:05.000000000 -0400 line 5841

Quoted 7 lines
drivers/net/forcedeth.c 2008-08-14 18:37:05.000000000 -0400 renamed from drivers/net/forcedeth.c 2008-08-14 18:37:11.000000000 -0400 +1 -1
      dev_printk(KERN_INFO, &pci_dev->dev, "%s%s%s%s%s%s%s%s%s%sdesc-v%u\n",
                 dev->features & NETIF_F_HIGHDMA ? "highdma " : "",
-                dev->features & (NETIF_F_HW_CSUM | NETIF_F_SG) ?
+                dev->features & (NETIF_F_IP_CSUM | NETIF_F_SG) ?
                      "csum " : "",
                 dev->features & (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX) ?
                      "vlan " : "",

Is this fix needed in 2.6.25.x and 2.6.26.x?

Yep it's needed for all kernels.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt