From: Haiyang Zhang <haiyangz@microsoft.com>
To: David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
KY Srinivasan <kys@microsoft.com>,
"olaf@aepfle.de" <olaf@aepfle.de>,
"jasowang@redhat.com" <jasowang@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"driverdev-devel@linuxdriverproject.org"
<driverdev-devel@linuxdriverproject.org>
Subject: RE: [PATCH net-next] hyperv: Add handling of IP header with option field in netvsc_set_hash()
Date: Fri, 22 Aug 2014 21:06:10 +0000 [thread overview]
Message-ID: <0d7d4fd9cf1448f3a92b07b241d21a7e@DFM-DB3MBX15-06.exchange.corp.microsoft.com> (raw)
In-Reply-To: <20140821.213057.1438247518790500739.davem@davemloft.net>
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Friday, August 22, 2014 12:31 AM
> To: Haiyang Zhang
> Cc: netdev@vger.kernel.org; KY Srinivasan; olaf@aepfle.de;
> jasowang@redhat.com; linux-kernel@vger.kernel.org; driverdev-
> devel@linuxdriverproject.org
> Subject: Re: [PATCH net-next] hyperv: Add handling of IP header with
> option field in netvsc_set_hash()
>
> From: Haiyang Zhang <haiyangz@microsoft.com>
> Date: Tue, 19 Aug 2014 20:53:55 +0000
>
> > @@ -200,12 +202,18 @@ static bool netvsc_set_hash(u32 *hash, struct
> sk_buff *skb)
> > iphdr = ip_hdr(skb);
> >
> > if (iphdr->version == 4) {
> > - if (iphdr->protocol == IPPROTO_TCP)
> > + data = (u8 *)&iphdr->saddr;
> > + if (iphdr->protocol == IPPROTO_TCP) {
> > data_len = 12;
> > - else
> > + if (iphdr->ihl > 5) {
> > + memcpy(dbuf, &iphdr->saddr, 8);
> > + memcpy(&dbuf[8], &tcp_hdr(skb)->source, 4);
>
> This is rediculous.
>
> Make hash_comp() take a void pointer for the buffer.
>
> Then your code is simply:
>
> be32 dbuf[2];
>
> dbuf[1] = iph->saddr;
> dbuf[2] = iph->daddr;
> dbuf[3] = *(be32 *)tcph->source;
>
> *hash = comp_hash(netvsc_hash_key, HASH_KEYLEN, dbuf, 12);
>
> No special cases for IP options or any garbage like that.
I have submitted a revised patch with the suggested changes.
Thanks,
- Haiyang
prev parent reply other threads:[~2014-08-22 21:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-19 20:53 Haiyang Zhang
2014-08-22 4:30 ` David Miller
2014-08-22 21:06 ` Haiyang Zhang [this message]
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=0d7d4fd9cf1448f3a92b07b241d21a7e@DFM-DB3MBX15-06.exchange.corp.microsoft.com \
--to=haiyangz@microsoft.com \
--cc=davem@davemloft.net \
--cc=driverdev-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
all inboxes | Powered by JetHome®