[dpdk-dev,v2,05/11] eal/linux: add intr api to report multi-vector capability

Message ID 1446182873-28814-6-git-send-email-cunming.liang@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Cunming Liang Oct. 30, 2015, 5:27 a.m. UTC
  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 <cunming.liang@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_interrupts.c                  |  9 +++++++++
 lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 10 ++++++++++
 lib/librte_eal/linuxapp/eal/rte_eal_version.map               |  7 +++++++
 3 files changed, 26 insertions(+)

\ No newline at end of file
  

Comments

He, Shaopeng Oct. 30, 2015, 7:13 a.m. UTC | #1
> -----Original Message-----
> From: Liang, Cunming
> Sent: Friday, October 30, 2015 1:28 PM
> To: dev@dpdk.org
> Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming
> Subject: [PATCH v2 05/11] eal/linux: add intr api to report multi-vector
> 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 <cunming.liang@intel.com>
Acked-by: Shaopeng He <shaopeng.he@intel.com>
  
David Marchand Nov. 2, 2015, 3:59 p.m. UTC | #2
On Fri, Oct 30, 2015 at 6:27 AM, Cunming Liang <cunming.liang@intel.com>
wrote:

> 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 <cunming.liang@intel.com>
> ---
>  lib/librte_eal/linuxapp/eal/eal_interrupts.c                  |  9
> +++++++++
>  lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 10
> ++++++++++
>  lib/librte_eal/linuxapp/eal/rte_eal_version.map               |  7 +++++++
>  3 files changed, 26 insertions(+)
>
>
BSD has wrappers for the rest of this api, please add one for this too.
  
Cunming Liang Nov. 4, 2015, 1:21 a.m. UTC | #3
Hi David,

On 11/2/2015 11:59 PM, David Marchand wrote:
> On Fri, Oct 30, 2015 at 6:27 AM, Cunming Liang <cunming.liang@intel.com>
> wrote:
>
>> 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 <cunming.liang@intel.com>
>> ---
>>   lib/librte_eal/linuxapp/eal/eal_interrupts.c                  |  9
>> +++++++++
>>   lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 10
>> ++++++++++
>>   lib/librte_eal/linuxapp/eal/rte_eal_version.map               |  7 +++++++
>>   3 files changed, 26 insertions(+)
>>
>>
> BSD has wrappers for the rest of this api, please add one for this too.
Yes, you're right. Thanks.
>
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index 96226d6..c90bc4d 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -1196,3 +1196,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 6a2f495..a7b2be4 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 dbb8fa1..cb9f4d6 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;