From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: [PATCH v2 09/10] net/virtio: fix less queues being enabled issue Date: Sat, 5 Nov 2016 17:41:04 +0800 Message-ID: <1478338865-26126-10-git-send-email-yuanhan.liu@linux.intel.com> References: <1478189400-14606-1-git-send-email-yuanhan.liu@linux.intel.com> <1478338865-26126-1-git-send-email-yuanhan.liu@linux.intel.com> Cc: Thomas Monjalon , Tan Jianfeng , Kevin Traynor , Ilya Maximets , Kyle Larose , Maxime Coquelin , Yuanhan Liu To: dev@dpdk.org Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id E4282137C for ; Sat, 5 Nov 2016 10:40:31 +0100 (CET) In-Reply-To: <1478338865-26126-1-git-send-email-yuanhan.liu@linux.intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >>From the virtio spec of view, multiple-queue is always enabled/disabled in queue pairs. DPDK somehow allows the case when Tx and Rx queue number are different. Currently, virtio PMD get the queue pair number from the nb_rx_queues field, which could be an issue when Tx queue number > Rx queue number. Say, 2 Tx queues and 1 Rx queues. This would end up with 1 quues being enabled. Which is wrong. The fix is straightforward. Just pick a bigger number and enable that many of queues. Fixes: 823ad647950a ("virtio: support multiple queues") Signed-off-by: Yuanhan Liu --- drivers/net/virtio/virtio_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 5ec3e0e..d70bd00 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1493,7 +1493,7 @@ virtio_dev_start(struct rte_eth_dev *dev) *Otherwise the tap backend might already stop its queue due to fullness. *vhost backend will have no chance to be waked up */ - nb_queues = dev->data->nb_rx_queues; + nb_queues = RTE_MAX(dev->data->nb_rx_queues, dev->data->nb_tx_queues); if (nb_queues > 1) { if (virtio_set_multiple_queues(dev, nb_queues) != 0) return -EINVAL; @@ -1501,7 +1501,7 @@ virtio_dev_start(struct rte_eth_dev *dev) PMD_INIT_LOG(DEBUG, "nb_queues=%d", nb_queues); - for (i = 0; i < nb_queues; i++) { + for (i = 0; i < dev->data->nb_rx_queues; i++) { rxvq = dev->data->rx_queues[i]; virtqueue_notify(rxvq->vq); } -- 1.9.0