net/virtio: support vhost-user protocol features
[dpdk.git] / drivers / net / virtio / virtio_user_ethdev.c
index 798f191..e51425c 100644 (file)
@@ -68,6 +68,7 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)
        int connectfd;
        struct rte_eth_dev *eth_dev = &rte_eth_devices[dev->port_id];
        struct virtio_hw *hw = eth_dev->data->dev_private;
+       uint64_t protocol_features;
 
        connectfd = accept(dev->listenfd, NULL, NULL);
        if (connectfd < 0)
@@ -81,6 +82,25 @@ virtio_user_server_reconnect(struct virtio_user_dev *dev)
                return -1;
        }
 
+       if (dev->device_features &
+                       (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)) {
+               if (dev->ops->send_request(dev,
+                                       VHOST_USER_GET_PROTOCOL_FEATURES,
+                                       &protocol_features))
+                       return -1;
+
+               dev->protocol_features &= protocol_features;
+
+               if (dev->ops->send_request(dev,
+                                       VHOST_USER_SET_PROTOCOL_FEATURES,
+                                       &dev->protocol_features))
+                       return -1;
+
+               if (!(dev->protocol_features &
+                               (1ULL << VHOST_USER_PROTOCOL_F_MQ)))
+                       dev->unsupported_features |= (1ull << VIRTIO_NET_F_MQ);
+       }
+
        dev->device_features |= dev->frontend_features;
 
        /* umask vhost-user unsupported features */