Message ID | alpine.DEB.2.02.1401141555560.25161@tomh.mtv.corp.google.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Tue, 2014-01-14 at 16:02 -0800, Tom Herbert wrote: > 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. > Use skb_hash_noeval so that we don't force the hash to be calculated. > > Tested by running netperf 200 TCP_STREAMs between two machines with > GRO, HW rxhash, and 1G. Saw no performance degration, slight reduction > of time in dev_gro_receive. > > Signed-off-by: Tom Herbert <therbert@google.com> > --- > net/core/dev.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) Acked-by: Eric Dumazet <edumazet@google.com> -- 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
diff --git a/net/core/dev.c b/net/core/dev.c index a828015..4232b32 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3794,10 +3794,18 @@ 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_noeval(skb); for (p = napi->gro_list; p; p = p->next) { unsigned long diffs; + NAPI_GRO_CB(p)->flush = 0; + + if (hash != skb_get_hash_noeval(p)) { + NAPI_GRO_CB(p)->same_flow = 0; + continue; + } + diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev; diffs |= p->vlan_tci ^ skb->vlan_tci; if (maclen == ETH_HLEN) @@ -3808,7 +3816,6 @@ static void gro_list_prepare(struct napi_struct *napi, struct sk_buff *skb) skb_gro_mac_header(skb), maclen); NAPI_GRO_CB(p)->same_flow = !diffs; - NAPI_GRO_CB(p)->flush = 0; } }
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. Use skb_hash_noeval so that we don't force the hash to be calculated. Tested by running netperf 200 TCP_STREAMs between two machines with GRO, HW rxhash, and 1G. Saw no performance degration, slight reduction of time in dev_gro_receive. Signed-off-by: Tom Herbert <therbert@google.com> --- net/core/dev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)