From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shreyansh Jain Subject: [PATCH v10 04/25] eal/pci: replace PCI devinit/devuninit with probe/remove Date: Fri, 16 Sep 2016 09:59:39 +0530 Message-ID: <1474000200-16705-5-git-send-email-shreyansh.jain@nxp.com> References: <1466510566-9240-1-git-send-email-shreyansh.jain@nxp.com> <1474000200-16705-1-git-send-email-shreyansh.jain@nxp.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , David Marchand , , Thomas Monjalon , Shreyansh Jain To: Return-path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0048.outbound.protection.outlook.com [104.47.38.48]) by dpdk.org (Postfix) with ESMTP id C588258D6 for ; Fri, 16 Sep 2016 06:32:17 +0200 (CEST) In-Reply-To: <1474000200-16705-1-git-send-email-shreyansh.jain@nxp.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Probe and Remove are more appropriate names for PCI init and uninint operations. This is a cosmetic change. Only MLX* uses the PCI direct registeration, bypassing PMD_* macro. The calls backs for this too have been updated. VDEV are left out. For them, init/uninit are more appropriate. Suggested-by: David Marchand Signed-off-by: Shreyansh Jain --- app/test/test_pci.c | 8 ++++---- drivers/net/mlx4/mlx4.c | 4 ++-- drivers/net/mlx5/mlx5.c | 4 ++-- lib/librte_cryptodev/rte_cryptodev.c | 4 ++-- lib/librte_cryptodev/rte_cryptodev_pmd.h | 2 +- lib/librte_eal/common/eal_common_pci.c | 16 ++++++++-------- lib/librte_eal/common/include/rte_dev.h | 4 ++-- lib/librte_eal/common/include/rte_pci.h | 10 +++++----- lib/librte_ether/rte_ethdev.c | 8 ++++---- 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/app/test/test_pci.c b/app/test/test_pci.c index 69f78d9..f1b988a 100644 --- a/app/test/test_pci.c +++ b/app/test/test_pci.c @@ -52,11 +52,11 @@ * PCI test * ======== * - * - Register a driver with a ``devinit()`` function. + * - Register a driver with a ``probe()`` function. * * - Dump all PCI devices. * - * - Check that the ``devinit()`` function is called at least once. + * - Check that the ``probe()`` function is called at least once. */ int test_pci_run = 0; /* value checked by the multiprocess test */ @@ -79,14 +79,14 @@ struct rte_pci_id my_driver_id2[] = { struct rte_pci_driver my_driver = { .name = "test_driver", - .devinit = my_driver_init, + .probe = my_driver_init, .id_table = my_driver_id, .drv_flags = 0, }; struct rte_pci_driver my_driver2 = { .name = "test_driver2", - .devinit = my_driver_init, + .probe = my_driver_init, .id_table = my_driver_id2, .drv_flags = 0, }; diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 304c846..5c709ee 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -5544,7 +5544,7 @@ static struct eth_driver mlx4_driver; * 0 on success, negative errno value on failure. */ static int -mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) +mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) { struct ibv_device **list; struct ibv_device *ibv_dev; @@ -5913,7 +5913,7 @@ static struct eth_driver mlx4_driver = { .pci_drv = { .name = MLX4_DRIVER_NAME, .id_table = mlx4_pci_id_map, - .devinit = mlx4_pci_devinit, + .probe = mlx4_pci_probe, .drv_flags = RTE_PCI_DRV_INTR_LSC, }, .dev_private_size = sizeof(struct priv) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index d96a9af..7768231 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -355,7 +355,7 @@ static struct eth_driver mlx5_driver; * 0 on success, negative errno value on failure. */ static int -mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) +mlx5_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) { struct ibv_device **list; struct ibv_device *ibv_dev; @@ -730,7 +730,7 @@ static struct eth_driver mlx5_driver = { .pci_drv = { .name = MLX5_DRIVER_NAME, .id_table = mlx5_pci_id_map, - .devinit = mlx5_pci_devinit, + .probe = mlx5_pci_probe, .drv_flags = RTE_PCI_DRV_INTR_LSC, }, .dev_private_size = sizeof(struct priv) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index fc4123b..da5ad73 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -548,8 +548,8 @@ rte_cryptodev_pmd_driver_register(struct rte_cryptodev_driver *cryptodrv, * Register PCI driver for physical device intialisation during * PCI probing */ - cryptodrv->pci_drv.devinit = rte_cryptodev_init; - cryptodrv->pci_drv.devuninit = rte_cryptodev_uninit; + cryptodrv->pci_drv.probe = rte_cryptodev_init; + cryptodrv->pci_drv.remove = rte_cryptodev_uninit; rte_eal_pci_register(&cryptodrv->pci_drv); diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h index cd46674..130290e 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -505,7 +505,7 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev); * device, by invoking the rte_eal_pci_register() function to * register the *pci_drv* structure embedded in the *crypto_drv* * structure, after having stored the address of the - * rte_cryptodev_init() function in the *devinit* field of the + * rte_cryptodev_init() function in the *probe* field of the * *pci_drv* structure. * * During the PCI probing phase, the rte_cryptodev_init() diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 6a0f6ac..db8cba0 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -153,7 +153,7 @@ pci_unmap_resource(void *requested_addr, size_t size) } /* - * If vendor/device ID match, call the devinit() function of the + * If vendor/device ID match, call the probe() function of the * driver. */ static int @@ -212,15 +212,15 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d /* reference driver structure */ dev->driver = dr; - /* call the driver devinit() function */ - return dr->devinit(dr, dev); + /* call the driver probe() function */ + return dr->probe(dr, dev); } /* return positive value if driver doesn't support this device */ return 1; } /* - * If vendor/device ID match, call the devuninit() function of the + * If vendor/device ID match, call the remove() function of the * driver. */ static int @@ -257,7 +257,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr, RTE_LOG(DEBUG, EAL, " remove driver: %x:%x %s\n", dev->id.vendor_id, dev->id.device_id, dr->name); - if (dr->devuninit && (dr->devuninit(dev) < 0)) + if (dr->remove && (dr->remove(dev) < 0)) return -1; /* negative value is an error */ /* clear driver structure */ @@ -275,7 +275,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr, } /* - * If vendor/device ID match, call the devinit() function of all + * If vendor/device ID match, call the probe() function of all * registered driver for the given device. Return -1 if initialization * failed, return 1 if no driver is found for this device. */ @@ -302,7 +302,7 @@ pci_probe_all_drivers(struct rte_pci_device *dev) } /* - * If vendor/device ID match, call the devuninit() function of all + * If vendor/device ID match, call the remove() function of all * registered driver for the given device. Return -1 if initialization * failed, return 1 if no driver is found for this device. */ @@ -392,7 +392,7 @@ err_return: } /* - * Scan the content of the PCI bus, and call the devinit() function for + * Scan the content of the PCI bus, and call the probe() function for * all registered drivers that have a matching entry in its id_table * for discovered devices. */ diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index 95789f9..8233a2a 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -185,8 +185,8 @@ static const char DRIVER_EXPORT_NAME_ARRAY(this_pmd_name, idx) \ __attribute__((used)) = RTE_STR(name) #define PMD_REGISTER_DRIVER(drv, nm)\ -void devinitfn_ ##drv(void);\ -void __attribute__((constructor, used)) devinitfn_ ##drv(void)\ +void probefn_ ##drv(void);\ +void __attribute__((constructor, used)) probefn_ ##drv(void)\ {\ (drv).name = RTE_STR(nm);\ rte_eal_driver_register(&drv);\ diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index fa74962..803c78a 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -193,12 +193,12 @@ struct rte_pci_driver; /** * Initialisation function for the driver called during PCI probing. */ -typedef int (pci_devinit_t)(struct rte_pci_driver *, struct rte_pci_device *); +typedef int (pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *); /** * Uninitialisation function for the driver called during hotplugging. */ -typedef int (pci_devuninit_t)(struct rte_pci_device *); +typedef int (pci_remove_t)(struct rte_pci_device *); /** * A structure describing a PCI driver. @@ -206,8 +206,8 @@ typedef int (pci_devuninit_t)(struct rte_pci_device *); struct rte_pci_driver { TAILQ_ENTRY(rte_pci_driver) next; /**< Next in list. */ const char *name; /**< Driver name. */ - pci_devinit_t *devinit; /**< Device init. function. */ - pci_devuninit_t *devuninit; /**< Device uninit function. */ + pci_probe_t *probe; /**< Device Probe function. */ + pci_remove_t *remove; /**< Device Remove function. */ const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */ uint32_t drv_flags; /**< Flags contolling handling of device. */ }; @@ -442,7 +442,7 @@ int rte_eal_pci_probe_one(const struct rte_pci_addr *addr); * Close the single PCI device. * * Scan the content of the PCI bus, and find the pci device specified by pci - * address, then call the devuninit() function for registered driver that has a + * address, then call the remove() function for registered driver that has a * matching entry in its id_table for discovered device. * * @param addr diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index f62a9ec..d07348e 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -348,7 +348,7 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev) * Poll Mode Driver. * Invokes the rte_eal_pci_register() function to register the *pci_drv* * structure embedded in the *eth_drv* structure, after having stored the - * address of the rte_eth_dev_init() function in the *devinit* field of + * address of the rte_eth_dev_init() function in the *probe* field of * the *pci_drv* structure. * During the PCI probing phase, the rte_eth_dev_init() function is * invoked for each PCI [Ethernet device] matching the embedded PCI @@ -357,8 +357,8 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev) void rte_eth_driver_register(struct eth_driver *eth_drv) { - eth_drv->pci_drv.devinit = rte_eth_dev_init; - eth_drv->pci_drv.devuninit = rte_eth_dev_uninit; + eth_drv->pci_drv.probe = rte_eth_dev_init; + eth_drv->pci_drv.remove = rte_eth_dev_uninit; rte_eal_pci_register(ð_drv->pci_drv); } @@ -538,7 +538,7 @@ rte_eth_dev_detach_pdev(uint8_t port_id, struct rte_pci_addr *addr) if (rte_eal_compare_pci_addr(&vp, &freed_addr) == 0) goto err; - /* invoke devuninit func of the pci driver, + /* invoke remove func of the pci driver, * also remove the device from pci_device_list */ if (rte_eal_pci_detach(&freed_addr)) goto err; -- 2.7.4