Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 1/1]  hyperv: Properly handle checksum offload
@ 2014-04-25 18:45 K. Y. Srinivasan
  2014-04-26  0:43 ` Stephen Hemminger
  0 siblings, 1 reply; 6+ messages in thread
From: K. Y. Srinivasan @ 2014-04-25 18:45 UTC (permalink / raw)
  To: davem, netdev, linux-kernel, devel, olaf, apw, jasowang; +Cc: stable

Do checksum offload only if the client of the driver wants checksum to be
offloaded. Also Windows hosts support ip header checksum offload as well -
take advantage of that.

This patch fixes a bug that is exposed in gateway scenarios.


Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Cc: stable@kernel.org
---
 drivers/net/hyperv/netvsc_drv.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 939e3af..706b341 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -467,6 +467,9 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
 	if (skb_is_gso(skb))
 		goto do_lso;
 
+	if (skb->ip_summed != CHECKSUM_PARTIAL)
+		goto do_send;
+
 	rndis_msg_size += NDIS_CSUM_PPI_SIZE;
 	ppi = init_ppi_data(rndis_msg, NDIS_CSUM_PPI_SIZE,
 			    TCPIP_CHKSUM_PKTINFO);
@@ -474,6 +477,9 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
 	csum_info = (struct ndis_tcp_ip_checksum_info *)((void *)ppi +
 			ppi->ppi_offset);
 
+	ip_hdr(skb)->check = 0;
+	csum_info->transmit.ip_header_checksum = 1;
+
 	if (net_trans_info & (INFO_IPV4 << 16))
 		csum_info->transmit.is_ipv4 = 1;
 	else
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 1/1]  hyperv: Properly handle checksum offload
  2014-04-25 18:45 [PATCH net-next 1/1] hyperv: Properly handle checksum offload K. Y. Srinivasan
@ 2014-04-26  0:43 ` Stephen Hemminger
  2014-04-26  1:15   ` Eric Dumazet
  2014-04-26  2:23   ` KY Srinivasan
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Hemminger @ 2014-04-26  0:43 UTC (permalink / raw)
  To: K. Y. Srinivasan
  Cc: davem, netdev, linux-kernel, devel, olaf, apw, jasowang, stable

On Fri, 25 Apr 2014 11:45:14 -0700
"K. Y. Srinivasan" <kys@microsoft.com> wrote:

> @@ -474,6 +477,9 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
>  	csum_info = (struct ndis_tcp_ip_checksum_info *)((void *)ppi +
>  			ppi->ppi_offset);
>  
> +	ip_hdr(skb)->check = 0;
> +	csum_info->transmit.ip_header_checksum = 1;
> +
>  	if (net_trans_info & (INFO_IPV4 << 16))
>  		csum_info->transmit.is_ipv4 = 1;
>  	else

Linux doesn't need or want IP checksum offload.
It will not have any performance gain.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 1/1]  hyperv: Properly handle checksum offload
  2014-04-26  0:43 ` Stephen Hemminger
@ 2014-04-26  1:15   ` Eric Dumazet
  2014-04-26  2:24     ` KY Srinivasan
  2014-04-26  2:23   ` KY Srinivasan
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2014-04-26  1:15 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: olaf, netdev, jasowang, linux-kernel, stable, apw, devel, davem

On Fri, 2014-04-25 at 17:43 -0700, Stephen Hemminger wrote:
> On Fri, 25 Apr 2014 11:45:14 -0700
> "K. Y. Srinivasan" <kys@microsoft.com> wrote:
> 
> > @@ -474,6 +477,9 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
> >  	csum_info = (struct ndis_tcp_ip_checksum_info *)((void *)ppi +
> >  			ppi->ppi_offset);
> >  
> > +	ip_hdr(skb)->check = 0;
> > +	csum_info->transmit.ip_header_checksum = 1;
> > +
> >  	if (net_trans_info & (INFO_IPV4 << 16))
> >  		csum_info->transmit.is_ipv4 = 1;
> >  	else
> 
> Linux doesn't need or want IP checksum offload.
> It will not have any performance gain.


