Skip to content

Commit 1b16bf4

Browse files
jasowangdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e980a07 commit 1b16bf4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/net/macvtap.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ static struct macvtap_queue *macvtap_get_queue(struct net_device *dev,
299299
if (!numvtaps)
300300
goto out;
301301

302+
if (numvtaps == 1)
303+
goto single;
304+
302305
/* Check if we can use flow to select a queue */
303306
rxq = skb_get_hash(skb);
304307
if (rxq) {
@@ -316,6 +319,7 @@ static struct macvtap_queue *macvtap_get_queue(struct net_device *dev,
316319
goto out;
317320
}
318321

322+
single:
319323
tap = rcu_dereference(vlan->taps[0]);
320324
out:
321325
return tap;

0 commit comments

Comments
 (0)