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 EAB9E4611A; Fri, 24 Jan 2025 09:36:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A78C640E11; Fri, 24 Jan 2025 09:36:25 +0100 (CET) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 5D775402E9 for ; Fri, 24 Jan 2025 09:36:24 +0100 (CET) Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4YfWM55Mq8z6K9Lr; Fri, 24 Jan 2025 16:34:25 +0800 (CST) Received: from frapeml100008.china.huawei.com (unknown [7.182.85.131]) by mail.maildlp.com (Postfix) with ESMTPS id 15DA71402DB; Fri, 24 Jan 2025 16:36:24 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by frapeml100008.china.huawei.com (7.182.85.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 24 Jan 2025 09:36:23 +0100 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.039; Fri, 24 Jan 2025 09:36:23 +0100 From: Konstantin Ananyev To: Stephen Hemminger , "dev@dpdk.org" CC: Konstantin Ananyev Subject: RE: [PATCH v3 06/15] acl: add allocation function attributes Thread-Topic: [PATCH v3 06/15] acl: add allocation function attributes Thread-Index: AQHbbbREOr0cGXEbhUy/0QHh1m9t3LMlma5Q Date: Fri, 24 Jan 2025 08:36:23 +0000 Message-ID: References: <20250110170603.538756-1-stephen@networkplumber.or> <20250123163003.23394-1-stephen@networkplumber.org> <20250123163003.23394-7-stephen@networkplumber.org> In-Reply-To: <20250123163003.23394-7-stephen@networkplumber.org> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.48.156.8] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 > Use function attributes to catch cases where acl table is allocated > but not freed correctly. >=20 > Signed-off-by: Stephen Hemminger > --- > lib/acl/rte_acl.h | 26 +++++++++++++++----------- > 1 file changed, 15 insertions(+), 11 deletions(-) >=20 > diff --git a/lib/acl/rte_acl.h b/lib/acl/rte_acl.h > index ca75a6f220..b95f8778c3 100644 > --- a/lib/acl/rte_acl.h > +++ b/lib/acl/rte_acl.h > @@ -133,6 +133,19 @@ struct rte_acl_param { > }; >=20 >=20 > +/** @internal opaque ACL handle */ > +struct rte_acl_ctx; > + > +/** > + * De-allocate all memory used by ACL context. > + * > + * @param ctx > + * ACL context to free > + * If ctx is NULL, no operation is performed. > + */ > +void > +rte_acl_free(struct rte_acl_ctx *ctx); > + > /** > * Create a new ACL context. > * > @@ -145,7 +158,8 @@ struct rte_acl_param { > * - EINVAL - invalid parameter passed to function > */ > struct rte_acl_ctx * > -rte_acl_create(const struct rte_acl_param *param); > +rte_acl_create(const struct rte_acl_param *param) > + __rte_malloc __rte_dealloc(rte_acl_free, 1); >=20 > /** > * Find an existing ACL context object and return a pointer to it. > @@ -160,16 +174,6 @@ rte_acl_create(const struct rte_acl_param *param); > struct rte_acl_ctx * > rte_acl_find_existing(const char *name); >=20 > -/** > - * De-allocate all memory used by ACL context. > - * > - * @param ctx > - * ACL context to free > - * If ctx is NULL, no operation is performed. > - */ > -void > -rte_acl_free(struct rte_acl_ctx *ctx); > - > /** > * Add rules to an existing ACL context. > * This function is not multi-thread safe. > -- Acked-by: Konstantin Ananyev > 2.45.2