summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTiwei Bie <tiwei.bie@intel.com>2018-10-29 13:28:06 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2018-11-05 15:01:25 +0100
commitbb97d2dd96c0425b0cd9a58749de252ddf675b47 (patch)
tree8c0abc0f86f8c5585b3e8c0d1fa31d04422b4185 /drivers
parent74dc6746a0f195907ec487df7de18a856108482f (diff)
downloaddpdk-bb97d2dd96c0425b0cd9a58749de252ddf675b47.zip
dpdk-bb97d2dd96c0425b0cd9a58749de252ddf675b47.tar.gz
dpdk-bb97d2dd96c0425b0cd9a58749de252ddf675b47.tar.xz
net/virtio-user: fix device features for server mode
We need to save the supported frontend features (which won't be announced by vhost backend), otherwise we will lost them when the connection to vhost-user backend is established in server mode. Fixes: 201a41651715 ("net/virtio-user: fix multiple queues fail in server mode") Cc: stable@dpdk.org Signed-off-by: Tiwei Bie <tiwei.bie@intel.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/virtio/virtio_user/virtio_user_dev.c8
-rw-r--r--drivers/net/virtio/virtio_user/virtio_user_dev.h1
-rw-r--r--drivers/net/virtio/virtio_user_ethdev.c2
3 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 0eb0f24..ff1c203 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -421,6 +421,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
dev->queue_pairs = 1; /* mq disabled by default */
dev->queue_size = queue_size;
dev->mac_specified = 0;
+ dev->frontend_features = 0;
dev->unsupported_features = 0;
parse_mac(dev, mac);
@@ -468,7 +469,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
}
if (dev->mac_specified) {
- dev->device_features |= (1ull << VIRTIO_NET_F_MAC);
+ dev->frontend_features |= (1ull << VIRTIO_NET_F_MAC);
} else {
dev->device_features &= ~(1ull << VIRTIO_NET_F_MAC);
dev->unsupported_features |= (1ull << VIRTIO_NET_F_MAC);
@@ -478,7 +479,7 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
/* device does not really need to know anything about CQ,
* so if necessary, we just claim to support CQ
*/
- dev->device_features |= (1ull << VIRTIO_NET_F_CTRL_VQ);
+ dev->frontend_features |= (1ull << VIRTIO_NET_F_CTRL_VQ);
} else {
dev->device_features &= ~(1ull << VIRTIO_NET_F_CTRL_VQ);
/* Also disable features depends on VIRTIO_NET_F_CTRL_VQ */
@@ -499,8 +500,9 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
/* The backend will not report this feature, we add it explicitly */
if (is_vhost_user_by_type(dev->path))
- dev->device_features |= (1ull << VIRTIO_NET_F_STATUS);
+ dev->frontend_features |= (1ull << VIRTIO_NET_F_STATUS);
+ dev->device_features |= dev->frontend_features;
dev->device_features &= VIRTIO_USER_SUPPORTED_FEATURES;
dev->unsupported_features |= ~VIRTIO_USER_SUPPORTED_FEATURES;
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h
index d6e0e13..c42ce5d 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.h
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h
@@ -33,6 +33,7 @@ struct virtio_user_dev {
* and will be sync with device
*/
uint64_t device_features; /* supported features by device */
+ uint64_t frontend_features; /* enabled frontend features */
uint64_t unsupported_features; /* unsupported features mask */
uint8_t status;
uint16_t port_id;
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index a31b9b4..61b7c0a 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -43,6 +43,8 @@ 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);