Commit cd1c604a authored by Xuan Zhuo's avatar Xuan Zhuo Committed by Jakub Kicinski

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: 56434a01 ("virtio_net: add XDP_TX support")
Reported-by: default avatarYichun Zhang <yichun@openresty.com>
Signed-off-by: default avatarXuan Zhuo <xuanzhuo@linux.alibaba.com>
Reviewed-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b8ef4809
...@@ -767,6 +767,9 @@ static int virtnet_xdp_xmit(struct net_device *dev, ...@@ -767,6 +767,9 @@ static int virtnet_xdp_xmit(struct net_device *dev,
} }
ret = nxmit; 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 (flags & XDP_XMIT_FLUSH) {
if (virtqueue_kick_prepare(sq->vq) && virtqueue_notify(sq->vq)) if (virtqueue_kick_prepare(sq->vq) && virtqueue_notify(sq->vq))
kicks = 1; kicks = 1;
......
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