Subject: Re: [PATCH] net: Fix too optimistic NETIF_F_HW_CSUM features

From: Jon Mason <[email-masked]>
Date: Tue, 30 Nov 2010 10:12:33 -0600

On Tue, Nov 30, 2010 at 07:41:23AM -0800, Michał Mirosław wrote:
> On Tue, Nov 30, 2010 at 04:28:38PM +0100, MichałMirosław wrote:
> > On Tue, Nov 30, 2010 at 03:13:25PM +0000, Ben Hutchings wrote:
> > > On Tue, 2010-11-30 at 15:23 +0100, MichałMirosław wrote:
> > > > NETIF_F_HW_CSUM is superset of NETIF_F_IP_CSUM+NETIF_F_IPV6_CSUM, but
> > > > some drivers miss the difference. Fix this and also fix UFO dependency
> > > > on checksumming offload as it makes the same mistake in assumptions.
> [...]
> > > > diff --git a/drivers/net/vxge/vxge-ethtool.c b/drivers/net/vxge/vxge-ethtool.c
> > > > index bc9bd10..5ece50d 100644
> > > > --- a/drivers/net/vxge/vxge-ethtool.c
> > > > +++ b/drivers/net/vxge/vxge-ethtool.c
> > > > @@ -1177,7 +1177,7 @@ static const struct ethtool_ops vxge_ethtool_ops = {
> > > >  	.get_rx_csum		= vxge_get_rx_csum,
> > > >  	.set_rx_csum		= vxge_set_rx_csum,
> > > >  	.get_tx_csum		= ethtool_op_get_tx_csum,
> > > > -	.set_tx_csum		= ethtool_op_set_tx_hw_csum,
> > > > +	.set_tx_csum		= ethtool_op_set_tx_csum,
> > > >  	.get_sg			= ethtool_op_get_sg,
> > > >  	.set_sg			= ethtool_op_set_sg,
> > > >  	.get_tso		= ethtool_op_get_tso,
> > > > diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
> > > > index a21dae1..9f6d379 100644
> > > > --- a/drivers/net/vxge/vxge-main.c
> > > > +++ b/drivers/net/vxge/vxge-main.c
> > > > @@ -3368,7 +3368,7 @@ static int __devinit vxge_device_register(struct __vxge_hw_device *hldev,
> > > >  
> > > >  	ndev->features |= NETIF_F_SG;
> > > >  
> > > > -	ndev->features |= NETIF_F_HW_CSUM;
> > > > +	ndev->features |= NETIF_F_IP_CSUM;
> > > >  	vxge_debug_init(vxge_hw_device_trace_level_get(hldev),
> > > >  		"%s : checksuming enabled", __func__);
> > > >  
> > > Why are you disabling IPv6 checksum offload?  From a quick look at the
> > > driver, I think the hardware does support it.
> > 
> > In vxge_xmit() (at drivers/net/vxge/vxge-main.c:922 in net-next) there
> > is the following code, that suggested otherwise:
> > 
> >         if (skb->ip_summed == CHECKSUM_PARTIAL)
> >                 vxge_hw_fifo_txdl_cksum_set_bits(dtr,
> >                                         VXGE_HW_FIFO_TXD_TX_CKO_IPV4_EN |
> >                                         VXGE_HW_FIFO_TXD_TX_CKO_TCP_EN |
> >                                         VXGE_HW_FIFO_TXD_TX_CKO_UDP_EN);
> > 
> 
> Lets ask vxge driver maintainters on this.
> 
> Does vxge support IPv6 TCP/UDP checksumming offload?

Yes, the underlying hardware can handle checksumming TCP/UDP in an
IPv6 frame.  So the change in the former code above would revert this.
The latter piece of code is for inserting the IPv4 checksum.

Thanks,
Jon

> Best Regards,
> Michał Mirosław