Packed ring vectorized rx function won't support GUEST_TSO4 and
GUSET_TSO6. Adding "lro" parameter into virtio user vdev arguments
can disable these features for vectorized path selection.

Signed-off-by: Marvin Liu <yong....@intel.com>

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c 
b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 1c6b26f8d..45d4bf14f 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -422,7 +422,8 @@ virtio_user_dev_setup(struct virtio_user_dev *dev)
 int
 virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
                     int cq, int queue_size, const char *mac, char **ifname,
-                    int server, int mrg_rxbuf, int in_order, int packed_vq)
+                    int server, int mrg_rxbuf, int in_order, int packed_vq,
+                    int lro)
 {
        pthread_mutex_init(&dev->mutex, NULL);
        strlcpy(dev->path, path, PATH_MAX);
@@ -478,6 +479,11 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char 
*path, int queues,
        if (!packed_vq)
                dev->unsupported_features |= (1ull << VIRTIO_F_RING_PACKED);
 
+       if (!lro) {
+               dev->unsupported_features |= (1ull << VIRTIO_NET_F_GUEST_TSO4);
+               dev->unsupported_features |= (1ull << VIRTIO_NET_F_GUEST_TSO6);
+       }
+
        if (dev->mac_specified)
                dev->frontend_features |= (1ull << VIRTIO_NET_F_MAC);
        else
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h 
b/drivers/net/virtio/virtio_user/virtio_user_dev.h
index 3b6b6065a..7133e4d26 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.h
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h
@@ -62,7 +62,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev);
 int virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
                         int cq, int queue_size, const char *mac, char **ifname,
                         int server, int mrg_rxbuf, int in_order,
-                        int packed_vq);
+                        int packed_vq, int lro);
 void virtio_user_dev_uninit(struct virtio_user_dev *dev);
 void virtio_user_handle_cq(struct virtio_user_dev *dev, uint16_t queue_idx);
 void virtio_user_handle_cq_packed(struct virtio_user_dev *dev,
diff --git a/drivers/net/virtio/virtio_user_ethdev.c 
b/drivers/net/virtio/virtio_user_ethdev.c
index e61af4068..ea07a8384 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -450,6 +450,8 @@ static const char *valid_args[] = {
        VIRTIO_USER_ARG_IN_ORDER,
 #define VIRTIO_USER_ARG_PACKED_VQ      "packed_vq"
        VIRTIO_USER_ARG_PACKED_VQ,
+#define VIRTIO_USER_ARG_LRO            "lro"
+       VIRTIO_USER_ARG_LRO,
        NULL
 };
 
@@ -552,6 +554,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
        uint64_t mrg_rxbuf = 1;
        uint64_t in_order = 1;
        uint64_t packed_vq = 0;
+       uint64_t lro = 1;
        char *path = NULL;
        char *ifname = NULL;
        char *mac_addr = NULL;
@@ -668,6 +671,15 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
                }
        }
 
+       if (rte_kvargs_count(kvlist, VIRTIO_USER_ARG_LRO) == 1) {
+               if (rte_kvargs_process(kvlist, VIRTIO_USER_ARG_LRO,
+                                      &get_integer_arg, &lro) < 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;
@@ -707,7 +719,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
        hw = eth_dev->data->dev_private;
        if (virtio_user_dev_init(hw->virtio_user_dev, path, queues, cq,
                         queue_size, mac_addr, &ifname, server_mode,
-                        mrg_rxbuf, in_order, packed_vq) < 0) {
+                        mrg_rxbuf, in_order, packed_vq, lro) < 0) {
                PMD_INIT_LOG(ERR, "virtio_user_dev_init fails");
                virtio_user_eth_dev_free(eth_dev);
                goto end;
@@ -777,4 +789,5 @@ RTE_PMD_REGISTER_PARAM_STRING(net_virtio_user,
        "server=<0|1> "
        "mrg_rxbuf=<0|1> "
        "in_order=<0|1> "
-       "packed_vq=<0|1>");
+       "packed_vq=<0|1>"
+       "lro=<0|1>");
-- 
2.17.1

Reply via email to