diff options
author | Xuan Zhuo <xuanzhuo@linux.alibaba.com> | 2023-03-08 03:49:35 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-03-11 01:46:00 +0100 |
commit | cd1c604aa1d8c641f5edcb58b76352d4eba06ec1 (patch) | |
tree | 7288fb6d9584cff253016ec6dc44cfc04048e0a0 /drivers/net/virtio_net.c | |
parent | virtio_net: separate the logic of checking whether sq is full (diff) | |
download | linux-cd1c604aa1d8c641f5edcb58b76352d4eba06ec1.tar.xz linux-cd1c604aa1d8c641f5edcb58b76352d4eba06ec1.zip |
virtio_net: add checking sq is full inside xdp xmit
If the queue of xdp xmit is not an independent queue, then when the xdp
xmit used all the desc, the xmit from the __dev_queue_xmit() may encounter
the following error.
net ens4: Unexpected TXQ (0) queue failure: -28
This patch adds a check whether sq is full in xdp xmit.
Fixes: 56434a01b12e ("virtio_net: add XDP_TX support")
Reported-by: Yichun Zhang <yichun@openresty.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 46bbddaadb0d..1a309cfb4976 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -767,6 +767,9 @@ static int virtnet_xdp_xmit(struct net_device *dev, } ret = nxmit; + if (!is_xdp_raw_buffer_queue(vi, sq - vi->sq)) + check_sq_full_and_disable(vi, dev, sq); + if (flags & XDP_XMIT_FLUSH) { if (virtqueue_kick_prepare(sq->vq) && virtqueue_notify(sq->vq)) kicks = 1; |