From d283059b7cdd48bb1aec2da4f894df8348810258 Mon Sep 17 00:00:00 2001 From: Cunming Liang Date: Wed, 4 Nov 2015 16:45:34 +0800 Subject: [PATCH] eal: query multi-vector interrupt capability VFIO allows multiple MSI-X vector, others doesn't, but maybe will allow it in the future. Device drivers need to be aware of the capability. It's better to avoid condition check on interrupt type (VFIO) everywhere, instead a capability api is more flexible for the condition change. Signed-off-by: Cunming Liang Acked-by: David Marchand --- lib/librte_eal/bsdapp/eal/eal_interrupts.c | 7 +++++++ .../bsdapp/eal/include/exec-env/rte_interrupts.h | 10 ++++++++++ lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +++++++ lib/librte_eal/linuxapp/eal/eal_interrupts.c | 9 +++++++++ .../linuxapp/eal/include/exec-env/rte_interrupts.h | 10 ++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +++++++ 6 files changed, 50 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/eal_interrupts.c b/lib/librte_eal/bsdapp/eal/eal_interrupts.c index 51a13fa264..836e483690 100644 --- a/lib/librte_eal/bsdapp/eal/eal_interrupts.c +++ b/lib/librte_eal/bsdapp/eal/eal_interrupts.c @@ -110,3 +110,10 @@ rte_intr_allow_others(struct rte_intr_handle *intr_handle) RTE_SET_USED(intr_handle); return 1; } + +int +rte_intr_cap_multiple(struct rte_intr_handle *intr_handle) +{ + RTE_SET_USED(intr_handle); + return 0; +} diff --git a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h index 3d138bf5fc..70a7087362 100644 --- a/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h +++ b/lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h @@ -122,4 +122,14 @@ int rte_intr_dp_is_en(struct rte_intr_handle *intr_handle); */ int rte_intr_allow_others(struct rte_intr_handle *intr_handle); +/** + * The multiple interrupt vector capability of interrupt handle instance. + * It returns zero if no multiple interrupt vector support. + * + * @param intr_handle + * Pointer to the interrupt handle. + */ +int +rte_intr_cap_multiple(struct rte_intr_handle *intr_handle); + #endif /* _RTE_BSDAPP_INTERRUPTS_H_ */ diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 64fdfb1ecd..8b00761d94 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -125,3 +125,10 @@ DPDK_2.1 { rte_memzone_free; } DPDK_2.0; + +DPDK_2.2 { + global: + + rte_intr_cap_multiple; + +} DPDK_2.1; \ No newline at end of file diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c index 89380675ef..95beb4c709 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -1212,3 +1212,12 @@ rte_intr_allow_others(struct rte_intr_handle *intr_handle) else return !!(intr_handle->max_intr - intr_handle->nb_efd); } + +int +rte_intr_cap_multiple(struct rte_intr_handle *intr_handle) +{ + if (intr_handle->type == RTE_INTR_HANDLE_VFIO_MSIX) + return 1; + + return 0; +} diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h index b44e69cc83..3dacbff88c 100644 --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h @@ -215,4 +215,14 @@ rte_intr_dp_is_en(struct rte_intr_handle *intr_handle); int rte_intr_allow_others(struct rte_intr_handle *intr_handle); +/** + * The multiple interrupt vector capability of interrupt handle instance. + * It returns zero if no multiple interrupt vector support. + * + * @param intr_handle + * Pointer to the interrupt handle. + */ +int +rte_intr_cap_multiple(struct rte_intr_handle *intr_handle); + #endif /* _RTE_LINUXAPP_INTERRUPTS_H_ */ diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index dbb8fa1582..cb9f4d67a3 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -128,3 +128,10 @@ DPDK_2.1 { rte_memzone_free; } DPDK_2.0; + +DPDK_2.2 { + global: + + rte_intr_cap_multiple; + +} DPDK_2.1; \ No newline at end of file -- 2.20.1