net/virtio: check head desc with correct wrap counter
authorJens Freimann <jfreimann@redhat.com>
Fri, 11 Jan 2019 09:39:28 +0000 (10:39 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 14 Jan 2019 16:44:29 +0000 (17:44 +0100)
commita4270ea4ff79b46280dd542f4ab3eb45f8c9685a
tree38849959d6f44fc18f87d09e64670dbdc7fb2a3f
parent9230ab8d791399179498d42dfd84981c5bba412a
net/virtio: check head desc with correct wrap counter

In virtio_pq_send_command() we check for a used descriptor
and wait in an idle loop until it becomes used. We can't use
vq->used_wrap_counter here to check for the first descriptor
we made available because the ring could have wrapped. Let's use
the used_wrap_counter that matches the state of the head descriptor.

Fixes: ec194c2f1895 ("net/virtio: support packed queue in send command")

Signed-off-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_ethdev.c
drivers/net/virtio/virtqueue.h