net/virtio: fix resuming port with Rx vector path
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Mon, 12 Feb 2018 15:46:11 +0000 (16:46 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 13 Feb 2018 17:57:59 +0000 (18:57 +0100)
commit478574706638ff78cbc7e82731a4eae743322ac6
tree9b170ec44cb99b4adde65a386ff2077a0c7a0a5a
parent9fedc2da388cbe261e43c7b1cafb7463ccce3747
net/virtio: fix resuming port with Rx vector path

Since commit efc83a1e7fc3 ("net/virtio: fix queue setup consistency"),
when resuming a virtio port, the rx rings are refilled with new mbufs
until they are full (vq->vq_free_cnt == 0). This is done without
ensuring that the descriptor index remains a multiple of
RTE_VIRTIO_VPMD_RX_REARM_THRESH, which is a prerequisite when using the
vector mode. This can cause an out of bound access in the rx ring.

This commit changes the vector refill method from
virtqueue_enqueue_recv_refill_simple() to virtio_rxq_rearm_vec(), which
properly checks that the refill is done by batch of
RTE_VIRTIO_VPMD_RX_REARM_THRESH.

As virtqueue_enqueue_recv_refill_simple() is no more used, this
patch also removes the function.

Fixes: efc83a1e7fc3 ("net/virtio: fix queue setup consistency")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Jianfeng Tan <jianfeng.tan@intel.com>
drivers/net/virtio/virtio_rxtx.c
drivers/net/virtio/virtio_rxtx.h
drivers/net/virtio/virtio_rxtx_simple.c
drivers/net/virtio/virtio_rxtx_simple.h