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 15C3946104; Sat, 25 Jan 2025 03:14:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DA3B740665; Sat, 25 Jan 2025 03:13:37 +0100 (CET) Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by mails.dpdk.org (Postfix) with ESMTP id 98D084042C for ; Sat, 25 Jan 2025 03:13:25 +0100 (CET) Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-21680814d42so45885575ad.2 for ; Fri, 24 Jan 2025 18:13:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737771205; x=1738376005; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F3bIn/d1N16rdlLN2NLsU1uSkVbqKA+eN9u/q92Mt5Y=; b=VxxSIYkdDZ7FKMkY62Be+1/44YV0U+YL7dmVaPIM9N5JXcYi4OVmg8EAL4KoV6Zwpg Kdyxib/Uyv/w5w46l4g6uK4BdzUQrJrpnFWDGv5wPQoJj7iOT5dolpjawYRW18Jc01b0 MUz4mjRfx7Kj7VTuAzZG6MfyLQ+Rtu4jp3q9bqZF32WSAWhk3WgNrN49+AATVM3F8rKG yb21CkA7Hfkv/KJJh3D6iXYIkxazfvnuUzfn9y7FtnZTtaHNAbXCT7GtyXiQpm8ecX9M h61LwyL6ShquEqm9cnlvkdhuLpkLRjsGqJBgJXcoiio9U8UaYkf/1/0hCCgm8xTJga5R yvhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737771205; x=1738376005; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F3bIn/d1N16rdlLN2NLsU1uSkVbqKA+eN9u/q92Mt5Y=; b=UkkW6s3YUq746CJdxmvopsknGnU6s0g46LsF1xjsx+gPpLe+4dIZsg2spZGU3m5Vof AS0MPQdVul5pfVDI2xOZaB9tj11RRRsU9kHFuwzpiCf2yTKptade9DbEEevPJUe8bsqu w5R6pm17rLJTdpVmfm92OAIudKUNpZiYSLaTv6n7Up39YDPo9GEMxDKOU2KryLGupNru sWcBVKdj/KTfXV8F4cF3HyODw+kW/JfQM2R7iMdDOgWT5rhGmKZJj1zFVkyUaWPYsr6b 8L6ruB7pwwrs6PIcE9YD6yfMfZD70knWKagLKl9uTWILLheZcr8NOxMcjveGtAgrKrzl 5DSQ== X-Gm-Message-State: AOJu0YzSfC8TgWLOOw7+kMqOm1FbKusx13ROm42OF3W2eai98zF5bqyn 8fvAMoxct6Fu/RDYyMril+d916sCZqWfeBxSK6J4Djf/rJrEp8oIlT+Ex4XWr5EhaqwrW9ndcRN K X-Gm-Gg: ASbGncuaM0gZkjrhzuHjoXXR3atuffdn0Ob6Zkl81gL2MSxg2Wr8gX9kuFM/CONoK+K ZlPlI4v3NJWcTWHzIhAdpOkhYKVawWus6iiTej9z2V8PYC2kH7VJXVQw8q6UKPuqV8bLF5s2PZK +t1/QIGgjsTDcJMq4Kg4jU2nbb8PH5IEXSeDMiCerZjoRgZC6sA+dDmzB5aOp7lb4Ya5QB16/wp YOkv1dz7+qnljitoZeb9VQkIbeWpih2Et9rSV4k4iTvNHZGBowGG+H4G4UM4/x+hkNKN19eEv6/ SFHGt7FSpByb7MoqCLdvFngEB+7Hbe+RwGR6f8zayT2H65Ryk8lFjkqMXg== X-Google-Smtp-Source: AGHT+IFwYyxZk0rLA+7Tn+akeBwa+vJEeiCZwDUu89p3UMernPe8a0L+2/wzcuteFIvwuvHpE2cH6g== X-Received: by 2002:a17:903:11c3:b0:215:af12:b61a with SMTP id d9443c01a7336-21c35629a68mr467267385ad.50.1737771204880; Fri, 24 Jan 2025 18:13:24 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ac48e84e199sm2345256a12.11.2025.01.24.18.13.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 18:13:24 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jerin Jacob Subject: [PATCH v5 10/16] eventdev: add allocation function attributes Date: Fri, 24 Jan 2025 18:11:23 -0800 Message-ID: <20250125021305.76485-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250125021305.76485-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.org> <20250125021305.76485-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 eventdev is allocated but not freed correctly. Signed-off-by: Stephen Hemminger --- lib/eventdev/rte_event_ring.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/eventdev/rte_event_ring.h b/lib/eventdev/rte_event_ring.h index 5769da269e..a8f308e4d6 100644 --- a/lib/eventdev/rte_event_ring.h +++ b/lib/eventdev/rte_event_ring.h @@ -247,7 +247,18 @@ int rte_event_ring_init(struct rte_event_ring *r, const char *name, unsigned int count, unsigned int flags); -/* + +/** + * De-allocate all memory used by the ring. + * + * @param r + * Pointer to ring to created with rte_event_ring_create(). + * If r is NULL, no operation is performed. + */ +void +rte_event_ring_free(struct rte_event_ring *r); + +/** * Create an event ring structure * * This function allocates memory and initializes an event ring inside that @@ -288,8 +299,8 @@ rte_event_ring_init(struct rte_event_ring *r, const char *name, * - ENOMEM - no appropriate memory area found in which to create memzone */ struct rte_event_ring * -rte_event_ring_create(const char *name, unsigned int count, int socket_id, - unsigned int flags); +rte_event_ring_create(const char *name, unsigned int count, int socket_id, unsigned int flags) + __rte_malloc __rte_dealloc(rte_event_ring_free, 1); /** * Search for an event ring based on its name @@ -304,16 +315,6 @@ rte_event_ring_create(const char *name, unsigned int count, int socket_id, struct rte_event_ring * rte_event_ring_lookup(const char *name); -/** - * De-allocate all memory used by the ring. - * - * @param r - * Pointer to ring to created with rte_event_ring_create(). - * If r is NULL, no operation is performed. - */ -void -rte_event_ring_free(struct rte_event_ring *r); - /** * Return the size of the event ring. * -- 2.45.2