[dpdk-dev] [PATCH] eal: move DMA mapping from bus-specific to generic driver

Thomas Monjalon thomas at monjalon.net
Thu Apr 1 00:53:30 CEST 2021


01/04/2021 00:45, Thomas Monjalon:
> The operations of DMA mapping and unmapping are controlled in some
> bus drivers, following rte_bus specification.
> If the device driver don't provide any specific mapping operation,
> the bus driver may have a fallback (VFIO case for PCI).
> 
> The DMA mapping done by the device drivers are called
> from the bus drivers via function pointers in bus-specific structures:
> rte_vdev_driver and rte_pci_driver.
> 
> The device driver DMA mapping is not specific to the bus,
> so it can be generalized to all device drivers, based on rte_device.
> That's why the function pointers dma_map and dma_unmap
> are moved to rte_driver, avoiding useless casts of device object.
> 
> The function prototypes rte_dev_dma_map_t and rte_dev_dma_unmap_t
> are removed from rte_bus.h because the definition in rte_dev.h is enough,
> but they are still used in rte_bus for bus drivers,
> while being added in rte_driver for device drivers,
> and removed from rte_vdev_driver/rte_pci_driver.
> 
> The impacted device drivers are mlx5 (PCI) and virtio_user (vdev).
> 
> Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
> ---
> Depends-on: series-16017 ("pci: add rte prefix")
> ---
>  drivers/bus/pci/pci_common.c            |  8 ++--
>  drivers/bus/pci/rte_bus_pci.h           | 40 --------------------
>  drivers/bus/vdev/rte_bus_vdev.h         | 40 --------------------
>  drivers/bus/vdev/vdev.c                 | 32 +++++-----------
>  drivers/common/mlx5/mlx5_common_pci.c   | 30 ++++++++-------
>  drivers/net/mlx5/mlx5.c                 |  4 +-
>  drivers/net/mlx5/mlx5_mr.c              | 50 +++++++++++++------------
>  drivers/net/mlx5/mlx5_rxtx.h            |  4 +-
>  drivers/net/virtio/virtio_user_ethdev.c | 22 +++++------
>  lib/librte_eal/include/rte_bus.h        | 42 ---------------------
>  lib/librte_eal/include/rte_dev.h        | 49 +++++++++++++++++++++++-
>  11 files changed, 117 insertions(+), 204 deletions(-)

The ABI checker reports some issues on the driver interface.
It needs to be carefully analyzed, because driver interface
should not be part of the ABI compatibility contract.





More information about the dev mailing list