Patchwork [2/8] net: rps: skip fragment when computing rxhash

login
register
mail settings
Submitter Changli Gao
Date Aug. 18, 2010, 5:01 a.m.
Message ID <1282107698-3456-1-git-send-email-xiaosuo@gmail.com>
Download mbox | patch
Permalink /patch/61990/
State Accepted
Delegated to: David Miller
Headers show

Comments

Changli Gao - Aug. 18, 2010, 5:01 a.m.
Fragmented IP packets may have no transfer header, so when computing
rxhash, we should skip them.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
 net/core/dev.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet - Aug. 18, 2010, 6:25 a.m.
Le mercredi 18 août 2010 à 13:01 +0800, Changli Gao a écrit :
> Fragmented IP packets may have no transfer header, so when computing
> rxhash, we should skip them.
> 
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> ---
>  net/core/dev.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 3f82781..b7c5309 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2284,7 +2284,10 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
>  			goto done;
>  
>  		ip = (struct iphdr *) skb->data + nhoff;
> -		ip_proto = ip->protocol;
> +		if (ip->frag_off & htons(IP_MF|IP_OFFSET))
> +			ip_proto = 0;
> +		else
> +			ip_proto = ip->protocol;
>  		addr1 = (__force u32) ip->saddr;
>  		addr2 = (__force u32) ip->daddr;
>  		ihl = ip->ihl;

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

BTW, it is nicer to add some spaces :

	if (ip->frag_off & htons(IP_MF | IP_OFFSET))


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Aug. 20, 2010, 12:11 a.m.
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 18 Aug 2010 08:25:01 +0200

> Le mercredi 18 août 2010 à 13:01 +0800, Changli Gao a écrit :
>> Fragmented IP packets may have no transfer header, so when computing
>> rxhash, we should skip them.
>> 
>> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
 ...
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.

> BTW, it is nicer to add some spaces :
> 
> 	if (ip->frag_off & htons(IP_MF | IP_OFFSET))

I took care of this.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 3f82781..b7c5309 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2284,7 +2284,10 @@  __u32 __skb_get_rxhash(struct sk_buff *skb)
 			goto done;
 
 		ip = (struct iphdr *) skb->data + nhoff;
-		ip_proto = ip->protocol;
+		if (ip->frag_off & htons(IP_MF|IP_OFFSET))
+			ip_proto = 0;
+		else
+			ip_proto = ip->protocol;
 		addr1 = (__force u32) ip->saddr;
 		addr2 = (__force u32) ip->daddr;
 		ihl = ip->ihl;