From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2B320A04A5;
	Thu, 18 Jun 2020 17:13:35 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 1298A1BF88;
	Thu, 18 Jun 2020 17:13:34 +0200 (CEST)
Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net
 [217.70.183.196]) by dpdk.org (Postfix) with ESMTP id 9EE101BF86
 for <dev@dpdk.org>; Thu, 18 Jun 2020 17:13:32 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 757B8E0005;
 Thu, 18 Jun 2020 15:13:31 +0000 (UTC)
Date: Thu, 18 Jun 2020 17:13:24 +0200
From: =?utf-8?Q?Ga=C3=ABtan?= Rivet <grive@u256.net>
To: Parav Pandit <parav@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
 "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
 Thomas Monjalon <thomasm@mellanox.com>,
 Ori Kam <orika@mellanox.com>, Matan Azrad <matan@mellanox.com>
Message-ID: <20200618151324.fdujp5icwi4qfowq@u256.net>
References: <20200610171728.89-1-parav@mellanox.com>
 <20200610171728.89-7-parav@mellanox.com>
 <20200615215618.qgk3jffuf3ta45as@u256.net>
 <AM0PR05MB4866B22741CA669E3CECC547D19B0@AM0PR05MB4866.eurprd05.prod.outlook.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <AM0PR05MB4866B22741CA669E3CECC547D19B0@AM0PR05MB4866.eurprd05.prod.outlook.com>
Subject: Re: [dpdk-dev] [RFC PATCH 6/6] bus/mlx5_pci: enable net and vDPA to
 use mlx5 PCI bus driver
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On 18/06/20 10:06 +0000, Parav Pandit wrote:
> 
> 
> > From: Gaëtan Rivet <grive@u256.net>
> > Sent: Tuesday, June 16, 2020 3:26 AM
> > 
> > On 10/06/20 17:17 +0000, Parav Pandit wrote:
> > > Enable class driver to match with the mlx5 pci devices.
> > > Migrate mlx5 net PMD and vdpa PMD to start using mlx5 common class
> > > driver.
> > >
> > > Signed-off-by: Parav Pandit <parav@mellanox.com>
> > > ---
> > >  drivers/bus/Makefile                |  3 ++
> > >  drivers/bus/mlx5_pci/mlx5_pci_bus.c | 60
> > +++++++++++++++++++++++++++++
> > >  drivers/net/mlx5/Makefile           |  3 +-
> > >  drivers/net/mlx5/linux/mlx5_os.c    |  1 -
> > >  drivers/net/mlx5/linux/mlx5_os.h    |  3 --
> > >  drivers/net/mlx5/meson.build        |  2 +-
> > >  drivers/net/mlx5/mlx5.c             |  7 ++--
> > >  drivers/net/mlx5/mlx5.h             |  1 -
> > >  drivers/vdpa/mlx5/Makefile          |  3 +-
> > >  drivers/vdpa/mlx5/meson.build       |  2 +-
> > >  drivers/vdpa/mlx5/mlx5_vdpa.c       | 10 ++---
> > >  mk/rte.app.mk                       |  1 +
> > >  12 files changed, 79 insertions(+), 17 deletions(-)
> > >
> > 

[...]

> > > -struct rte_pci_driver mlx5_driver = {
> > > +static struct rte_mlx5_pci_driver mlx5_driver = {
> > >  	.driver = {
> > >  		.name = MLX5_DRIVER_NAME
> > >  	},
> > > +	.dev_class = MLX5_CLASS_NET,
> > >  	.id_table = mlx5_pci_id_map,
> > >  	.probe = mlx5_os_pci_probe,
> > >  	.remove = mlx5_pci_remove,
> > >  	.dma_map = mlx5_dma_map,
> > >  	.dma_unmap = mlx5_dma_unmap,
> > > -	.drv_flags = PCI_DRV_FLAGS,
> > 
> > You mask the drv_flags, do you plan on merging those flags in the demuxing
> > drivers above? It seems LSC | RMV | PROBE_AGAIN is not used afterward,
> > seems missing.
> > 
> > Using an rte_pci_driver instead of an rte_driver as core object for you driver
> > would allow managing this by the way.
> Yes. but how would mlx5_pci bus will process the drv_flags passed by the class drivers such a vdpa/net?
> 

LSC and RMV are used within rte_eth_copy_pci_info(), which is called by
each individual netdevice PCI probe callback, after creating an ethdev.

PROBE_AGAIN is used by the PCI bus to determine whether to throw -EEXIST
when attempting to probe again a device.

They will all access it through the demux PCI device -> PCI driver,
which will be in that case your demux driver. It needs to have a correct
value that will not mask underlying device capability or behavior.

Binary-AND between classes is bare-minimum, and would probably not work
for LSC. Some finer-grained control could be used to work well with
other layers.

-- 
Gaëtan