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 D5124460E8; Wed, 22 Jan 2025 18:36:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D0F2B4066C; Wed, 22 Jan 2025 18:36:01 +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 5960740654 for ; Wed, 22 Jan 2025 18:35:55 +0100 (CET) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2166360285dso139731835ad.1 for ; Wed, 22 Jan 2025 09:35:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737567354; x=1738172154; 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=Vr/XleU+U2WipNyjnNo1A+ZyoWYIaJ+s8o7zofi+bdg=; b=Ev8jPX3trZZN6l/7gkF9HObcDqhvVRBCEeXN7y3WDPOHLgrIDDNKfLwTNRe3JnKl5N NAm338f8CBfAI9pxlHzKYO6a1n+WXfLZZ2k3v21wkYUl8sraxqbYF/aNXtAChX69fBdc pL1hDG/4XBrtcacnx0vivOXQ2TnLpvlvfzq5IMUPhbf3Yr4a7qZiaAX2v9m+DmtrXmWB GODG/puZkMzfLHaEQWb6tgjr33nKwt59K6WIamOexE/l/8k8gGJ2/+gcdyqdUa8hNebR xe9cBWWlQV+bEaOfP/1BA2hgUgd10dBOUHRHzedTLsnvNEiruxmxa3u9XY9E8YEL70UJ OuHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737567354; x=1738172154; 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=Vr/XleU+U2WipNyjnNo1A+ZyoWYIaJ+s8o7zofi+bdg=; b=N2wwf3rJG2sHilitp/U89d2yfTGNNABAa63xwYof+PcEJWwOYtFcbc/y5YEI7fRgjB hSuYgs0xKiXHAMZksnT8UfXesmA/x5EWDs4dWM+QIYHfQKx8dR0CPgM1HZTZSThvZ1Ov RWwwHNVqi1JYx1Ghb640U/7II+Bj09TOa5Lmxv6yX+uSb0GaWunwH4GhPb5uakctbdsy JmzIpC6LfzTKieRqLFzmTx4yRz80LSm6bFH7Zqj8BEo3qCp7Ft2sOzuVRDUwxzs388Ph 8f3MdjGok0zzFsybhdHtW4Sm3FNuVNX8+KLZMEn1vmAA0QW9jXucuZvjceHtBOL4XDtn vO/w== X-Gm-Message-State: AOJu0YxtjsXbik66zNadAZk7cET7PBu71PuTC1UyNhlUd6MFx+un6vV+ LYSTrok7sMBdw4TllX+CBiEe3vUF+Y6dP5dFoioIkDsVF29OhNeSaYkVV3jyntXdfNyWvp8D0IK l X-Gm-Gg: ASbGncuDu/Ou5jGyO8YH3I83hOHu3a5453FK5QZXvtmyqWedN0jdLCxvmFRCGAetasD qADSMZKF003ly39pqVq1bDHlw+NG9Ewk4rLbMcaxlZe3V+0kirmBfy8uwnyJkjN2DJX6WaaXNbn 0uRDK+rrxyDU0a0gBa3/4qqf1jJEt/uBL8mPZ18Ojc2aTzyLQaOE9Nad5Pvv4DTjac0dFZ8M2jE izA6RTGrF87F7zhwN9CyE46yZR+LEBjpa71g1xKXT3yeLwnhB3zMgnjhjV1vJ+m6WnWCpRXvptO LKREqVs2GDthFEWrMuJCh3gR8Q2cdCNXaHVpxG3dFHAmjns= X-Google-Smtp-Source: AGHT+IGEX6gprT00s6PNxRnl0r4fU/0hl+rj2USfY/HyMM6B4DOhO1qe7T6obJIxJwJChm5PaBnT+A== X-Received: by 2002:a17:902:dacc:b0:215:6995:1ef3 with SMTP id d9443c01a7336-21c352c799bmr326739475ad.3.1737567354559; Wed, 22 Jan 2025 09:35:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 09:35:54 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev Subject: [PATCH v2 06/15] acl: add allocation function attributes Date: Wed, 22 Jan 2025 09:32:50 -0800 Message-ID: <20250122173521.305108-7-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 acl table is allocated but not freed correctly. Signed-off-by: Stephen Hemminger --- 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