vhost: do not limit packed ring size
authorMarvin Liu <yong.liu@intel.com>
Wed, 30 Oct 2019 09:24:21 +0000 (17:24 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Nov 2019 22:15:05 +0000 (23:15 +0100)
Virtio spec only set rule that packed ring maximum size is up to 2^15
entries. Should not limit packed ring size to power of two.

Fixes: 708e14d8b9ac ("vhost: advertize packed ring layout support")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/vhost_user.c

index 2a9fa7c..3f649c8 100644 (file)
@@ -363,8 +363,20 @@ 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;