]> git.baikalelectronics.ru Git - kernel.git/commit
virtio-net: correctly enable callback during start_xmit
authorJason Wang <jasowang@redhat.com>
Tue, 17 Jan 2023 03:47:07 +0000 (11:47 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Feb 2023 07:34:24 +0000 (08:34 +0100)
commit9431f0f3dc9d0afb1e93c336c0745a907748d01f
tree68cd09dfc14c4d7d64d62c1ce15b8e5db004c459
parent30fdd3dd376056b7366b3c1221b7e1b04d603a66
virtio-net: correctly enable callback during start_xmit

[ Upstream commit 2ea20770c6f8c8ffddaf960d26b054f1ab1a6646 ]

Commit 3d651258564f("virtio_net: disable cb aggressively") enables
virtqueue callback via the following statement:

        do {
if (use_napi)
virtqueue_disable_cb(sq->vq);

free_old_xmit_skbs(sq, false);

} while (use_napi && kick &&
               unlikely(!virtqueue_enable_cb_delayed(sq->vq)));

When NAPI is used and kick is false, the callback won't be enabled
here. And when the virtqueue is about to be full, the tx will be
disabled, but we still don't enable tx interrupt which will cause a TX
hang. This could be observed when using pktgen with burst enabled.

TO be consistent with the logic that tries to disable cb only for
NAPI, fixing this by trying to enable delayed callback only when NAPI
is enabled when the queue is about to be full.

Fixes: 3d651258564f ("virtio_net: disable cb aggressively")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Tested-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/virtio_net.c