net/virtio-user: fix packed vq option parsing
[dpdk.git] / drivers / net / virtio / virtio_user_ethdev.c
index 3cf8bc1..2df6eb6 100644 (file)
@@ -28,7 +28,6 @@ static int
 virtio_user_server_reconnect(struct virtio_user_dev *dev)
 {
        int ret;
-       int flag;
        int connectfd;
        struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->port_id];
 
@@ -44,14 +43,13 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)
                return -1;
        }
 
+       dev->device_features |= dev->frontend_features;
+
        /* umask vhost-user unsupported features */
        dev->device_features &= ~(dev->unsupported_features);
 
        dev->features &= dev->device_features;
 
-       flag = fcntl(connectfd, F_GETFD);
-       fcntl(connectfd, F_SETFL, flag | O_NONBLOCK);
-
        ret = virtio_user_start_device(dev);
        if (ret < 0)
                return -1;
@@ -363,6 +361,8 @@ 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"
+       VIRTIO_USER_ARG_PACKED_VQ,
        NULL
 };
 
@@ -466,6 +466,7 @@ 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;
@@ -486,7 +487,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
                }
        } else {
                PMD_INIT_LOG(ERR, "arg %s is mandatory for virtio_user",
-                         VIRTIO_USER_ARG_QUEUE_SIZE);
+                            VIRTIO_USER_ARG_PATH);
                goto end;
        }
 
@@ -553,6 +554,15 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
                cq = 1;
        }
 
+       if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_PACKED_VQ) == 1) {
+               if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_PACKED_VQ,
+                                      &get_integer_arg, &packed_vq) < 0) {
+                       PMD_INIT_LOG(ERR, "error to parse %s",
+                                    VIRTIO_USER_ARG_PACKED_VQ);
+                       goto end;
+               }
+       }
+
        if (queues > 1 && cq == 0) {
                PMD_INIT_LOG(ERR, "multi-q requires ctrl-q");
                goto end;
@@ -600,7 +610,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
                        vu_dev->is_server = false;
                if (virtio_user_dev_init(hw->virtio_user_dev, path, queues, cq,
                                 queue_size, mac_addr, &ifname, mrg_rxbuf,
-                                in_order) < 0) {
+                                in_order, packed_vq) < 0) {
                        PMD_INIT_LOG(ERR, "virtio_user_dev_init fails");
                        virtio_user_eth_dev_free(eth_dev);
                        goto end;
@@ -679,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>");