DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/virtio-user: fix feature setting with vhost-net backend
@ 2018-05-07  6:50 Jiayu Hu
  2018-05-08  2:49 ` Tiwei Bie
  2018-05-08  8:14 ` [dpdk-dev] [PATCH v2] " Jiayu Hu
  0 siblings, 2 replies; 11+ messages in thread
From: Jiayu Hu @ 2018-05-07  6:50 UTC (permalink / raw)
  To: dev; +Cc: zhiyong.yang, maxime.coquelin, Jiayu Hu

Currently, when the backend is vhost-net, which implies
virtio-user works in client mode, virtio-user is assigned
to the default feature VIRTIO_USER_SUPPORTED_FEATURES.
However, virtio-user should request features from the
backend in this case.

Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
---
 drivers/net/virtio/virtio_user/virtio_user_dev.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c
index 38b8bc9..f745163 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
@@ -353,20 +353,22 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 		return -1;
 	}
 
-	if (dev->vhostfd >= 0) {
+	if (!dev->is_server) {
 		if (dev->ops->send_request(dev, VHOST_USER_SET_OWNER,
-					   NULL) < 0) {
+					NULL) < 0) {
 			PMD_INIT_LOG(ERR, "set_owner fails: %s",
-				     strerror(errno));
+					strerror(errno));
 			return -1;
 		}
 
 		if (dev->ops->send_request(dev, VHOST_USER_GET_FEATURES,
-					   &dev->device_features) < 0) {
+					&dev->device_features) < 0) {
 			PMD_INIT_LOG(ERR, "get_features failed: %s",
-				     strerror(errno));
+					strerror(errno));
 			return -1;
 		}
+		if (dev->mac_specified)
+			dev->device_features |= (1ull << VIRTIO_NET_F_MAC);
 	} else {
 		/* We just pretend vhost-user can support all these features.
 		 * Note that this could be problematic that if some feature is
@@ -376,9 +378,6 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 		dev->device_features = VIRTIO_USER_SUPPORTED_FEATURES;
 	}
 
-	if (dev->mac_specified)
-		dev->device_features |= (1ull << VIRTIO_NET_F_MAC);
-
 	if (cq) {
 		/* device does not really need to know anything about CQ,
 		 * so if necessary, we just claim to support CQ
-- 
2.7.4

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-05-16  6:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-07  6:50 [dpdk-dev] [PATCH] net/virtio-user: fix feature setting with vhost-net backend Jiayu Hu
2018-05-08  2:49 ` Tiwei Bie
2018-05-08  7:44   ` Jiayu Hu
2018-05-10  5:04     ` Tiwei Bie
2018-05-10  8:33       ` Hu, Jiayu
2018-05-08  8:14 ` [dpdk-dev] [PATCH v2] " Jiayu Hu
2018-05-09  2:58   ` Yao, Lei A
2018-05-11  7:26   ` [dpdk-dev] [PATCH v3] " Jiayu Hu
2018-05-11  7:33     ` Tiwei Bie
2018-05-11  7:45       ` Yang, Zhiyong
2018-05-16  6:05     ` Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).