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 DE71646104; Sat, 25 Jan 2025 03:13:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A57D40654; Sat, 25 Jan 2025 03:13:31 +0100 (CET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 7876A402CE for ; Sat, 25 Jan 2025 03:13:21 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-21644aca3a0so63306965ad.3 for ; Fri, 24 Jan 2025 18:13:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737771201; x=1738376001; 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=cZNXjiywwxqRmo12ZZJ8vYOkRnbALtbhRxQqhP0NjHg=; b=TA6/0X4ZNZKuIVIfHptHECAZ6nlQQUSnf1inc7Bo83T6+8t6hH45kSro/iHvn53hWR D7ythO+IrSMENoFm9zpuk7TyFEUHPL0R2VLTRtYTKa/MRazQ2NM9jCwSI3UU8YpRx9m3 lQOLxSScBwfoFNAfmuJU/6acS6YBGTlnLbb0QPH3KetS0y5k6bRYlrGTJI3HoPui0osO kuocVuPo8pnVehQ26c64KjGPw919FtY9ebeCxm8ThUnX/Ctvw4Cq1knUCmClyDHAQNht gtkBa6Q0ky7FS8ZH0xAupIEcczFtCqovWfLFT+kZuourQFMNPstU2U6izJHuHnncqaSy tccQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737771201; x=1738376001; 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=cZNXjiywwxqRmo12ZZJ8vYOkRnbALtbhRxQqhP0NjHg=; b=wX0qG2iwCpQ7niNUInhz/iQHkmdRO9VQDizmVSMO1iYASfyQNbkwsSPYGDqAYq2qhX /9HjFht7wCMjqxfqGK9l6jXp6P1J7C6teng0h9Rr4TTq8iNL43UfH+mNHlgIduphBu5Q eqJC0Prs3Hi2i+3UFP2HVDH1VM+hVOwnAH1nRbBx9mirtvtkq+SJqAhoEaRo1QnPVc57 d37t3xtWDZPiWy/xEiUVJIfLF7Ahq9VuZVLdOtjGVy+6xOhTHQ8c6eE4vn64OiIvW0o1 z/zti5DuwftTtj0gkktzNaA34+wEbuPdZ6Lwzf+4I+AC2lP41ApyHLDt6QtQZG5lgEYv wa7w== X-Gm-Message-State: AOJu0YzCzmm7JAIgOFD5lv3hq5nNNPmeFIpOcNTSSbDG4a2gnbYIcXUE lvYLWpqt03vH8CU6KEY3SG1PM6eQuA54aDkitGvdo4g0VSAKGmk+acZ/HNINttjpSz0lLYR47xe O X-Gm-Gg: ASbGncv1UGNN6VreF4C/sLG1ZzG7o3MBcoDb+CHRkF7fQGVwoBC32zWlbJ0kqufYyeH q/TPlAR7/4P0F/A8jJArSMBj0kBePyQwXtozwzyNuMYgpU4DmgjQQjKRVzvDpYh5GEgx1TSY5OC V95D2Ccepwi2vw9/I/zuwapo7TSysJ9g2KTixsCYjchA//q8g2I1laLt2X5SRpNKPWJqTSVlZv1 y7Nymds446tH7+jU1Lyz9EAJrJi5j/E+7XvyzPFbyM77IbaGJx4tda39GQArrOehJFqrl1My+KM DayK0ljmGYEYEN+OrwFuJVsWse5x0XNypPtseS/7jdD1pKRWYmzso3Ix7Q== X-Google-Smtp-Source: AGHT+IH6IT0hJAXluQm9IvxOEQL7Ax5oZUGX1ryfophEZ22TsweK99JS9dUM90S242hPajZJUUajNA== X-Received: by 2002:a05:6a20:748f:b0:1e1:a06b:375a with SMTP id adf61e73a8af0-1eb2160f41fmr57827200637.35.1737771200829; Fri, 24 Jan 2025 18:13:20 -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.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 18:13:20 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev , Konstantin Ananyev Subject: [PATCH v5 06/16] acl: add allocation function attributes Date: Fri, 24 Jan 2025 18:11:19 -0800 Message-ID: <20250125021305.76485-7-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 acl table is allocated but not freed correctly. Signed-off-by: Stephen Hemminger Acked-by: Konstantin Ananyev --- lib/acl/rte_acl.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/acl/rte_acl.h b/lib/acl/rte_acl.h index ca75a6f220..1ec0c5ca6c 100644 --- a/lib/acl/rte_acl.h +++ b/lib/acl/rte_acl.h @@ -11,6 +11,7 @@ * RTE Classifier. */ +#include #include #ifdef __cplusplus @@ -133,6 +134,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 +159,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 +175,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