net/virtio: fix split queue vectorized Rx
authorIvan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Fri, 20 Aug 2021 12:47:52 +0000 (15:47 +0300)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 14 Sep 2021 11:21:57 +0000 (13:21 +0200)
commitc97e73779c3eb2f7c214a7300673e54b886223b6
tree5f948e3f34ef06f8098cc0422981b71a79cc2051
parent9897896ec78b4568ff60ed1dab27fd01e15c96a4
net/virtio: fix split queue vectorized Rx

Descriptors number may be set less than queue size for split queue
vectorized Rx path. Pointers to mbufs for received packets are
obtained from SW ring, that is initially filled with them in the end
of queue setup in virtio_dev_rx_queue_setup_finish(). The begin of the
SW ring filled up to the size of descriptors number. At queue size
offset from the begin of the SW ring pointers to some fake mbuf are also
set for wrapping purpose. So the ring may contains the hole of invalid
pointers from descriptors number offset to queue size offset, and split
vectorized Rx routines could write to the invalid addresses since they
use the ring up to the queue size. Fix this by setting descriptors
number to queue size on Rx queue setup.

Fixes: fc3d66212fed ("virtio: add vector Rx")
Cc: stable@dpdk.org
Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_rxtx.c