summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2018-11-07 10:34:36 +0100
committerDavid S. Miller <davem@davemloft.net>2018-11-08 07:22:16 +0100
commitf29eb2a96c56ebff6b4d9b530d5ccd61b9f538d7 (patch)
tree1393cffb15545baf0cb514096d274b4aa33c5c50
parentnet/wan/fsl_ucc_hdlc: add BQL support (diff)
downloadlinux-f29eb2a96c56ebff6b4d9b530d5ccd61b9f538d7.tar.xz
linux-f29eb2a96c56ebff6b4d9b530d5ccd61b9f538d7.zip
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: Paolo Abeni <pabeni@redhat.com> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/tun.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 060135ceaf0e..a65779c6d72f 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2448,7 +2448,8 @@ build:
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);
netif_receive_skb(skb);