Skip to content

Commit

Permalink
macvtap: avoid hash calculating for single queue
Browse files Browse the repository at this point in the history
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 <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jason Wang authored and David S. Miller committed Jul 15, 2016
1 parent e980a07 commit 1b16bf4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/macvtap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 1b16bf4

Please sign in to comment.