BTW, was this patch even tested with IPv6 packets ???

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH net-next 1/1]  hyperv: Properly handle checksum offload
  2014-04-26  0:43 ` Stephen Hemminger
  2014-04-26  1:15   ` Eric Dumazet
@ 2014-04-26  2:23   ` KY Srinivasan
  1 sibling, 0 replies; 6+ messages in thread
From: KY Srinivasan @ 2014-04-26  2:23 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: olaf@aepfle.de, netdev@vger.kernel.org, jasowang@redhat.com,
	linux-kernel@vger.kernel.org, stable@kernel.org,
	apw@canonical.com, devel@linuxdriverproject.org,
	davem@davemloft.net



> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Friday, April 25, 2014 5:43 PM
> To: KY Srinivasan
> Cc: davem@davemloft.net; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de;
> apw@canonical.com; jasowang@redhat.com; stable@kernel.org
> Subject: Re: [PATCH net-next 1/1] hyperv: Properly handle checksum offload
> 
> On Fri, 25 Apr 2014 11:45:14 -0700
> "K. Y. Srinivasan" <kys@microsoft.com> wrote:
> 
> > @@ -474,6 +477,9 @@ static int netvsc_start_xmit(struct sk_buff *skb,
> struct net_device *net)
> >  	csum_info = (struct ndis_tcp_ip_checksum_info *)((void *)ppi +
> >  			ppi->ppi_offset);
> >
> > +	ip_hdr(skb)->check = 0;
> > +	csum_info->transmit.ip_header_checksum = 1;
> > +
> >  	if (net_trans_info & (INFO_IPV4 << 16))
> >  		csum_info->transmit.is_ipv4 = 1;
> >  	else
> 
> Linux doesn't need or want IP checksum offload.
> It will not have any performance gain.

Thanks Stephen; I will  re-spin the patch and re-submit.

K. Y

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH net-next 1/1]  hyperv: Properly handle checksum offload
  2014-04-26  1:15   ` Eric Dumazet
@ 2014-04-26  2:24     ` KY Srinivasan
  2014-04-26  2:40       ` KY Srinivasan
  0 siblings, 1 reply; 6+ messages in thread
From: KY Srinivasan @ 2014-04-26  2:24 UTC (permalink / raw)
  To: Eric Dumazet, Stephen Hemminger
  Cc: olaf@aepfle.de, netdev@vger.kernel.org, jasowang@redhat.com,
	linux-kernel@vger.kernel.org, stable@kernel.org,
	apw@canonical.com, devel@linuxdriverproject.org,
	davem@davemloft.net



> -----Original Message-----
> From: Eric Dumazet [mailto:eric.dumazet@gmail.com]
> Sent: Friday, April 25, 2014 6:15 PM
> To: Stephen Hemminger
> Cc: KY Srinivasan; davem@davemloft.net; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de;
> apw@canonical.com; jasowang@redhat.com; stable@kernel.org
> Subject: Re: [PATCH net-next 1/1] hyperv: Properly handle checksum offload
> 
> On Fri, 2014-04-25 at 17:43 -0700, Stephen Hemminger wrote:
> > On Fri, 25 Apr 2014 11:45:14 -0700
> > "K. Y. Srinivasan" <kys@microsoft.com> wrote:
> >
> > > @@ -474,6 +477,9 @@ static int netvsc_start_xmit(struct sk_buff *skb,
> struct net_device *net)
> > >  	csum_info = (struct ndis_tcp_ip_checksum_info *)((void *)ppi +
> > >  			ppi->ppi_offset);
> > >
> > > +	ip_hdr(skb)->check = 0;
> > > +	csum_info->transmit.ip_header_checksum = 1;
> > > +
> > >  	if (net_trans_info & (INFO_IPV4 << 16))
> > >  		csum_info->transmit.is_ipv4 = 1;
> > >  	else
> >
> > Linux doesn't need or want IP checksum offload.
> > It will not have any performance gain.
> 
> 
> BTW, was this patch even tested with IPv6 packets ???

