From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0AD6CA2EDB for ; Fri, 6 Sep 2019 05:33:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 742B21F0E2; Fri, 6 Sep 2019 05:33:37 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 284841F0D9 for ; Fri, 6 Sep 2019 05:33:34 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2019 20:33:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,472,1559545200"; d="scan'208";a="383123553" Received: from dpdk-dipei.sh.intel.com ([10.67.110.224]) by fmsmga005.fm.intel.com with ESMTP; 05 Sep 2019 20:33:33 -0700 From: Andy Pei To: dev@dpdk.org Cc: rosen.xu@intel.com, xiaolong.ye@intel.com, tiwei.bie@intel.com, xiao.w.wang@intel.com Date: Fri, 6 Sep 2019 11:20:50 +0800 Message-Id: <1567740051-367172-3-git-send-email-andy.pei@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1567740051-367172-1-git-send-email-andy.pei@intel.com> References: <1567740051-367172-1-git-send-email-andy.pei@intel.com> Subject: [dpdk-dev] [PATCH 3/4] vhost: call vDPA callback at the end of vring enable handler 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" vDPA's set_vring_state callback would need to know the virtqueues' enable status to configure the hardware. Signed-off-by: Xiaolong Ye Signed-off-by: Andy Pei --- lib/librte_vhost/rte_vdpa.h | 4 ++-- lib/librte_vhost/vhost_user.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/librte_vhost/rte_vdpa.h b/lib/librte_vhost/rte_vdpa.h index 9a3deb3..19cf897 100644 --- a/lib/librte_vhost/rte_vdpa.h +++ b/lib/librte_vhost/rte_vdpa.h @@ -54,8 +54,8 @@ struct rte_vdpa_dev_ops { int (*dev_conf)(int vid); int (*dev_close)(int vid); - /** Enable/disable this vring */ - int (*set_vring_state)(int vid, int vring, int state); + /** Enable/disable vring queue pairs */ + int (*set_vring_state)(int vid); /** Set features when changed */ int (*set_features)(int vid); diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 0b72648..21028cc 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -1346,8 +1346,6 @@ static int vhost_user_set_vring_err(struct virtio_net **pdev __rte_unused, did = dev->vdpa_dev_id; vdpa_dev = rte_vdpa_get_device(did); - if (vdpa_dev && vdpa_dev->ops->set_vring_state) - vdpa_dev->ops->set_vring_state(dev->vid, index, enable); if (dev->notify_ops->vring_state_changed) dev->notify_ops->vring_state_changed(dev->vid, @@ -1359,6 +1357,9 @@ static int vhost_user_set_vring_err(struct virtio_net **pdev __rte_unused, dev->virtqueue[index]->enabled = enable; + if (vdpa_dev && vdpa_dev->ops->set_vring_state) + vdpa_dev->ops->set_vring_state(dev->vid); + return RTE_VHOST_MSG_RESULT_OK; } -- 1.8.3.1