[dpdk-dev] [PATCH v2 2/3] virtio: allow nb_desc < vq_size

Stephen Hemminger stephen at networkplumber.org
Mon Jul 20 19:25:05 CEST 2015


When running on GCE vq_size is 16K but number of Rx descriptors
desired maybe less than that. Handle the situtaiton by initializing
full ring but only filling the smaller number.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/virtio/virtio_ethdev.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 94b7a81..d460d89 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -286,10 +286,6 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
 		return -EINVAL;
 	}
 
-	if (nb_desc != vq_size)
-		PMD_INIT_LOG(ERR, "Warning: nb_desc(%d) is not equal to vq size (%d), fall to vq size",
-			nb_desc, vq_size);
-
 	if (queue_type == VTNET_RQ) {
 		snprintf(vq_name, sizeof(vq_name), "port%d_rvq%d",
 			dev->data->port_id, queue_idx);
@@ -317,7 +313,10 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev,
 	vq->queue_id = queue_idx;
 	vq->vq_queue_index = vtpci_queue_idx;
 	vq->vq_nentries = vq_size;
-	vq->vq_free_cnt = vq_size;
+
+	if (nb_desc == 0 || nb_desc > vq_size)
+		nb_desc = vq_size;
+	vq->vq_free_cnt = nb_desc;
 
 	/*
 	 * Reserve a memzone for vring elements
-- 
2.1.4



More information about the dev mailing list