Subject: Re: [RFC] IPV6 checksum offloading in network devices

From: Patrick McHardy <[email-masked]>
Date: Wed, 30 May 2007 18:13:24 +0200

Stephen Hemminger wrote:
> Here is a proposed change to address hardware that can do IPV6 checksum
> offload, but doesn't truly do generic hw checksumming.  The bnx2 and tg3
> are like this for some revisions, and upcoming Marvell 88e8071 is similar.
> 
> 
> --- a/include/linux/netdevice.h	2007-05-30 08:26:18.000000000 -0700
> +++ b/include/linux/netdevice.h	2007-05-30 08:30:20.000000000 -0700
> @@ -314,9 +314,10 @@ struct net_device
>  	/* Net device features */
>  	unsigned long		features;
>  #define NETIF_F_SG		1	/* Scatter/gather IO. */
> -#define NETIF_F_IP_CSUM		2	/* Can checksum only TCP/UDP over IPv4. */
> +#define NETIF_F_IP_CSUM		2	/* Can checksum TCP/UDP over IPv4. */
>  #define NETIF_F_NO_CSUM		4	/* Does not require checksum. F.e. loopack. */
>  #define NETIF_F_HW_CSUM		8	/* Can checksum all the packets. */
> +#define NETIF_F_IPV6_CSUM	16	/* Can checksum TCP/UDP over IPV6 */
>  #define NETIF_F_HIGHDMA		32	/* Can DMA to high memory. */
>  #define NETIF_F_FRAGLIST	64	/* Scatter/gather IO. */
>  #define NETIF_F_HW_VLAN_TX	128	/* Transmit VLAN hw acceleration */
> @@ -339,7 +340,8 @@ struct net_device
>  #define NETIF_F_GSO_SOFTWARE	(NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6)
>  
>  #define NETIF_F_GEN_CSUM	(NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
> -#define NETIF_F_ALL_CSUM	(NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM)
> +#define NETIF_F_ALL_CSUM	(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM \
> +				 | NETIF_F_GEN_CSUM)

This might confuse some of the existing IPv4 code that
checks for NETIF_F_ALL_CSUM if we ever get a device that
has NETIF_F_IPV6_CSUM but not NETIF_F_IP_CSUM.