Netdev List
 help / color / mirror / Atom feed
From: Tom Herbert <therbert@google.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH] net: Check skb->rxhash in gro_receive
Date: Thu, 9 Jan 2014 20:54:09 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.02.1401092051020.25554@tomh.mtv.corp.google.com> (raw)

When initializing a gro_list for a packet, first check the rxhash of
the incoming skb against that of the skb's in the list. This should be
a very strong inidicator of whether the flow is going to be matched,
and potentially allows a lot of other checks to be short circuited.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 net/core/dev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index ce01847..88bf426 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3794,10 +3794,14 @@ static void gro_list_prepare(struct napi_struct *napi, struct sk_buff *skb)
 {
 	struct sk_buff *p;
 	unsigned int maclen = skb->dev->hard_header_len;
+	u32 hash = skb_get_hash(skb);
 
 	for (p = napi->gro_list; p; p = p->next) {
 		unsigned long diffs;
 
+		if ((diffs = (hash != p->rxhash)))
+			goto skip;
+
 		diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
 		diffs |= p->vlan_tci ^ skb->vlan_tci;
 		if (maclen == ETH_HLEN)
@@ -3807,6 +3811,7 @@ static void gro_list_prepare(struct napi_struct *napi, struct sk_buff *skb)
 			diffs = memcmp(skb_mac_header(p),
 				       skb_gro_mac_header(skb),
 				       maclen);
+skip:
 		NAPI_GRO_CB(p)->same_flow = !diffs;
 		NAPI_GRO_CB(p)->flush = 0;
 	}
-- 
1.8.5.1

             reply	other threads:[~2014-01-10  4:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-10  4:54 Tom Herbert [this message]
2014-01-10  5:00 ` [PATCH] net: Check skb->rxhash in gro_receive David Miller
2014-01-10  5:38 ` Eric Dumazet
2014-01-10  5:43   ` Eric Dumazet
2014-01-10 16:47     ` Tom Herbert
2014-01-10 16:27   ` Tom Herbert
2014-01-10 17:45     ` Eric Dumazet
2014-01-10 18:15       ` Tom Herbert
2014-01-10 18:54         ` Eric Dumazet
2014-01-10 19:42           ` Tom Herbert
2014-01-10 20:43             ` Eric Dumazet
2014-01-10 23:22               ` Tom Herbert
2014-01-13 19:59     ` David Miller
2014-01-13 20:13       ` Tom Herbert
2014-01-13 20:17       ` Eric Dumazet
2014-01-13 20:50         ` Ben Hutchings
2014-01-13 21:37           ` Eric Dumazet
2014-01-15  1:31             ` Ben Hutchings
2014-01-15  2:27               ` Eric Dumazet
2014-01-15  2:43                 ` Ben Hutchings
2014-01-13 21:24         ` Tom Herbert
2014-01-13 21:36           ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1401092051020.25554@tomh.mtv.corp.google.com \
    --to=therbert@google.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox