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 798E5460E8; Wed, 22 Jan 2025 18:36:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7A7FB40691; Wed, 22 Jan 2025 18:36:07 +0100 (CET) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mails.dpdk.org (Postfix) with ESMTP id D856740657 for ; Wed, 22 Jan 2025 18:35:58 +0100 (CET) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2165448243fso157136125ad.1 for ; Wed, 22 Jan 2025 09:35:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737567358; x=1738172158; 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=ULDyKoRzj+3svppljZiJUzrsOEyV6170t05drk/Zox/iPFdSCUkQnlP7odjGAC3LuT aHiLO0CZUSW8awgT0BzZpk+eZr4iVUROtJT0f7MVnF52tDStyd4Di/pcoAMAS7sxkRe+ RaUKwe0dt0X+gHXplophvBFFVUYgXxCr1c+T2wF6JoTLKAmLSW68lRjb4JBtRCQtzWiu +x8rLkXJChToL9r7ThOqCNjlFrLykkKBOHwskZALxkIPnLKOz9JMWpwA01kc1+NOb1RA NA1QojpLOy8EfpxK+diO9PxKLRBknyE8q+8fMBpv8X2FIhsPyeFRHGc/DIvIK9vuVVqS WKYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737567358; x=1738172158; 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=q9r8i0SavOx4ohMAfjywzpIjhhBAXY3EgpFzRb8sWtsp6PuFZzM7z+UeEsui2Isi3L NWq3kLAobHe1GRC/4BpzRHqqXs4H814kEC8R1olFKsiVFnAzFdGO5bP8Y83Q2FzUbbRt 9cH5gzjq4KafaigX+n+xQZyiLPYa5HUIVSNHMFrw5/9djoSuem4r7Q7d8k7X2UF4vDeJ Nvqn7B70chijBWSJWQ6uORH3+OIwvEG370UDSOKMPA3dlqgIVeGJpqDec7WiHdrWGk/k 7q6fPsVaVmP5yjCcvnm0eMk6neuya8XXenRN9qwjHLBP3odR+0PXjH+izFBakUwqEK3i 5nhA== X-Gm-Message-State: AOJu0YxldP8vVSFsTupXKR6ko01Jp+riAZZNxJK6SSwj4N+usRyF6cjw qpyiQvD12MNWNFAbL26PIFm7sEjGUbS8dCeL0bnJK14yvpM1KqcfcLpo4JFNRDEyOGXDo8b29Ur g X-Gm-Gg: ASbGncvsAiEuFg3wTHbptcb+p86RFYhrQAz0vuL2JTWI2UQ2MB3mmgdfyPh6yUxwhr/ qqRaRJlejV9xQFva4FDdiuGTKNfewdDCu39ci2ryLGik1JFIdh10mHaGqH3vbXJWkip8pbVaaNJ 1iSazc9Fabox8Xdnes72BSKVdLj1T9L2TxNmuMd2xW+vmYhcanfyMAYM8qRiTI/SCT3xKiLLFEF s5D0ND6vxKPVefQhQfbSyCgtcAYK8WpdkQbE1RrRkeS1RywHvCBig6JM5zmk7EBT1ze1cGa7FVu aAVuZOX4WfB+6uiC+1CfWxyXFyLWlZb3wO7zY/x5fzi8nAQ= X-Google-Smtp-Source: AGHT+IEO72ENsucoeg199TUkjG3x61XGb8YxEYIlMJtRKkFH1DMlig6fvY1pFPSLDNrIdkbCMy+LuA== X-Received: by 2002:a17:902:d4cf:b0:216:6ef9:621 with SMTP id d9443c01a7336-21c355b6188mr334800325ad.31.1737567358104; Wed, 22 Jan 2025 09:35:58 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21c2d3bc64dsm97469285ad.122.2025.01.22.09.35.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 09:35:57 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jerin Jacob Subject: [PATCH v2 10/15] eventdev: add allocation function attributes Date: Wed, 22 Jan 2025 09:32:54 -0800 Message-ID: <20250122173521.305108-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250122173521.305108-1-stephen@networkplumber.org> References: <20250120180550.198121-1-stephen@networkplumber.org> <20250122173521.305108-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