From: KY Srinivasan <kys@microsoft.com>
To: David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>,
"olaf@aepfle.de" <olaf@aepfle.de>,
"apw@canonical.com" <apw@canonical.com>,
"jasowang@redhat.com" <jasowang@redhat.com>
Subject: RE: [PATCH net 3/3] Drivers: net: hyperv: Address UDP checksum issues
Date: Wed, 9 Apr 2014 18:08:47 +0000 [thread overview]
Message-ID: <4ae24ae5c6ea45c399e7be03c69dc442@BY2PR03MB299.namprd03.prod.outlook.com> (raw)
In-Reply-To: <20140409.130111.1002891296248446198.davem@davemloft.net>
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Wednesday, April 9, 2014 10:01 AM
> To: KY Srinivasan
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> jasowang@redhat.com
> Subject: Re: [PATCH net 3/3] Drivers: net: hyperv: Address UDP checksum
> issues
>
> 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.
Thanks Dave. I will COW the SKB before changing the checksum value. I do have a question though.
I looked at a bunch of hardware drivers and they modify the header information, specially checksum
field and I could not see where they had COWed the skb. I was grepping for skb_cow in these drivers.
Regards,
K. Y
next prev parent reply other threads:[~2014-04-09 18:08 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
2014-04-09 18:08 ` KY Srinivasan [this message]
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=4ae24ae5c6ea45c399e7be03c69dc442@BY2PR03MB299.namprd03.prod.outlook.com \
--to=kys@microsoft.com \
--cc=apw@canonical.com \
--cc=davem@davemloft.net \
--cc=devel@linuxdriverproject.org \
--cc=jasowang@redhat.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
all inboxes | Powered by JetHome®