From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 23499A0C41 for ; Fri, 8 Oct 2021 08:00:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA7CA40040; Fri, 8 Oct 2021 08:00:17 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 7FEF040040; Fri, 8 Oct 2021 08:00:15 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10130"; a="226393216" X-IronPort-AV: E=Sophos;i="5.85,356,1624345200"; d="scan'208";a="226393216" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2021 23:00:14 -0700 X-IronPort-AV: E=Sophos;i="5.85,356,1624345200"; d="scan'208";a="439816149" Received: from unknown (HELO localhost.localdomain) ([10.240.183.65]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2021 23:00:11 -0700 From: zhihongx.peng@intel.com To: chenbo.xia@intel.com, maxime.coquelin@redhat.com Cc: dev@dpdk.org, ivan.ilchenko@oktetlabs.ru, Zhihong Peng , stable@dpdk.org Date: Fri, 8 Oct 2021 05:49:45 +0000 Message-Id: <20211008054945.368548-1-zhihongx.peng@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210804083128.64981-1-zhihongx.peng@intel.com> References: <20210804083128.64981-1-zhihongx.peng@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v2] net/virtio: fix check scatter on all Rx queues X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Zhihong Peng 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 --- 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 b60eeb24ab..213110cff4 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -888,8 +888,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.25.1