]> git.droids-corp.org - dpdk.git/commitdiff
net/virtio: fix check scatter on all Rx queues
authorZhihong Peng <zhihongx.peng@intel.com>
Fri, 8 Oct 2021 05:49:45 +0000 (05:49 +0000)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Thu, 21 Oct 2021 12:24:13 +0000 (14:24 +0200)
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 <zhihongx.peng@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_ethdev.c

index 047d3f43a3cf2b227ca6628c2df7caed43015fdd..ddf0e26ab4dbf2fd39319fe95ae094fee56178fd 100644 (file)
@@ -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;