No; I only tested this on ipv4.

K. Y
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH net-next 1/1]  hyperv: Properly handle checksum offload
  2014-04-26  2:24     ` KY Srinivasan
@ 2014-04-26  2:40       ` KY Srinivasan
  0 siblings, 0 replies; 6+ messages in thread
From: KY Srinivasan @ 2014-04-26  2:40 UTC (permalink / raw)
  To: KY Srinivasan, Eric Dumazet, Stephen Hemminger
  Cc: olaf@aepfle.de, netdev@vger.kernel.org, jasowang@redhat.com,
	linux-kernel@vger.kernel.org, davem@davemloft.net,
	apw@canonical.com, devel@linuxdriverproject.org,
	stable@kernel.org



> -----Original Message-----
> From: driverdev-devel-bounces@linuxdriverproject.org [mailto:driverdev-
> devel-bounces@linuxdriverproject.org] On Behalf Of KY Srinivasan
> Sent: Friday, April 25, 2014 7:24 PM
> To: Eric Dumazet; Stephen Hemminger
> Cc: olaf@aepfle.de; netdev@vger.kernel.org; jasowang@redhat.com; linux-
> kernel@vger.kernel.org; stable@kernel.org; apw@canonical.com;
> devel@linuxdriverproject.org; davem@davemloft.net
> Subject: RE: [PATCH net-next 1/1] hyperv: Properly handle checksum offload
> 
> 
> 
> > -----Original Message-----
> > From: Eric Dumazet [mailto:eric.dumazet@gmail.com]
> > Sent: Friday, April 25, 2014 6:15 PM
> > To: Stephen Hemminger
> > Cc: KY Srinivasan; davem@davemloft.net; netdev@vger.kernel.org; linux-
> > kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de;
> > apw@canonical.com; jasowang@redhat.com; stable@kernel.org
> > Subject: Re: [PATCH net-next 1/1] hyperv: Properly handle checksum
> > offload
> >
> > On Fri, 2014-04-25 at 17:43 -0700, Stephen Hemminger wrote:
> > > On Fri, 25 Apr 2014 11:45:14 -0700
> > > "K. Y. Srinivasan" <kys@microsoft.com> wrote:
> > >
> > > > @@ -474,6 +477,9 @@ static int netvsc_start_xmit(struct sk_buff
> > > > *skb,
> > struct net_device *net)
> > > >  	csum_info = (struct ndis_tcp_ip_checksum_info *)((void *)ppi +
> > > >  			ppi->ppi_offset);
> > > >
> > > > +	ip_hdr(skb)->check = 0;
> > > > +	csum_info->transmit.ip_header_checksum = 1;
> > > > +
> > > >  	if (net_trans_info & (INFO_IPV4 << 16))
> > > >  		csum_info->transmit.is_ipv4 = 1;
> > > >  	else
> > >
> > > Linux doesn't need or want IP checksum offload.
> > > It will not have any performance gain.
> >
> >
> > BTW, was this patch even tested with IPv6 packets ???
> 
> No; I only tested this on ipv4.
Oops; this would not work on ipv6. I am going to resend this patch.

K. Y
> 
> K. Y
> >
> 
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-26  2:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-25 18:45 [PATCH net-next 1/1] hyperv: Properly handle checksum offload K. Y. Srinivasan
2014-04-26  0:43 ` Stephen Hemminger
2014-04-26  1:15   ` Eric Dumazet
2014-04-26  2:24     ` KY Srinivasan
2014-04-26  2:40       ` KY Srinivasan
2014-04-26  2:23   ` KY Srinivasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox