virtio_net: move txq wakeups under tx q lock
authorMichael S. Tsirkin <mst@redhat.com>
Tue, 13 Apr 2021 05:38:08 +0000 (01:38 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Sat, 3 Jul 2021 08:51:17 +0000 (04:51 -0400)
commit22bc63c58e876cc359d0b1566dee3db8ecc16722
tree1c33db49b994b50b7370a647959e7ee29ceebf9d
parent5a2f966d0f3fa0ef6dada7ab9eda74cacee96b8a
virtio_net: move txq wakeups under tx q lock

We currently check num_free outside tx q lock
which is unsafe: new packets can arrive meanwhile
and there won't be space in the queue.
Thus a spurious queue wakeup causing overhead
and even packet drops.

Move the check under the lock to fix that.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/net/virtio_net.c