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 92BCE4601A; Mon, 20 Jan 2025 19:07:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E8BBA427A4; Mon, 20 Jan 2025 19:06:12 +0100 (CET) Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by mails.dpdk.org (Postfix) with ESMTP id 274C142707 for ; Mon, 20 Jan 2025 19:06:08 +0100 (CET) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-21680814d42so77174495ad.2 for ; Mon, 20 Jan 2025 10:06:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737396367; x=1738001167; 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=GOPFXGLx/UFznSwp9KK7Ts+spoLLHLUcJUiFfgDSCKP4a7hNKVv9Ghk/ro068NTdVv EJYtJriBgnA6HibhO7IkhVemm4rh8jvogeugiz9ThrteUf+73oGCU8bTK/NC/RJJbY8F VEfQlzyOwZiUVkh6tDOlQvN1MgiBLCwfIXTXX5izdNYrDbcla2mpnuc/Nn0ntjpf19Mg ZxCPPcn2WPGWdkc9YgDZ1yFIYu4wfztHYV9/AHjvphOwHcUKVtuCn+B8jD5xBqh/oiDj h0dPNzPMpnK994UtQ3/kPlzYULP2G8ui7ghzNS+fZ4KMA/D7pDB/Ju0rMaCFeUAxDt80 q6Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737396367; x=1738001167; 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=jYmJc3Q9LZb6IfGBGQfQ6OTH1sdf42sxxlHRNT6fRKjI4GQvqNMf1a/U92wUae/hCz lWY0cluNKAlhDxck3pNTHb4DN/lMEmEvCpob4FfRx+9uzHXDPyd6iL+7BbCteQeG2apk VO2OwypGSwti60yr8sQs0ERnPWQ/g+0H7eZbnuerC90rxlDYosacuU6DZUr4nI+sY0F/ XTTJ4bmRRLKNcX/DisKVL8uz3a39oSnBZOPl5pRwg+8SyoeJrjfRu0Janb+aKWZvoVQz DTblqWb77u7XtVy9jDjMTc9DSWltE5S5uWD4z3mCn6S2pqDsmyk1+ot4nfZZbMin/PrH YAlA== X-Gm-Message-State: AOJu0YxBw/ydg6jVm4WwRbmSmmp7gVF+1Nnx3mntL/g7Eb8fv39mLAz7 CGN/j5cgHMKJsdtijDWMn6e5mp1taKFRjXkBvrd8pTB5++ERiJvK//js1Uzx6RB3n1WDX6NGh6V V X-Gm-Gg: ASbGnct/z3jDMlfDWElaUgEuBUpJnsmbHRLECytVG9k6rSHijVICl/n3VnLLoeCi/Op Jt2Ol0c6AzY3gc7uc4sKSYZrFYHwOJ6/+cs/g6lgopQ+heWBLqqJC1Q4CtKIR6p6MRRLtHOdcYB Q70mk9BnqkF1PpLBHvsMpdqe6IoyWxFVrfeNVZTaH90EM7ibWLdChYq7At0u6wqDo3KIkKNmC7a X9OYtSrwFkXNMIbkvGBZPD0vEK96PcNoPTJWNQRLO4jeMN2JqQHxwXvJtzttPq9wtmO2gapA443 /UyhgLvsVsV+56h3k7Yu6C7PB7Ml/upZoS7m1kfxfzQs1gM= X-Google-Smtp-Source: AGHT+IF3+rkXK4xdgrKdvLMlLNlw1h8w81J/hFzCccX39Kxz7aNVGlK0XYRqgWJ48p8SgVB5AigXgA== X-Received: by 2002:a05:6a00:1885:b0:724:592d:aa5f with SMTP id d2e1a72fcca58-72dafa7f990mr16557206b3a.19.1737396367362; Mon, 20 Jan 2025 10:06:07 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72dab848b08sm7393982b3a.71.2025.01.20.10.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2025 10:06:07 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Jerin Jacob Subject: [PATCH 10/15] eventdev: add allocation function attributes Date: Mon, 20 Jan 2025 10:03:28 -0800 Message-ID: <20250120180550.198121-11-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250120180550.198121-1-stephen@networkplumber.org> References: <20250120180550.198121-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