From: Jason Wang Date: Fri, 15 Jul 2016 07:46:30 +0000 (-0400) Subject: macvtap: avoid hash calculating for single queue X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1b16bf42d154c8fbbab2cccc419e2ba47d700849;p=linux-beck.git macvtap: avoid hash calculating for single queue We decide the rxq through calculating its hash which is not necessary if we only have one rx queue. So this patch skip this and just return queue 0. Test shows 22% improving on guest rx pps. Before: 1201504 pkts/s After: 1472731 pkts/s Signed-off-by: Jason Wang Signed-off-by: David S. Miller --- diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 95a13321f688..2476923b424d 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c @@ -299,6 +299,9 @@ static struct macvtap_queue *macvtap_get_queue(struct net_device *dev, if (!numvtaps) goto out; + if (numvtaps == 1) + goto single; + /* Check if we can use flow to select a queue */ rxq = skb_get_hash(skb); if (rxq) { @@ -316,6 +319,7 @@ static struct macvtap_queue *macvtap_get_queue(struct net_device *dev, goto out; } +single: tap = rcu_dereference(vlan->taps[0]); out: return tap;