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 53CCE46130; Fri, 24 Jan 2025 19:17:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CF5D42D26; Fri, 24 Jan 2025 19:17:26 +0100 (CET) Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by mails.dpdk.org (Postfix) with ESMTP id 5103A410D5 for ; Fri, 24 Jan 2025 19:17:21 +0100 (CET) Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2eec9b3a1bbso3583575a91.3 for ; Fri, 24 Jan 2025 10:17:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737742640; x=1738347440; 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=4R3kv2/qGhwSt5EpiXiai4C4GvQwuqWgX1O5TVEnMSo=; b=1dlFOlCdF/pJhH/SgS7StwzA3PInpDQvLEM5/O/3jnxlZ9tc/ZvrPfV8Bh+hvWCRyk sfSWWz839pl92eBrNCeWEZ2YlgphPVuqTN1eB2KGFXp7sPF2fbejymhxBYr1F5z7X/8N k5EhCdZpNZk5A+3TgQ1t4eU9w4xIerwbcHfQfSHYDhZfomqCfBrsINssIdSmobAcoZmj aCWug4D6f3uqM17XSf77FcoKDnA6NM5BeT/fLoqXNog9FWzyrMc6mcwgb41F7jz/xMA8 YlYT2hK4bhogym+eUmjx9ktGSzf0QsqYb/OzI/mTtlX2AySsmGhznmNMGxmPwXnKEmck SPYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737742640; x=1738347440; 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=4R3kv2/qGhwSt5EpiXiai4C4GvQwuqWgX1O5TVEnMSo=; b=ph+ZaghU7toufMSbEC67zRU5VhnJvzpj9IhxBgDHJb6JyH90BdHmnkBPKd3gzzuSIi XFwUgZlndmfuVEljKL+NdxEuD1IGC6wRuNK0+9PfmsUJ1GhAGWBWlS/0iR6Mn65tldvE CbOlk3fQJTNI7esdhLofw4G90n14AN8/g3JYTdOgw4QbjzRyNgMz6T5E3URxLzNuZdXY 6IE4bPv6VWQB114OuGKZKySKVT0c6iK1Ag8mjvwjkFvMbySJdtU3qGhPflGUdBHK5hfO QHmkZWz/tp6iBHczzhBiQQHIbT+sdtvHCGgabKHCxW92GY/bji5s494x8HP8heE7FfLR rKgg== X-Gm-Message-State: AOJu0YycDXfzR1wZNjexIOtxmZth3GsCLuVzgKPmQ8puKBdsgwkSx15g cLS3EZ/7vo8zv61xBdD3nqVa1YhSLTb+hkwwIvFxlXZ97mu29PBJTF72fS3M9uN/OoVI1Nncc7e w X-Gm-Gg: ASbGncucPOm5JyBy++sdE10NFHilvu09qk938NQjfrc+tRRINanJeo1JbB4XZgIbf1a pXkUuuP89RXEhcl6NaVKTDk6q5kwagwklfGzexeFI+u/N7Nfi+ZWIcXT0m9hOGsX+XmnD7NWjc7 NmyDbPjuud4cmNo7kjlGHapVg/4BlizrHHBh0g0pegpe+9as8Bu26wjm2JZ9lhj7lCE+rd7XKW6 FQA/JN5YP5IeyO8WfnkwKV356CbvX8HN/o4MG5ZJMw/1qRXK+RQmwiGPGeUJy7FOX94WTIadX26 K0CuvGfARbpu+1JRT8Xua+/7TBsT8ZsjXGyJ3ERgPmglQKzDmTo9mrx0EA== X-Google-Smtp-Source: AGHT+IGsdzIYE52dyyLbA9Ajye0l8dfMIr3zL9n7+L+5dEWfLdwK5kKQfWUnBwgl6qa3nVwLRqGgDA== X-Received: by 2002:aa7:8887:0:b0:72d:3b2e:fef9 with SMTP id d2e1a72fcca58-72dafb9e7c6mr45784874b3a.20.1737742640614; Fri, 24 Jan 2025 10:17:20 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a6b2ed8sm2184477b3a.41.2025.01.24.10.17.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 10:17:20 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev , Konstantin Ananyev Subject: [PATCH v4 06/16] acl: add allocation function attributes Date: Fri, 24 Jan 2025 10:14:57 -0800 Message-ID: <20250124181704.86567-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250124181704.86567-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250124181704.86567-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 acl table is allocated but not freed correctly. Signed-off-by: Stephen Hemminger Acked-by: Konstantin Ananyev --- lib/acl/rte_acl.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) 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 { }; +/** @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); /** * 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); -/** - * 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. -- 2.45.2