From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 31C78A00B8; Mon, 28 Oct 2019 07:38:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 26D6B1BF14; Mon, 28 Oct 2019 07:38:50 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 89DFE1BEF7 for ; Mon, 28 Oct 2019 07:38:44 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Oct 2019 23:38:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,239,1569308400"; d="scan'208";a="282856811" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142]) by orsmga001.jf.intel.com with ESMTP; 27 Oct 2019 23:38:41 -0700 From: Marvin Liu To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org, Marvin Liu Date: Mon, 28 Oct 2019 22:18:11 +0800 Message-Id: <20191028141811.73444-2-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191028141811.73444-1-yong.liu@intel.com> References: <20191028141811.73444-1-yong.liu@intel.com> Subject: [dpdk-dev] [PATCH 2/2] vhost: do not limit packed ring size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Virtio spec only set rule that packed ring maximum size is up to 2^15 entries. Do not limit packed ring size to power of two. Signed-off-by: Marvin Liu --- lib/librte_vhost/vhost_user.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 87dc3fc53..bbf323373 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -363,8 +363,21 @@ vhost_user_set_vring_num(struct virtio_net **pdev, * * Queue Size value is always a power of 2. The maximum Queue Size * value is 32768. + * + * VIRTIO 1.1 2.7 Virtqueues says: + * + * Packed virtqueues support up to 2^15 entries each. */ - if ((vq->size & (vq->size - 1)) || vq->size > 32768) { + if (!vq_is_packed(dev)) { + if (vq->size & (vq->size - 1)) { + RTE_LOG(ERR, VHOST_CONFIG, + "invalid virtqueue size %u\n", vq->size); + return RTE_VHOST_MSG_RESULT_ERR; + } + + } + + if (vq->size > 32768) { RTE_LOG(ERR, VHOST_CONFIG, "invalid virtqueue size %u\n", vq->size); return RTE_VHOST_MSG_RESULT_ERR; -- 2.17.1