From patchwork Wed Apr 25 02:18:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Wang X-Patchwork-Id: 38852 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C46942BCE; Wed, 25 Apr 2018 04:18:44 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D7B9E2B92 for ; Wed, 25 Apr 2018 04:18:42 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Apr 2018 19:18:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,325,1520924400"; d="scan'208";a="40275483" Received: from dpdk-xiao-1.sh.intel.com ([10.67.111.90]) by fmsmga002.fm.intel.com with ESMTP; 24 Apr 2018 19:18:40 -0700 From: Xiao Wang To: maxime.coquelin@redhat.com Cc: jianfeng.tan@intel.com, zhihong.wang@intel.com, dev@dpdk.org, Xiao Wang Date: Wed, 25 Apr 2018 10:18:27 +0800 Message-Id: <20180425021827.28240-1-xiao.w.wang@intel.com> X-Mailer: git-send-email 2.15.1 Subject: [dpdk-dev] [PATCH] vhost: fix vDPA set features 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" We should call set_features callback after setting features in virtio_net structure, otherwise vDPA driver cannot get the right features. Fixes: 07718b4f87aa ("vhost: adapt library for selective datapath") Signed-off-by: Xiao Wang Acked-by: Zhihong Wang Acked-by: Zhihong Wang --- lib/librte_vhost/vhost_user.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 90194bf09..7244e1c06 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -214,11 +214,6 @@ vhost_user_set_features(struct virtio_net *dev, uint64_t features) dev->notify_ops->features_changed(dev->vid, features); } - did = dev->vdpa_dev_id; - vdpa_dev = rte_vdpa_get_device(did); - if (vdpa_dev && vdpa_dev->ops->set_features) - vdpa_dev->ops->set_features(dev->vid); - dev->features = features; if (dev->features & ((1 << VIRTIO_NET_F_MRG_RXBUF) | (1ULL << VIRTIO_F_VERSION_1))) { @@ -252,6 +247,11 @@ vhost_user_set_features(struct virtio_net *dev, uint64_t features) } } + did = dev->vdpa_dev_id; + vdpa_dev = rte_vdpa_get_device(did); + if (vdpa_dev && vdpa_dev->ops->set_features) + vdpa_dev->ops->set_features(dev->vid); + return 0; }