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 C3AE3A00BE; Fri, 12 Jun 2020 14:46:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7BE392C16; Fri, 12 Jun 2020 14:46:50 +0200 (CEST) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by dpdk.org (Postfix) with ESMTP id 738422BFA for ; Fri, 12 Jun 2020 14:46:48 +0200 (CEST) X-Originating-IP: 86.246.31.132 Received: from u256.net (lfbn-idf2-1-566-132.w86-246.abo.wanadoo.fr [86.246.31.132]) (Authenticated sender: grive@u256.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id E954760006; Fri, 12 Jun 2020 12:46:44 +0000 (UTC) Date: Fri, 12 Jun 2020 14:46:37 +0200 From: =?utf-8?Q?Ga=C3=ABtan?= Rivet To: Maxime Coquelin Cc: dev@dpdk.org, matan@mellanox.com, xiao.w.wang@intel.com, zhihong.wang@intel.com, xiaolong.ye@intel.com, chenbo.xia@intel.com, david.marchand@redhat.com, amorenoz@redhat.com, shreyansh.jain@nxp.com, viacheslavo@mellanox.com, hemant.agrawal@nxp.com, sachin.saxena@nxp.com Message-ID: <20200612124637.44dw3lpocd6uxv2z@u256.net> References: <20200611213748.1967029-1-maxime.coquelin@redhat.com> <20200611213748.1967029-5-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200611213748.1967029-5-maxime.coquelin@redhat.com> Subject: Re: [dpdk-dev] [PATCH 04/14] vhost: make vDPA framework bus agnostic 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" On 11/06/20 23:37 +0200, Maxime Coquelin wrote: > This patch makes the vDPA framework to no more > support only PCI devices, but any devices by relying > on the generic device name as identifier. > > Signed-off-by: Maxime Coquelin > --- > drivers/vdpa/ifc/ifcvf_vdpa.c | 6 +- > drivers/vdpa/mlx5/mlx5_vdpa.c | 8 +-- > drivers/vdpa/mlx5/mlx5_vdpa.h | 2 +- > examples/vdpa/main.c | 49 ++++++++-------- > lib/librte_vhost/rte_vdpa.h | 42 +++++++------- > lib/librte_vhost/rte_vhost_version.map | 1 + > lib/librte_vhost/vdpa.c | 79 +++++++++++--------------- > 7 files changed, 85 insertions(+), 102 deletions(-) > [...] > diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c > index 1113d6cef0..e8255c7d7e 100644 > --- a/drivers/vdpa/mlx5/mlx5_vdpa.c > +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c > @@ -501,14 +501,13 @@ mlx5_vdpa_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > priv->caps = attr.vdpa; > priv->log_max_rqt_size = attr.log_max_rqt_size; > priv->ctx = ctx; > - priv->dev_addr.pci_addr = pci_dev->addr; > - priv->dev_addr.type = VDPA_ADDR_PCI; > + priv->pci_dev = pci_dev; > priv->var = mlx5_glue->dv_alloc_var(ctx, 0); > if (!priv->var) { > DRV_LOG(ERR, "Failed to allocate VAR %u.\n", errno); > goto error; > } > - priv->id = rte_vdpa_register_device(&priv->dev_addr, &mlx5_vdpa_ops); > + priv->id = rte_vdpa_register_device(&pci_dev->device, &mlx5_vdpa_ops); > if (priv->id < 0) { > DRV_LOG(ERR, "Failed to register vDPA device."); > rte_errno = rte_errno ? rte_errno : EINVAL; > @@ -550,8 +549,7 @@ mlx5_vdpa_pci_remove(struct rte_pci_device *pci_dev) > > pthread_mutex_lock(&priv_list_lock); > TAILQ_FOREACH(priv, &priv_list, next) { > - if (memcmp(&priv->dev_addr.pci_addr, &pci_dev->addr, > - sizeof(pci_dev->addr)) == 0) { > + if (priv->pci_dev == pci_dev) { Assignment is ok I think but comparison is not, rte_pci_addr_cmp() should be used here instead. (memcmp was not correct either.) The structure can be padded depending on arch. Everything else seems ok to me. -- Gaëtan