pci: replace devinit/devuninit with probe/remove
Probe and Remove are more appropriate names for PCI init and uninint operations. This is a cosmetic change. Only MLX* uses the PCI direct registration, bypassing PMD_* macro. The callbacks for this too have been updated. VDEV are left out. For them, init/uninit are more appropriate. Suggested-by: David Marchand <david.marchand@6wind.com> Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com> Acked-by: David Marchand <david.marchand@6wind.com>
This commit is contained in:
parent
3c1405b2f1
commit
af424af840
@ -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,
|
||||
};
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -547,8 +547,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);
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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 @@ rte_eal_pci_detach(const struct rte_pci_addr *addr)
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
@ -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);\
|
||||
|
@ -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
|
||||
|
@ -347,7 +347,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
|
||||
@ -356,8 +356,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);
|
||||
}
|
||||
|
||||
@ -537,7 +537,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;
|
||||
|
Loading…
Reference in New Issue
Block a user