]> git.droids-corp.org - dpdk.git/commitdiff
eal: check if running in interrupt context
authorHarman Kalra <hkalra@marvell.com>
Tue, 14 Jan 2020 09:04:52 +0000 (14:34 +0530)
committerDavid Marchand <david.marchand@redhat.com>
Thu, 6 Feb 2020 15:35:40 +0000 (16:35 +0100)
Added an API to check if current execution is in interrupt
context. This will be helpful to handle nested interrupt cases.

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
lib/librte_eal/common/include/rte_eal_interrupts.h
lib/librte_eal/freebsd/eal/eal_interrupts.c
lib/librte_eal/linux/eal/eal_interrupts.c
lib/librte_eal/rte_eal_version.map

index b370c0d26458f49a43b32e27156efc82ec92e01c..773a34a42b376e9dded6df4b9170a1de86d37149 100644 (file)
@@ -220,4 +220,19 @@ rte_intr_allow_others(struct rte_intr_handle *intr_handle);
 int
 rte_intr_cap_multiple(struct rte_intr_handle *intr_handle);
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * @internal
+ * Check if currently executing in interrupt context
+ *
+ * @return
+ *  - non zero in case of interrupt context
+ *  - zero in case of process context
+ */
+__rte_experimental
+int
+rte_thread_is_intr(void);
+
 #endif /* _RTE_EAL_INTERRUPTS_H_ */
index f6831b7902c551d12b49fb24dd704440937e5fb3..ce2a27b4a5dd8e2433858bf885faf583d7eb65f3 100644 (file)
@@ -671,3 +671,8 @@ rte_intr_free_epoll_fd(struct rte_intr_handle *intr_handle)
 {
        RTE_SET_USED(intr_handle);
 }
+
+int rte_thread_is_intr(void)
+{
+       return pthread_equal(intr_thread, pthread_self());
+}
index 14ebb108cee90ae11eaa8c3be1a84d813d724021..cb8e10709839069ca97ea8e5580db89c25d7db7e 100644 (file)
@@ -1488,3 +1488,8 @@ rte_intr_cap_multiple(struct rte_intr_handle *intr_handle)
 
        return 0;
 }
+
+int rte_thread_is_intr(void)
+{
+       return pthread_equal(intr_thread, pthread_self());
+}
index e38d02530ce2e7d48816455b8231e3533b76da02..6cf5070680463f25ea7a0d92318678063ba21b1e 100644 (file)
@@ -332,4 +332,7 @@ EXPERIMENTAL {
        # added in 19.11
        rte_log_get_stream;
        rte_mcfg_get_single_file_segments;
+
+       # added in 20.02
+       rte_thread_is_intr;
 };