[dpdk-dev] [PATCH v7 1/2] eal: add API to check if its interrupt context
David Marchand
david.marchand at redhat.com
Thu Feb 6 16:35:04 CET 2020
On Tue, Jan 14, 2020 at 10:05 AM Sunil Kumar Kori <skori at marvell.com> wrote:
>
> From: Harman Kalra <hkalra at marvell.com>
>
> 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 at marvell.com>
> Signed-off-by: Sunil Kumar Kori <skori at marvell.com>
> Reviewed-by: Jerin Jacob <jerinj at marvell.com>
> ---
> v7:
> - No changes.
> v6:
> - No changes.
> v5:
> - Fix shared library compilation error
> v4:
> - No changes.
> v3:
> - API Comment is updated as per man page.
> - Scope updated within the library/driver only.
> - Remove experimental tag
> v2:
> - Rebased patch on 19.11-rc4
>
> lib/librte_eal/common/include/rte_eal_interrupts.h | 11 +++++++++++
> lib/librte_eal/freebsd/eal/eal_interrupts.c | 5 +++++
> lib/librte_eal/linux/eal/eal_interrupts.c | 5 +++++
> lib/librte_eal/rte_eal_version.map | 1 +
> 4 files changed, 22 insertions(+)
>
> diff --git a/lib/librte_eal/common/include/rte_eal_interrupts.h b/lib/librte_eal/common/include/rte_eal_interrupts.h
> index b370c0d26..19d1d45ab 100644
> --- a/lib/librte_eal/common/include/rte_eal_interrupts.h
> +++ b/lib/librte_eal/common/include/rte_eal_interrupts.h
> @@ -220,4 +220,15 @@ rte_intr_allow_others(struct rte_intr_handle *intr_handle);
> int
> rte_intr_cap_multiple(struct rte_intr_handle *intr_handle);
>
> +/**
> + * @internal
> + * Check if currently executing in interrupt context
> + *
> + * @return
> + * - non zero in case of interrupt context
> + * - zero in case of process context
> + */
> +int
> +rte_thread_is_intr(void);
> +
> #endif /* _RTE_EAL_INTERRUPTS_H_ */
> diff --git a/lib/librte_eal/freebsd/eal/eal_interrupts.c b/lib/librte_eal/freebsd/eal/eal_interrupts.c
> index f6831b790..ce2a27b4a 100644
> --- a/lib/librte_eal/freebsd/eal/eal_interrupts.c
> +++ b/lib/librte_eal/freebsd/eal/eal_interrupts.c
> @@ -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());
> +}
> diff --git a/lib/librte_eal/linux/eal/eal_interrupts.c b/lib/librte_eal/linux/eal/eal_interrupts.c
> index 14ebb108c..cb8e10709 100644
> --- a/lib/librte_eal/linux/eal/eal_interrupts.c
> +++ b/lib/librte_eal/linux/eal/eal_interrupts.c
> @@ -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());
> +}
> diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
> index e38d02530..06ed2e9dc 100644
> --- a/lib/librte_eal/rte_eal_version.map
> +++ b/lib/librte_eal/rte_eal_version.map
> @@ -91,6 +91,7 @@ DPDK_20.0 {
> rte_intr_free_epoll_fd;
> rte_intr_rx_ctl;
> rte_intr_tls_epfd;
> + rte_thread_is_intr;
> rte_keepalive_create;
> rte_keepalive_dispatch_pings;
> rte_keepalive_mark_alive;
> --
> 2.17.1
We can't put this symbol in the stable ABI and just flag it as
internal in the function description.
Users won't notice this warning.
I moved this as an experimental API and enabled the use of
experimental api in octeontx2 common driver.
We can revisit once we have the rte_internal tag Neil had proposed.
Series applied, thanks.
--
David Marchand
More information about the dev
mailing list