Skip to contentSkip to conversation

net: rps: skip fragment when computing rxhash

PATCH Applied Changli Gao 3 participants 3 messages Aug 18, 2010 – Aug 20, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/8 net: rps: skip fragment when computing rxhash

Fragmented IP packets may have no transfer header, so when computing rxhash, we should skip them.

---
 net/core/dev.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/core/dev.c +4 -1
index 3f82781..b7c5309 100644
@@ -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 on v1 2/8
#1 lore raw
Quoted 13 lines · Changli Gao

Fragmented IP packets may have no transfer header, so when computing rxhash, we should skip them.

---
 net/core/dev.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/core/dev.c +0 -0
index 3f82781..b7c5309 100644
@@ -2284,7 +2284,10 @@ __u32 __skb_get_rxhash(struct sk_buff *skb)
 			goto done;

net/core/dev.c __u32 __skb_get_rxhash(struct sk_buff *skb) · line 2293

Quoted 10 lines
net/core/dev.c +4 -1
 
 		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;

BTW, it is nicer to add some spaces :

	if (ip->frag_off & htons(IP_MF | IP_OFFSET))
maintainer Applied
#2 lore raw

From: Eric Dumazet <[email protected]>
Date: Wed, 18 Aug 2010 08:25:01 +0200

Quoted 5 lines · Changli Gao
Quoted 4 lines

Fragmented IP packets may have no transfer header, so when computing rxhash, we should skip them.

...

Quoted 1 line

Applied.

Quoted 3 lines

BTW, it is nicer to add some spaces :

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

I took care of this.