Commit f29eb2a9 authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller

tun: compute the RFS hash only if needed.

The tun XDP sendmsg code path, unconditionally computes the symmetric
hash of each packet for RFS's sake, even when we could skip it. e.g.
when the device has a single queue.

This change adds the check already in-place for the skb sendmsg path
to avoid unneeded hashing.

The above gives small, but measurable, performance gain for VM xmit
path when zerocopy is not enabled.
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2e7ad56a
...@@ -2448,7 +2448,8 @@ static int tun_xdp_one(struct tun_struct *tun, ...@@ -2448,7 +2448,8 @@ static int tun_xdp_one(struct tun_struct *tun,
goto out; goto out;
} }
if (!rcu_dereference(tun->steering_prog)) if (!rcu_dereference(tun->steering_prog) && tun->numqueues > 1 &&
!tfile->detached)
rxhash = __skb_get_hash_symmetric(skb); rxhash = __skb_get_hash_symmetric(skb);
netif_receive_skb(skb); netif_receive_skb(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment