hyperv: Properly handle checksum offload
Subsystems (3)
PATCH 1/1 hyperv: Properly handle checksum offload
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.
--- drivers/net/hyperv/netvsc_drv.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/hyperv/netvsc_drv.c +6 -0
@@ -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
Signature · 1 line
1.7.4.1
drivers/net/hyperv/netvsc_drv.c static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) · line 485
Quoted 10 lines · On Fri, 25 Apr 2014 11:45:14 -0700 "K. Y. Srinivasan" <[email protected]> wrote:
drivers/net/hyperv/netvsc_drv.c +3
-0@@ -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.
Quoted 7 lines · Stephen Hemminger
Quoted 4 lines · On Fri, 25 Apr 2014 11:45:14 -0700 "K. Y. Srinivasan" <[email protected]> wrote:
drivers/net/hyperv/netvsc_drv.c +0
-0@@ -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);
Quoted 9 lines
drivers/net/hyperv/netvsc_drv.c static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) · line 485
Quoted 6 lines
drivers/net/hyperv/netvsc_drv.c +3
-0+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 ???
Quoted 19 lines
-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Friday, April 25, 2014 5:43 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net-next 1/1] hyperv: Properly handle checksum offloadReview static int netvsc_start_xmit(struct sk_buff *skb,
Quoted 1 line · On Fri, 25 Apr 2014 11:45:14 -0700 "K. Y. Srinivasan" <[email protected]> wrote:
(quoted diff) +0
-0@@ -474,6 +477,9 @@ static int netvsc_start_xmit(struct sk_buff *skb,struct
net_device*net)Quoted 3 lines
drivers/net/hyperv/netvsc_drv.c +0
-0csum_info = (struct ndis_tcp_ip_checksum_info *)((void *)ppi + ppi->ppi_offset);
Quoted 9 lines
drivers/net/hyperv/netvsc_drv.c static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) · line 485
Quoted 6 lines
drivers/net/hyperv/netvsc_drv.c +3
-0+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
Quoted 31 lines
-----Original Message-----
From: Eric Dumazet [mailto:[email protected]]
Sent: Friday, April 25, 2014 6:15 PM
To: Stephen Hemminger
Cc: KY Srinivasan; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net-next 1/1] hyperv: Properly handle checksum offloadQuoted 4 lines · Stephen Hemminger
Review static int netvsc_start_xmit(struct sk_buff *skb,
Quoted 1 line · On Fri, 25 Apr 2014 11:45:14 -0700 "K. Y. Srinivasan" <[email protected]> wrote:
(quoted diff) +0
-0@@ -474,6 +477,9 @@ static int netvsc_start_xmit(struct sk_buff *skb,struct
net_device*net)Quoted 12 lines
drivers/net/hyperv/netvsc_drv.c static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) · line 485
Quoted 9 lines
drivers/net/hyperv/netvsc_drv.c +3
-0csum_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.
Quoted 1 line
BTW, was this patch even tested with IPv6 packets ???
No; I only tested this on ipv4.
K. Y
Quoted 1 line
Quoted 45 lines
-----Original Message-----
From: [email protected] [mailto:driverdev- [email protected]] On Behalf Of KY Srinivasan
Sent: Friday, April 25, 2014 7:24 PM
To: Eric Dumazet; Stephen Hemminger
Cc: [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH net-next 1/1] hyperv: Properly handle checksum offloadQuoted 31 lines
-----Original Message-----
From: Eric Dumazet [mailto:[email protected]]
Sent: Friday, April 25, 2014 6:15 PM
To: Stephen Hemminger
Cc: KY Srinivasan; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net-next 1/1] hyperv: Properly handle checksum offloadQuoted 5 lines · Stephen Hemminger
Review static int netvsc_start_xmit(struct sk_buff · line 477
Quoted 2 lines · On Fri, 25 Apr 2014 11:45:14 -0700 "K. Y. Srinivasan" <[email protected]> wrote:
(quoted diff) +0
-0@@ -474,6 +477,9 @@ static int netvsc_start_xmit(struct sk_buff *skb,struct
net_device*net)Quoted 12 lines
Quoted 9 lines
drivers/net/hyperv/netvsc_drv.c +3
-0csum_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.
Quoted 3 lines
Quoted 1 line
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
Quoted 8 lines
K. Y
Quoted 1 line
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel