[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0d7d4fd9cf1448f3a92b07b241d21a7e@DFM-DB3MBX15-06.exchange.corp.microsoft.com>
Date: Fri, 22 Aug 2014 21:06:10 +0000
From: Haiyang Zhang <haiyangz@...rosoft.com>
To: David Miller <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
KY Srinivasan <kys@...rosoft.com>,
"olaf@...fle.de" <olaf@...fle.de>,
"jasowang@...hat.com" <jasowang@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"driverdev-devel@...uxdriverproject.org"
<driverdev-devel@...uxdriverproject.org>
Subject: RE: [PATCH net-next] hyperv: Add handling of IP header with option
field in netvsc_set_hash()
> -----Original Message-----
> From: David Miller [mailto:davem@...emloft.net]
> Sent: Friday, August 22, 2014 12:31 AM
> To: Haiyang Zhang
> Cc: netdev@...r.kernel.org; KY Srinivasan; olaf@...fle.de;
> jasowang@...hat.com; linux-kernel@...r.kernel.org; driverdev-
> devel@...uxdriverproject.org
> Subject: Re: [PATCH net-next] hyperv: Add handling of IP header with
> option field in netvsc_set_hash()
>
> From: Haiyang Zhang <haiyangz@...rosoft.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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists