From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by dpdk.org (Postfix) with ESMTP id B6EDE9655 for ; Mon, 20 Jul 2015 19:25:01 +0200 (CEST) Received: by pabkd10 with SMTP id kd10so32287462pab.2 for ; Mon, 20 Jul 2015 10:25:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=azsufTqze0ubR3IP/0UmMtGWk7V0a9UfQ+uKCW5OHZE=; b=kO7igj1in6iAoJGWOgCgsfVuSQbSV0dega5h3l1Jx1RlRQ+xduZ5GhEzVNjPvzNbX8 VHHp8zpXU6fBtHwlVKZBJ6WRGeFxGqvuumiuwpHebVM1AnaOQ0Gbh1L5KxrPpREpzXYI gnt9/dn2QYcCKTDcFtAoHeO3+cMXluLe2UCwRW61mTxs/35wXa41iIojRgvogmKtX0aH 6cDROQwgcEC7AWkL5sllf+AI9Bm2a7RsS4AbUD7CTQYVaV5Y17gM+6cHxD5P4IeT0sQJ bVCBwz3vNc4KpIBdt8vKTB1Avb5ihvrwv9FrKIyLxJD40V5NrpgRN0RtuSycO9j0JIMr LA8g== X-Gm-Message-State: ALoCoQl7zSlTXCqSRSig8V3tA9ft25vcJ5FsLrvFzb1FDz/NweHZPtLzbVGOLt2kaeREzswoX4RS X-Received: by 10.70.90.230 with SMTP id bz6mr61602696pdb.120.1437413101113; Mon, 20 Jul 2015 10:25:01 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id fv5sm22906763pdb.19.2015.07.20.10.25.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Jul 2015 10:25:00 -0700 (PDT) From: Stephen Hemminger To: changchun.ouyang@intel.com Date: Mon, 20 Jul 2015 10:25:05 -0700 Message-Id: <1437413106-16069-3-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1437413106-16069-1-git-send-email-stephen@networkplumber.org> References: <1437413106-16069-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH v2 2/3] virtio: allow nb_desc < vq_size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jul 2015 17:25:02 -0000 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 --- 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