From 8dc878483de6895a8ace18aa19ffc37d9fe8bbec Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 3 Nov 2022 05:15:06 +0000 Subject: [PATCH] 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 Change-Id: I6055694ccbb79845798e750ebb7127ec6c160e2e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15236 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Michal Berger Reviewed-by: Tomasz Zawadzki Reviewed-by: Konrad Sztyber --- lib/env_dpdk/pci_dpdk_2211.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/env_dpdk/pci_dpdk_2211.c b/lib/env_dpdk/pci_dpdk_2211.c index f9b419631..5b7846a59 100644 --- a/lib/env_dpdk/pci_dpdk_2211.c +++ b/lib/env_dpdk/pci_dpdk_2211.c @@ -148,19 +148,34 @@ pci_driver_register_2211(struct spdk_pci_driver *driver, static int 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); +#endif } static int 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); +#endif } static int 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); +#endif } static int