[dpdk-dev] [PATCH v4 7/7] eal/alarm: introduce alarm fini routine
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Tue Oct 19 23:39:44 CEST 2021
2021-10-20 00:05 (UTC+0530), Harman Kalra:
> Implementing alarm cleanup routine, where the memory allocated
> for interrupt instance can be freed.
>
> Signed-off-by: Harman Kalra <hkalra at marvell.com>
> ---
> lib/eal/common/eal_private.h | 11 +++++++++++
> lib/eal/freebsd/eal.c | 1 +
> lib/eal/freebsd/eal_alarm.c | 7 +++++++
> lib/eal/linux/eal.c | 1 +
> lib/eal/linux/eal_alarm.c | 10 +++++++++-
> 5 files changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h
> index 86dab1f057..7fb9bc1324 100644
> --- a/lib/eal/common/eal_private.h
> +++ b/lib/eal/common/eal_private.h
> @@ -163,6 +163,17 @@ int rte_eal_intr_init(void);
> */
> int rte_eal_alarm_init(void);
>
> +/**
> + * Init alarm mechanism. This is to allow a callback be called after
> + * specific time.
> + *
> + * This function is private to EAL.
> + *
> + * @return
> + * 0 on success, negative on error
> + */
The comment does not match the function.
> +void rte_eal_alarm_fini(void);
> +
> /**
> * Function is to check if the kernel module(like, vfio, vfio_iommu_type1,
> * etc.) loaded.
[...]
> diff --git a/lib/eal/freebsd/eal_alarm.c b/lib/eal/freebsd/eal_alarm.c
> index cd971036cd..167384e79a 100644
> --- a/lib/eal/freebsd/eal_alarm.c
> +++ b/lib/eal/freebsd/eal_alarm.c
> @@ -46,6 +46,13 @@ static rte_spinlock_t alarm_list_lk = RTE_SPINLOCK_INITIALIZER;
> static struct rte_intr_handle *intr_handle;
> static void eal_alarm_callback(void *arg);
>
> +void
> +rte_eal_alarm_fini(void)
> +{
> + if (intr_handle)
intr_handle != NULL
> + rte_intr_instance_free(intr_handle);
> +}
> +
> int
> rte_eal_alarm_init(void)
> {
[...]
> diff --git a/lib/eal/linux/eal_alarm.c b/lib/eal/linux/eal_alarm.c
> index cf8e2f2066..56f69d8e6d 100644
> --- a/lib/eal/linux/eal_alarm.c
> +++ b/lib/eal/linux/eal_alarm.c
> @@ -58,6 +58,13 @@ static struct rte_intr_handle *intr_handle;
> static int handler_registered = 0;
> static void eal_alarm_callback(void *arg);
>
> +void
> +rte_eal_alarm_fini(void)
> +{
> + if (intr_handle)
Ditto.
> + rte_intr_instance_free(intr_handle);
> +}
> +
> int
> rte_eal_alarm_init(void)
> {
> @@ -68,7 +75,8 @@ rte_eal_alarm_init(void)
> goto error;
> }
>
> - rte_intr_type_set(intr_handle, RTE_INTR_HANDLE_ALARM);
> + if (rte_intr_type_set(intr_handle, RTE_INTR_HANDLE_ALARM))
> + goto error;
>
> /* create a timerfd file descriptor */
> if (rte_intr_fd_set(intr_handle,
This belongs to a patch 5/7, doesn't it?
More information about the dev
mailing list