vhost: simplify getting first in-flight index
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 26 Oct 2021 16:29:00 +0000 (18:29 +0200)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Fri, 29 Oct 2021 10:32:30 +0000 (12:32 +0200)
commitc75987487d1d4d6aa3978c210a5b229e2a36b7c2
tree7f11a04601e0a740ae700b54e9d01660596d9398
parenta3cfa8081f65339b356591036ed25a510098a901
vhost: simplify getting first in-flight index

This patch reworks the function getting the index
for the first packet in-flight.

When this index turns out to be zero, let's use the simple
path. Doing that avoid having to do a modulo with the
virtqueue size.

The patch also rename the function for better clarification,
and only pass the virtqueue metadata pointer, as all the
needed information are stored there.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Jiayu Hu <jiayu.hu@intel.com>
lib/vhost/virtio_net.c