From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6ED4A0C43; Fri, 22 Oct 2021 22:50:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D66341125; Fri, 22 Oct 2021 22:50:31 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 0724E410E9 for ; Fri, 22 Oct 2021 22:50:27 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19MKNN83011711; Fri, 22 Oct 2021 13:50:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=o260TZ4PgvKGwlUlHllT4Rc89nZGzOFszrJLlNZ8vBY=; b=Zt5KRYOwBVNREi51HuuMdeIpEsu0lwpGM2c6Gnbw74erj1Gd8p+WhixlYeO3UNOZVMWJ CEYNdkagd+W8wM3wMHpZO52oKw9d8Bgu6ZjuJupaDc15nAbKEX7Apd6j//wU42Ewt/hX 4p5wHNsvxMRv3369KEzJ3j45Rsz+AdqcDo2KyP2PDFl+W5qz1Mt7XbPoydJnIFku09Nw n8J/gYEzFzOxZOsc8fOISYJ4oCWa+J9zBV1BLCXoFmsyS3SjshQDlMNClvRJVpaxJiRD OxetmmgT6NcqTtTkE4vV0yvM3LvgSOXRszOELL89XXS9l0Qq3TOcPEXNO/U3OXYTImWm sg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3buu23tc3m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 22 Oct 2021 13:50:25 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Fri, 22 Oct 2021 13:50:23 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Fri, 22 Oct 2021 13:50:23 -0700 Received: from localhost.marvell.com (unknown [10.29.52.211]) by maili.marvell.com (Postfix) with ESMTP id ACFB63F7078; Fri, 22 Oct 2021 13:50:21 -0700 (PDT) From: Harman Kalra To: , Bruce Richardson CC: , , , , Harman Kalra Date: Sat, 23 Oct 2021 02:19:34 +0530 Message-ID: <20211022204934.132186-7-hkalra@marvell.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20211022204934.132186-1-hkalra@marvell.com> References: <20210826145726.102081-1-hkalra@marvell.com> <20211022204934.132186-1-hkalra@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: UL5NpW_oJLEcZi5ypEQ3yxlH4PJ1gL7Y X-Proofpoint-ORIG-GUID: UL5NpW_oJLEcZi5ypEQ3yxlH4PJ1gL7Y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-22_05,2021-10-22_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH v5 6/6] eal/alarm: introduce alarm fini routine X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Implementing alarm cleanup routine, where the memory allocated for interrupt instance can be freed. Signed-off-by: Harman Kalra --- 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 | 7 +++++++ 5 files changed, 27 insertions(+) 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 + */ +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.c b/lib/eal/freebsd/eal.c index 56a60f13e9..535ea687ca 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -977,6 +977,7 @@ rte_eal_cleanup(void) rte_eal_memory_detach(); rte_trace_save(); eal_trace_fini(); + rte_eal_alarm_fini(); eal_cleanup_config(internal_conf); return 0; } diff --git a/lib/eal/freebsd/eal_alarm.c b/lib/eal/freebsd/eal_alarm.c index 1f2ea58175..cf706f609f 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) + rte_intr_instance_free(intr_handle); +} + int rte_eal_alarm_init(void) { diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 0d0fc66668..806158f297 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -1370,6 +1370,7 @@ rte_eal_cleanup(void) rte_eal_memory_detach(); rte_trace_save(); eal_trace_fini(); + rte_eal_alarm_fini(); eal_cleanup_config(internal_conf); return 0; } diff --git a/lib/eal/linux/eal_alarm.c b/lib/eal/linux/eal_alarm.c index 3d4307686c..c3a3c943a8 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) + rte_intr_instance_free(intr_handle); +} + int rte_eal_alarm_init(void) { -- 2.18.0