From 84cc857b5d9a344a1f04ec9f55417b58cd38e260 Mon Sep 17 00:00:00 2001 From: Zhihong Peng Date: Fri, 8 Oct 2021 05:49:45 +0000 Subject: [PATCH 1/1] net/virtio: fix check scatter on all Rx queues This patch fixes the wrong way to obtain virtqueue. The end of virtqueue cannot be judged based on whether the array is NULL. Fixes: 4e8169eb0d2d ("net/virtio: fix Rx scatter offload") Cc: stable@dpdk.org Signed-off-by: Zhihong Peng Reviewed-by: Maxime Coquelin --- drivers/net/virtio/virtio_ethdev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 047d3f43a3..ddf0e26ab4 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -882,8 +882,11 @@ virtio_check_scatter_on_all_rx_queues(struct rte_eth_dev *dev, if (hw->vqs == NULL) return true; - for (qidx = 0; (vq = hw->vqs[2 * qidx + VTNET_SQ_RQ_QUEUE_IDX]) != NULL; - qidx++) { + for (qidx = 0; qidx < hw->max_queue_pairs; qidx++) { + vq = hw->vqs[2 * qidx + VTNET_SQ_RQ_QUEUE_IDX]; + if (vq == NULL) + continue; + rxvq = &vq->rxq; if (rxvq->mpool == NULL) continue; -- 2.20.1