From de85636da0d8cd2d08b80599f4398cd4113543a5 Mon Sep 17 00:00:00 2001 From: Hemant Agrawal Date: Tue, 11 Jul 2017 20:25:56 +0530 Subject: [PATCH] bus/fslmc: set the dpaa2 device name rte_eth_dev_allocated expect the device name to be filled. Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/fslmc_vfio.c | 5 +++-- drivers/bus/fslmc/rte_fslmc.h | 1 + drivers/net/dpaa2/dpaa2_ethdev.c | 6 +----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 725faabab3..edd9a73108 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -551,10 +551,11 @@ int fslmc_vfio_process_group(void) dev->dev_type = (strcmp(object_type, "dpseci")) ? DPAA2_MC_DPNI_DEVID : DPAA2_MC_DPSECI_DEVID; - FSLMC_VFIO_LOG(DEBUG, "DPAA2: Added [%s-%d]", - object_type, object_id); + sprintf(dev->name, "%s.%d", object_type, object_id); + dev->device.name = dev->name; fslmc_bus_add_device(dev); + FSLMC_VFIO_LOG(DEBUG, "DPAA2: Added %s", dev->name); } else { /* Parse all other objects */ struct rte_dpaa2_object *object; diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h index 4b69d38646..e60d6eba0b 100644 --- a/drivers/bus/fslmc/rte_fslmc.h +++ b/drivers/bus/fslmc/rte_fslmc.h @@ -78,6 +78,7 @@ struct rte_dpaa2_device { 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*/ }; typedef int (*rte_dpaa2_probe_t)(struct rte_dpaa2_driver *dpaa2_drv, diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index acedc7c598..9666d9d4c5 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -1531,13 +1531,9 @@ rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv, struct rte_dpaa2_device *dpaa2_dev) { struct rte_eth_dev *eth_dev; - char ethdev_name[RTE_ETH_NAME_MAX_LEN]; - int diag; - sprintf(ethdev_name, "dpni-%d", dpaa2_dev->object_id); - - eth_dev = rte_eth_dev_allocate(ethdev_name); + eth_dev = rte_eth_dev_allocate(dpaa2_dev->device.name); if (eth_dev == NULL) return -ENOMEM; -- 2.20.1