netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: kys@microsoft.com
Cc: olaf@aepfle.de, netdev@vger.kernel.org, jasowang@redhat.com,
	linux-kernel@vger.kernel.org, apw@canonical.com,
	devel@linuxdriverproject.org
Subject: Re: [PATCH net 3/3] Drivers: net: hyperv: Address UDP checksum issues
Date: Wed, 09 Apr 2014 13:01:11 -0400 (EDT)	[thread overview]
Message-ID: <20140409.130111.1002891296248446198.davem@davemloft.net> (raw)
In-Reply-To: <1396986371-12137-4-git-send-email-kys@microsoft.com>

From: "K. Y. Srinivasan" <kys@microsoft.com>
Date: Tue,  8 Apr 2014 12:46:11 -0700

>  	} else if (net_trans_info & INFO_UDP) {
> -		csum_info->transmit.udp_checksum = 1;
> +		/* UDP checksum offload is not supported on ws2008r2.
> +		 * Furthermore, on ws2012 and ws2012r2, there are some
> +		 * issues with udp checksum offload from Linux guests.
> +		 * (these are host issues).
> +		 * For now compute the checksum here.
> +		 */
> +		struct udphdr *uh = udp_hdr(skb);
> +		u16 udp_len = ntohs(uh->len);
> +
> +		uh->check = 0;
> +		uh->check = csum_tcpudp_magic(ip_hdr(skb)->saddr,
> +					      ip_hdr(skb)->daddr,
> +					      udp_len, IPPROTO_UDP,
> +					      csum_partial(uh, udp_len, 0));
> +		if (uh->check == 0)
> +			uh->check = CSUM_MANGLED_0;
> +
> +		csum_info->transmit.udp_checksum = 0;

You absolutely cannot mangle packet header contents without first
COW'ing the SKB to make sure it's writable.

Otherwise network taps like tcpdump, and any other entity with a reference
to the packet, can see inconsistent state.

  reply	other threads:[~2014-04-09 17:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 19:45 [PATCH net 0/3] Fix issues with Heper-V network offload code K. Y. Srinivasan
2014-04-08 19:46 ` K. Y. Srinivasan
2014-04-08 19:46   ` [PATCH net 1/3] Drivers: net: hyperv: Allocate memory for all possible per-pecket information K. Y. Srinivasan
2014-04-08 19:46   ` [PATCH net 2/3] Drivers: net: hyperv: Negotiate suitable ndis version for offload support K. Y. Srinivasan
2014-04-08 19:46   ` [PATCH net 3/3] Drivers: net: hyperv: Address UDP checksum issues K. Y. Srinivasan
2014-04-09 17:01     ` David Miller [this message]
2014-04-09 18:08       ` KY Srinivasan
2014-04-09 18:36         ` David Miller
2014-04-09 18:39           ` KY Srinivasan
2014-04-09 18:42             ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140409.130111.1002891296248446198.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=apw@canonical.com \
    --cc=devel@linuxdriverproject.org \
    --cc=jasowang@redhat.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olaf@aepfle.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).