On Mon, Jul 20, 2020 at 9:30 PM Ori Kam <or...@mellanox.com> wrote: > > net and vdpa code expect the common code being initialised. > > It is a dependency internal to mlx5 drivers, I see nothing generic. > > > First the idea was to declare a new bus not a PMD. > The issue is not from common code but from loading more than one > device on the same PCI. > So the logic is Mellanox PMD are registering to the new bus, the new bus > register to the PCI one.
- Is there a problem with the snippet I sent yesterday that removes the COMMON priority? - Currently in the main branch, the net/mlx5 driver is a pci driver registered to the pci bus driver. This registration happens in a constructor which puts the net/mlx5 pci driver struct (with a populated id map) into the pci driver list. Later (out of constructor context), a probe on the pci bus uses this driver list. A new pci driver is introduced by Mellanox to solve resources dispatching between mlx5 drivers. I'd rather not call this new pci driver a bus, it is not registered as such (no rte_bus object) => no reason its constructor should be called from the RTE_PRIO_BUS priority. This driver not being a bus, I would not put it in drivers/bus/, rather in the common code. If there is a build dependency issue with the pci bus driver, you can probably use the trick from qat (https://git.dpdk.org/dpdk/tree/drivers/Makefile#n17) and write an explicit dependency in drivers/Makefile. meson should be just fine. net/mlx5 and vdpa/mlx5 are not classes => no reason their constructor should be called from the RTE_PRIO_CLASS priority. The only classes we have are ethdev and vdpa. The new pci driver simply serves as a proxy for mlx5 net and vdpa drivers. >From what I see, the new pci driver constructs its pci device id map/drv_flags when registering to the pci bus driver based on what mlx5 net and vdpa drivers registered before. This is where a dependency was created. You can move the id_table/drv_flags construction from RTE_INIT(mlx5_bus_pci) to rte_mlx5_pci_register() itself. This way, net/mlx5 and vdpa/mlx5 will pass their id_map to the mlx5 pci driver whether it is registered to the pci bus or not yet. -- David Marchand