env_dpdk: allow 2211.c file to build against older DPDK

The 2211 implementation only gets used when runtime
detects the DPDK version is DPDK 22.11. But we still
compile this file even if it gets built against an
older DPDK.

This is typically fine, except there are some interrupt
APIs that changed in DPDK 21.11, so older DPDKs don't
have some of the functions used in this file.  We need
to use ifdefs to allow this to compile.

We will need some more work to handle this case properly,
but this patch at least fixes the 2211.c case for now.
We will probably need a 2108.c file that exactly matches
the 2207.c file except for this interrupt API changes.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I6055694ccbb79845798e750ebb7127ec6c160e2e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15236
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michal.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
Jim Harris 2022-11-03 05:15:06 +00:00 committed by Tomasz Zawadzki
parent 74da5ee257
commit 8dc878483d

View File

@ -148,19 +148,34 @@ pci_driver_register_2211(struct spdk_pci_driver *driver,
static int static int
pci_device_enable_interrupt_2211(struct rte_pci_device *rte_dev) pci_device_enable_interrupt_2211(struct rte_pci_device *rte_dev)
{ {
#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
assert(false);
return -1;
#else
return rte_intr_enable(rte_dev->intr_handle); return rte_intr_enable(rte_dev->intr_handle);
#endif
} }
static int static int
pci_device_disable_interrupt_2211(struct rte_pci_device *rte_dev) pci_device_disable_interrupt_2211(struct rte_pci_device *rte_dev)
{ {
#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
assert(false);
return -1;
#else
return rte_intr_disable(rte_dev->intr_handle); return rte_intr_disable(rte_dev->intr_handle);
#endif
} }
static int static int
pci_device_get_interrupt_efd_2211(struct rte_pci_device *rte_dev) pci_device_get_interrupt_efd_2211(struct rte_pci_device *rte_dev)
{ {
#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
assert(false);
return -1;
#else
return rte_intr_fd_get(rte_dev->intr_handle); return rte_intr_fd_get(rte_dev->intr_handle);
#endif
} }
static int static int