From bd8e994ef30703a0240ada56521232ccf50989e5 Mon Sep 17 00:00:00 2001 From: Shreyansh Jain Date: Fri, 25 Aug 2017 15:49:50 +0530 Subject: [PATCH] bus/fslmc: introduce new device type enumerator Existing devices and drivers depended on device ID rather than type. A new enumerator for all DPAA2 devices is introduced in this patch. At this point, the probe would not be able to link DPAA2 devices with the driver and I/O would not work. Subsequent patches will fix this. Signed-off-by: Shreyansh Jain Reviewed-by: Santosh Shukla Reviewed-by: Ferruh Yigit --- drivers/bus/fslmc/fslmc_vfio.c | 6 +++--- drivers/bus/fslmc/rte_bus_fslmc_version.map | 7 ++++++ drivers/bus/fslmc/rte_fslmc.h | 24 +++++++++++++++++---- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 3423b57f5b..3b452e192b 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -288,8 +288,8 @@ dpaa2_compare_dpaa2_dev(const struct rte_dpaa2_device *dev, const struct rte_dpaa2_device *dev2) { /*not the same family device */ - if (dev->dev_type != DPAA2_MC_DPNI_DEVID || - dev->dev_type != DPAA2_MC_DPSECI_DEVID) + if (dev->dev_type != DPAA2_ETH || + dev->dev_type != DPAA2_CRYPTO) return -1; if (dev->object_id == dev2->object_id) @@ -506,7 +506,7 @@ int fslmc_vfio_process_group(void) /* store hw_id of dpni/dpseci device */ dev->object_id = object_id; dev->dev_type = (strcmp(object_type, "dpseci")) ? - DPAA2_MC_DPNI_DEVID : DPAA2_MC_DPSECI_DEVID; + DPAA2_ETH : DPAA2_CRYPTO; sprintf(dev->name, "%s.%d", object_type, object_id); dev->device.name = dev->name; diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index 3cdf14ef74..6ac256d843 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -77,3 +77,10 @@ DPDK_17.08 { rte_global_active_dqs_list; } DPDK_17.05; + +DPDK_17.11 { + global: + + rte_dpaa2_dev_type; + +} DPDK_17.08; diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h index e60d6eba0b..ff7a49ef95 100644 --- a/drivers/bus/fslmc/rte_fslmc.h +++ b/drivers/bus/fslmc/rte_fslmc.h @@ -56,6 +56,8 @@ extern "C" { #include #include +#define FSLMC_OBJECT_MAX_LEN 32 /**< Length of each device on bus */ + struct rte_dpaa2_driver; /* DPAA2 Device and Driver lists for FSLMC bus */ @@ -64,6 +66,20 @@ TAILQ_HEAD(rte_fslmc_driver_list, rte_dpaa2_driver); extern struct rte_fslmc_bus rte_fslmc_bus; +enum rte_dpaa2_dev_type { + /* Devices backed by DPDK driver */ + DPAA2_ETH, /**< DPNI type device*/ + DPAA2_CRYPTO, /**< DPSECI type device */ + DPAA2_CON, /**< DPCONC type device */ + /* Devices not backed by a DPDK driver: DPIO, DPBP, DPCI, DPMCP */ + DPAA2_BPOOL, /**< DPBP type device */ + DPAA2_IO, /**< DPIO type device */ + DPAA2_CI, /**< DPCI type device */ + DPAA2_MPORTAL, /**< DPMCP type device */ + /* Unknown device placeholder */ + DPAA2_UNKNOWN +}; + /** * A structure describing a DPAA2 device. */ @@ -74,11 +90,11 @@ struct rte_dpaa2_device { struct rte_eth_dev *eth_dev; /**< ethernet device */ struct rte_cryptodev *cryptodev; /**< Crypto Device */ }; - uint16_t dev_type; /**< Device Type */ - uint16_t object_id; /**< DPAA2 Object ID */ + enum rte_dpaa2_dev_type dev_type; /**< Device Type */ + uint16_t object_id; /**< DPAA2 Object ID */ struct rte_intr_handle intr_handle; /**< Interrupt handle */ struct rte_dpaa2_driver *driver; /**< Associated driver */ - char name[32]; /**< DPAA2 Object name*/ + char name[FSLMC_OBJECT_MAX_LEN]; /**< DPAA2 Object name*/ }; typedef int (*rte_dpaa2_probe_t)(struct rte_dpaa2_driver *dpaa2_drv, @@ -93,7 +109,7 @@ struct rte_dpaa2_driver { struct rte_driver driver; /**< Inherit core driver. */ struct rte_fslmc_bus *fslmc_bus; /**< FSLMC bus reference */ uint32_t drv_flags; /**< Flags for controlling device.*/ - uint16_t drv_type; /**< Driver Type */ + enum rte_dpaa2_dev_type drv_type; /**< Driver Type */ rte_dpaa2_probe_t probe; rte_dpaa2_remove_t remove; }; -- 2.20.1