Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51ec0403 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller
Browse files

ipv6: GRO should be ECN friendly



IPv4 side of the problem was addressed in commit a9e050f4
(net: tcp: GRO should be ECN friendly)

This patch does the same, but for IPv6 : A Traffic Class mismatch
doesnt mean flows are different, but instead should force a flush
of previous packets.

This patch removes artificial packet reordering problem.

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e1f16503
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -880,22 +880,25 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
	nlen = skb_network_header_len(skb);

	for (p = *head; p; p = p->next) {
		struct ipv6hdr *iph2;
		const struct ipv6hdr *iph2;
		__be32 first_word; /* <Version:4><Traffic_Class:8><Flow_Label:20> */

		if (!NAPI_GRO_CB(p)->same_flow)
			continue;

		iph2 = ipv6_hdr(p);
		first_word = *(__be32 *)iph ^ *(__be32 *)iph2 ;

		/* All fields must match except length. */
		/* All fields must match except length and Traffic Class. */
		if (nlen != skb_network_header_len(p) ||
		    memcmp(iph, iph2, offsetof(struct ipv6hdr, payload_len)) ||
		    (first_word & htonl(0xF00FFFFF)) ||
		    memcmp(&iph->nexthdr, &iph2->nexthdr,
			   nlen - offsetof(struct ipv6hdr, nexthdr))) {
			NAPI_GRO_CB(p)->same_flow = 0;
			continue;
		}

		/* flush if Traffic Class fields are different */
		NAPI_GRO_CB(p)->flush |= !!(first_word & htonl(0x0FF00000));
		NAPI_GRO_CB(p)->flush |= flush;
	}