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 5F97D4611A; Fri, 24 Jan 2025 09:31:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4287540E11; Fri, 24 Jan 2025 09:31:21 +0100 (CET) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 6A330402E9 for ; Fri, 24 Jan 2025 09:31:19 +0100 (CET) Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4YfWFD1scVz6K9LP; Fri, 24 Jan 2025 16:29:20 +0800 (CST) Received: from frapeml100008.china.huawei.com (unknown [7.182.85.131]) by mail.maildlp.com (Postfix) with ESMTPS id 8B8A8140119; Fri, 24 Jan 2025 16:31:18 +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:31:18 +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:31:18 +0100 From: Konstantin Ananyev To: Stephen Hemminger , "dev@dpdk.org" CC: Honnappa Nagarahalli , Konstantin Ananyev Subject: RE: [PATCH v3 11/15] ring: add allocation function attributes Thread-Topic: [PATCH v3 11/15] ring: add allocation function attributes Thread-Index: AQHbbbRPJXIeUwKvw0O6tva5wIyiOrMlmOIw Date: Fri, 24 Jan 2025 08:31:17 +0000 Message-ID: <9a8899712c114d4c89885693d95d0f89@huawei.com> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250123163003.23394-1-stephen@networkplumber.org> <20250123163003.23394-12-stephen@networkplumber.org> In-Reply-To: <20250123163003.23394-12-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 >=20 > Use function attributes to catch cases where ring is allocated > but not freed correctly. >=20 > Signed-off-by: Stephen Hemminger > --- > lib/ring/rte_ring.h | 22 ++++++++++++---------- > 1 file changed, 12 insertions(+), 10 deletions(-) >=20 > diff --git a/lib/ring/rte_ring.h b/lib/ring/rte_ring.h > index 63a71d5871..15340a1981 100644 > --- a/lib/ring/rte_ring.h > +++ b/lib/ring/rte_ring.h > @@ -119,6 +119,16 @@ ssize_t rte_ring_get_memsize(unsigned int count); > int rte_ring_init(struct rte_ring *r, const char *name, unsigned int cou= nt, > unsigned int flags); >=20 > + > +/** > + * De-allocate all memory used by the ring. > + * > + * @param r > + * Ring to free. > + * If NULL then, the function does nothing. > + */ > +void rte_ring_free(struct rte_ring *r); > + > /** > * Create a new ring named *name* in memory. > * > @@ -183,16 +193,8 @@ int rte_ring_init(struct rte_ring *r, const char *na= me, unsigned int count, > * - ENOMEM - no appropriate memory area found in which to create mem= zone > */ > struct rte_ring *rte_ring_create(const char *name, unsigned int count, > - int socket_id, unsigned int flags); > - > -/** > - * De-allocate all memory used by the ring. > - * > - * @param r > - * Ring to free. > - * If NULL then, the function does nothing. > - */ > -void rte_ring_free(struct rte_ring *r); > + int socket_id, unsigned int flags) > + __rte_malloc __rte_dealloc(rte_ring_free, 1); >=20 > /** > * Dump the status of the ring to a file. > -- Acked-by: Konstantin Ananyev > 2.45.2