virtio-net: support XDP when not more queues
authorXuan Zhuo <xuanzhuo@linux.alibaba.com>
Wed, 10 Mar 2021 02:24:45 +0000 (10:24 +0800)
committerSasha Levin <sashal@kernel.org>
Thu, 26 Aug 2021 12:35:47 +0000 (08:35 -0400)
commitb7adfde949307efaeef0f32ca28273f6499c7c1d
tree0b26ebedd4646134aa08beb23a064f23446d5289
parent1ce62fe6e4cb7dc4736ba2591bb87e79e78a217b
virtio-net: support XDP when not more queues

[ Upstream commit 97c2c69e1926260c78c7f1c0b2c987934f1dc7a1 ]

The number of queues implemented by many virtio backends is limited,
especially some machines have a large number of CPUs. In this case, it
is often impossible to allocate a separate queue for
XDP_TX/XDP_REDIRECT, then xdp cannot be loaded to work, even xdp does
not use the XDP_TX/XDP_REDIRECT.

This patch allows XDP_TX/XDP_REDIRECT to run by reuse the existing SQ
with __netif_tx_lock() hold when there are not enough queues.

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/virtio_net.c