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 A3EBD460FF; Thu, 23 Jan 2025 17:30:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E880640DF8; Thu, 23 Jan 2025 17:30:29 +0100 (CET) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id 5890240BA5 for ; Thu, 23 Jan 2025 17:30:23 +0100 (CET) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2163b0c09afso22329075ad.0 for ; Thu, 23 Jan 2025 08:30:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737649822; x=1738254622; 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=WhC9dhoICv38ALw4pQKxSOkQ9OIzDsuAj2JW0QK0/B8Z9rTwddfy29cL/aVL8zz+pW aJBQFquBtZRUvPuJz/YzCjfcJ3+z+ZkpIFRlU4XdUlzBSYkA0ItRVo0iPILBlNsmx90b 8B19xN1DJaf/3VV3pWk+gGzTbwWmMsqZU/31ENeWFn/ZaR0N64pWjNhr8PTRK7TdJb4l SuWA3Fd7p7rsYNjY2ox2VYKkNzMGMrw06ns/xGcw2v9CvWeJbB3w9YkiUbQPklJbVXFI J6k8f9JOI76A7HhrmZCufl4pX1/BPXKzBE2ees3BXnWi7tdpmViAUCs5/CVqABypCiQW z+fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737649822; x=1738254622; 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=MAhMYhUlQba8VVQEPoFGGhlxXuQ+wzcFxq9KZXmj5gherF2pJ5i0vJCllNOONl5zkA nsQMsjV28NxZnrBPWQz7WqBViSe22oBfb2Iu+dVPkquXUn1FP6TAYZUlQg1qS+hodbpC RYtLBwCUDSrJTSWUlt07Avl2qVa7+TtKea8B5D5aqTN5WzIDJH0lf7DNW0hm3yJs9S17 sEd2a4qLas5l9iQ/o4ZPaxjQ49WOI+9bGJvSSONEnq2eUPQt5K0idxNa3aT7gvHKtGLP eFPz8h1NBc+thhMWa6XDKrJRuNwiToznL7etj9QDhtz8UheBGdYMkVvaVbMUT1i0A0N5 5GLA== X-Gm-Message-State: AOJu0YywUxQ/zxlzxhvifnC+pjglz7ukRFRjxUpAcVN4fmum2A8Li8ry 0nmN/qy91ieZ/jjh3BKJTK3vaE/EZFPL4km6GIeKmKri+Eqmb3rOSZZATZgL0eMJjG1XxVPGHKg v X-Gm-Gg: ASbGncszJNmzHb9QJeVqB2Qv2Yf5b7Vr1qaCHcd1ogAQw+ydV7eEbBo/wX690A8dQOr mnnKRNi0fvgQOHzSmC4HgZwwt3xvR/b212sc+fmRWujuoUBBW5eIzVlzpKxwQ+OKeLxfYwZonab JqL9fKZsbkXqjccJeISkPhQ93/LK85Mo51d9kmVfvxt95Zs4COBxgNZIp4Leuq0wirUN/mCkNr/ fgVSvIzKfvfSCv3TRGMANCSUq/xgcCxHHm3UodN7EEMHmvFL3IdrJRKWW44+0sRtYKXEPqO2TR9 VvyhwnQQ6sWBUrNcSe5ERzjTlZoCNRUMDPmLVtSWzcc+Jql1oVqcuuo/EA== X-Google-Smtp-Source: AGHT+IHBfPn3j8NXLnMtHXMQzfuQMBODpoIDocHQHJmGK8jz9SAvuHQb+9N+Sg73nNd7shHr16gG4w== X-Received: by 2002:a05:6a21:7891:b0:1d9:c64a:9f72 with SMTP id adf61e73a8af0-1eb21461c4fmr44899622637.2.1737649822562; Thu, 23 Jan 2025 08:30:22 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ac4907f076dsm64601a12.37.2025.01.23.08.30.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 08:30:22 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev Subject: [PATCH v3 06/15] acl: add allocation function attributes Date: Thu, 23 Jan 2025 08:28:06 -0800 Message-ID: <20250123163003.23394-7-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250123163003.23394-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250123163003.23394-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