DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: changchun.ouyang@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 2/3] virtio: allow nb_desc < vq_size
Date: Mon, 20 Jul 2015 10:25:05 -0700	[thread overview]
Message-ID: <1437413106-16069-3-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1437413106-16069-1-git-send-email-stephen@networkplumber.org>

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@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

  parent reply	other threads:[~2015-07-20 17:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-20 17:25 [dpdk-dev] [PATCH v2 0/3] virtio: size bug fixes Stephen Hemminger
2015-07-20 17:25 ` [dpdk-dev] [PATCH v2 1/3] virtio: fix the vq size issue Stephen Hemminger
2015-07-20 17:25 ` Stephen Hemminger [this message]
2015-07-20 17:25 ` [dpdk-dev] [PATCH v2 3/3] virtio: small cleanups Stephen Hemminger
2015-07-20 17:43 ` [dpdk-dev] [PATCH v2 0/3] virtio: size bug fixes Thomas Monjalon
2015-07-20 18:26   ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437413106-16069-3-git-send-email-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=changchun.ouyang@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).