net/virtio-user: fix packed vq option parsing
authorTiwei Bie <tiwei.bie@intel.com>
Thu, 3 Jan 2019 02:40:06 +0000 (10:40 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 14 Jan 2019 16:44:29 +0000 (17:44 +0100)
Add the RING_PACKED feature to dev->unsupported_features
when it's disabled, and add the missing packed vq param
string. And also revert the unexpected change to MAC option
introduced when adding packed vq option.

Fixes: 34f3966c7f81 ("net/virtio-user: add option to use packed queues")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_user/virtio_user_dev.c
drivers/net/virtio/virtio_user_ethdev.c

index 5560bd9..e21e3ec 100644 (file)
@@ -474,17 +474,14 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
                                          "packed virtqueues\n");
                        return -1;
                }
-               dev->device_features |= (1ull << VIRTIO_F_RING_PACKED);
        } else {
-               dev->device_features &= ~(1ull << VIRTIO_F_RING_PACKED);
+               dev->unsupported_features |= (1ull << VIRTIO_F_RING_PACKED);
        }
 
-       if (dev->mac_specified) {
-               dev->device_features |= (1ull << VIRTIO_NET_F_MAC);
-       } else {
-               dev->device_features &= ~(1ull << VIRTIO_NET_F_MAC);
+       if (dev->mac_specified)
+               dev->frontend_features |= (1ull << VIRTIO_NET_F_MAC);
+       else
                dev->unsupported_features |= (1ull << VIRTIO_NET_F_MAC);
-       }
 
        if (cq) {
                /* device does not really need to know anything about CQ,
index af28006..2df6eb6 100644 (file)
@@ -361,7 +361,7 @@ static const char *valid_args[] = {
        VIRTIO_USER_ARG_MRG_RXBUF,
 #define VIRTIO_USER_ARG_IN_ORDER       "in_order"
        VIRTIO_USER_ARG_IN_ORDER,
-#define VIRTIO_USER_ARG_PACKED_VQ "packed_vq"
+#define VIRTIO_USER_ARG_PACKED_VQ      "packed_vq"
        VIRTIO_USER_ARG_PACKED_VQ,
        NULL
 };
@@ -466,11 +466,11 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
        uint64_t server_mode = VIRTIO_USER_DEF_SERVER_MODE;
        uint64_t mrg_rxbuf = 1;
        uint64_t in_order = 1;
+       uint64_t packed_vq = 0;
        char *path = NULL;
        char *ifname = NULL;
        char *mac_addr = NULL;
        int ret = -1;
-       uint64_t packed_vq = 0;
 
        kvlist = rte_kvargs_parse(rte_vdev_device_args(dev), valid_args);
        if (!kvlist) {
@@ -689,4 +689,5 @@ RTE_PMD_REGISTER_PARAM_STRING(net_virtio_user,
        "iface=<string> "
        "server=<0|1> "
        "mrg_rxbuf=<0|1> "
-       "in_order=<0|1>");
+       "in_order=<0|1> "
+       "packed_vq=<0|1>");