From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 3A9475F38 for ; Tue, 8 May 2018 10:07:41 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2018 01:07:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,377,1520924400"; d="scan'208";a="226729615" Received: from dpdk15.sh.intel.com ([10.67.111.77]) by fmsmga006.fm.intel.com with ESMTP; 08 May 2018 01:07:37 -0700 From: Jiayu Hu To: dev@dpdk.org Cc: tiwei.bie@intel.com, zhiyong.yang@intel.com, maxime.coquelin@redhat.com, lei.a.yao@intel.com, Jiayu Hu Date: Tue, 8 May 2018 16:14:44 +0800 Message-Id: <1525767284-130484-1-git-send-email-jiayu.hu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525675806-22387-1-git-send-email-jiayu.hu@intel.com> References: <1525675806-22387-1-git-send-email-jiayu.hu@intel.com> Subject: [dpdk-dev] [PATCH v2] net/virtio-user: fix feature setting with vhost-net backend X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2018 08:07:41 -0000 When the backend is vhost-net, virtio-user must work in client mode and needs to request features from the backend in virtio_user_dev_init(). But currently, virtio-user is assigned to default features in this case. This patch is to fix this inappropriate feature setting. Fixes: bd8f50a45d0f ("net/virtio-user: support server mode") Signed-off-by: Jiayu Hu --- changes in v2: - remove unnecessary indent change. - change commit log. drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 +++---- 1 file changed, 3 insertions(+), 4 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..2d80188 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -353,7 +353,7 @@ 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) { PMD_INIT_LOG(ERR, "set_owner fails: %s", @@ -367,6 +367,8 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues, 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