env: add experimental APIs to handle PCI device interrupts

This change introduces initial experimental wrappers for enabling/
disabling rte_pci_device interrupts and for getting event file
descriptor assosiated with an interrupt.

Signed-off-by: Maciej Szulik <maciej.szulik@intel.com>
Change-Id: Iba1ba1e57a3555001502859d0bb2c655c07bf956
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10502
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Maciej Szulik 2021-12-01 08:38:07 -05:00 committed by Tomasz Zawadzki
parent e3eeb6bd9e
commit 8313dbf9a0
4 changed files with 67 additions and 0 deletions

View File

@ -44,6 +44,9 @@ they did not account for PCI devices being inserted or removed while the caller
returned from these APIs. Existing users of these APIs should switch to spdk_pci_for_each_device
instead.
Added 3 experimental APIs to handle PCI device interrupts (`spdk_pci_device_enable_interrupt`,
`spdk_pci_device_disable_interrupt`, `spdk_pci_device_get_interrupt_efd`).
### nvmf
Added a 'subsystem' parameter to spdk_nvmf_transport_stop_listen_async. When not NULL,

View File

@ -823,6 +823,34 @@ int spdk_pci_device_map_bar(struct spdk_pci_device *dev, uint32_t bar,
int spdk_pci_device_unmap_bar(struct spdk_pci_device *dev, uint32_t bar,
void *mapped_addr);
/**
* Enable PCI device interrupts. (Experimental)
*
* \param dev PCI device.
*
* \return 0 on success, negative value on error.
*/
int spdk_pci_device_enable_interrupt(struct spdk_pci_device *dev);
/**
* Disable PCI device interrupts. (Experimental)
*
* \param dev PCI device.
*
* \return 0 on success, negative value on error.
*/
int spdk_pci_device_disable_interrupt(struct spdk_pci_device *dev);
/**
* Get an event file descriptor assosiated with a PCI device interrupt.
* (Experimental)
*
* \param dev PCI device.
*
* \return Event file descriptor on success, negative value on error.
*/
int spdk_pci_device_get_interrupt_efd(struct spdk_pci_device *dev);
/**
* Get the domain of a PCI device.
*

View File

@ -787,6 +787,39 @@ spdk_pci_device_unmap_bar(struct spdk_pci_device *dev, uint32_t bar, void *addr)
return dev->unmap_bar(dev, bar, addr);
}
int
spdk_pci_device_enable_interrupt(struct spdk_pci_device *dev)
{
struct rte_pci_device *rte_dev = dev->dev_handle;
#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
return rte_intr_enable(&rte_dev->intr_handle);
#else
return rte_intr_enable(rte_dev->intr_handle);
#endif
}
int
spdk_pci_device_disable_interrupt(struct spdk_pci_device *dev)
{
struct rte_pci_device *rte_dev = dev->dev_handle;
#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
return rte_intr_disable(&rte_dev->intr_handle);
#else
return rte_intr_disable(rte_dev->intr_handle);
#endif
}
int
spdk_pci_device_get_interrupt_efd(struct spdk_pci_device *dev)
{
struct rte_pci_device *rte_dev = dev->dev_handle;
#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
return rte_dev->intr_handle.fd;
#else
return rte_intr_fd_get(rte_dev->intr_handle);
#endif
}
uint32_t
spdk_pci_device_get_domain(struct spdk_pci_device *dev)
{

View File

@ -62,6 +62,9 @@
spdk_pci_for_each_device;
spdk_pci_device_map_bar;
spdk_pci_device_unmap_bar;
spdk_pci_device_enable_interrupt;
spdk_pci_device_disable_interrupt;
spdk_pci_device_get_interrupt_efd;
spdk_pci_device_get_domain;
spdk_pci_device_get_bus;
spdk_pci_device_get_dev;