All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] gro: relax ID check in inet_gro_receive()
@ 2013-03-21  4:52 Eric Dumazet
  2013-03-21  9:59 ` Maciej Żenczykowski
  2013-03-21 15:46 ` David Miller
  0 siblings, 2 replies; 19+ messages in thread
From: Eric Dumazet @ 2013-03-21  4:52 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, Dmitry Kravkov, Eilon Greenstein, Pravin B Shelar,
	H.K. Jerry Chu, Maciej Żenczykowski

From: Eric Dumazet <edumazet@google.com>

GRE TSO support doesn't increment the ID in the inner IP header.

Remove the ID check in inet_gro_receive() so that GRO can properly
aggregate GRE encapsulated TCP packets, instead of forcing
a flush for every packet.

Testing the IP ID is not really needed anyway for proper GRO operation.

We can use more readable (and faster) code to access tot_len and
frag_off fields.

Tested on a bnx2x setup after commit a848ade408b6b
(bnx2x: add CSUM and TSO support for encapsulation protocols)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Dmitry Kravkov <dmitry@broadcom.com>
Cc: Eilon Greenstein <eilong@broadcom.com>
Cc: Pravin B Shelar <pshelar@nicira.com>
Cc: H.K. Jerry Chu <hkchu@google.com>
Cc: Maciej Żenczykowski <maze@google.com>
---
 net/ipv4/af_inet.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 9e5882c..302a47e 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1355,7 +1355,6 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
 	const struct iphdr *iph;
 	unsigned int hlen;
 	unsigned int off;
-	unsigned int id;
 	int flush = 1;
 	int proto;
 
@@ -1381,9 +1380,9 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
 	if (unlikely(ip_fast_csum((u8 *)iph, 5)))
 		goto out_unlock;
 
-	id = ntohl(*(__be32 *)&iph->id);
-	flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id ^ IP_DF));
-	id >>= 16;
+	flush = ntohs(iph->tot_len) ^ skb_gro_len(skb);
+
+	flush |= (__force u16)iph->frag_off ^ htons(IP_DF);
 
 	for (p = *head; p; p = p->next) {
 		struct iphdr *iph2;
@@ -1400,11 +1399,9 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
 			continue;
 		}
 
-		/* All fields must match except length and checksum. */
 		NAPI_GRO_CB(p)->flush |=
 			(iph->ttl ^ iph2->ttl) |
-			(iph->tos ^ iph2->tos) |
-			((u16)(ntohs(iph2->id) + NAPI_GRO_CB(p)->count) ^ id);
+			(iph->tos ^ iph2->tos);
 
 		NAPI_GRO_CB(p)->flush |= flush;
 	}

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2013-03-21 21:39 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-21  4:52 [PATCH net-next] gro: relax ID check in inet_gro_receive() Eric Dumazet
2013-03-21  9:59 ` Maciej Żenczykowski
2013-03-21 10:05   ` Maciej Żenczykowski
2013-03-21 14:56   ` David Miller
2013-03-21 15:46 ` David Miller
2013-03-21 16:08   ` Eric Dumazet
2013-03-21 16:31     ` David Miller
2013-03-21 18:11     ` Dmitry Kravkov
2013-03-21 18:56       ` David Miller
2013-03-21 20:14         ` Maciej Żenczykowski
2013-03-21 20:20           ` David Miller
2013-03-21 20:47             ` Maciej Żenczykowski
2013-03-21 21:05               ` David Miller
2013-03-21 21:37                 ` Jesse Gross
2013-03-21 21:39                   ` David Miller
     [not found]     ` <CAM8tLiPh=g1+XqhwKQAH7XyTmpT80j5422VXGjLksxtFxYoxRQ@mail.gmail.com>
2013-03-21 20:07       ` Maciej Żenczykowski
2013-03-21 20:13         ` Dmitry Kravkov
2013-03-21 16:20   ` Ben Hutchings
2013-03-21 16:31     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.