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 CE6444601A; Mon, 20 Jan 2025 19:06:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C43AF4279C; Mon, 20 Jan 2025 19:06:08 +0100 (CET) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTP id 15D9F4270A for ; Mon, 20 Jan 2025 19:06:05 +0100 (CET) Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-2ee8e8e29f6so6186873a91.0 for ; Mon, 20 Jan 2025 10:06:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737396364; x=1738001164; 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=fUpMcDRJMNxFywoAGN8m9HpkwX1IaxsobbEnqStmmUpHtMwsjtVtLnQOh+qcmGrBoL DLelU9BPjVljec8J9xwtIF9DVS4DUP9JUsoVSbYejrFdi+qBQ79vXxpJIC7RgXuaIq/O Mth7K0Sens3NuFyKboLeOrvOwoBfyW+Z8KoQG0C5uPpiHpxbN0IPcmMNLfQmjP03dvBu zyAs7mtJHsjHsvZhS3R33cM9lI6KO2/xuBLc/aa8a8OA1M2/uo57bbJTaWwOixqR7Z2d 9pfyrVXe1iCwncI5yTWdiZBtm422SFSv42QEUcWEltMni9vFWuZbnxqvXzXvM1ocU8Vt K0LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737396364; x=1738001164; 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=rIdjSAQTG6S8v+kcHlR3QWQPt5CpavkQ9bHBoj+s+mWx5GGEFUb8q+Ho3FrY4m2KNW wU/VNKlf4bqOqrXYPY4l0mXX2Rc9NrqxNphryEAVDKs686NwpihDrmy9HsvMuXwz13YY uRSQh8sjCdtfIwY/KD4yxuZ7s5BTI0LRdMVmFg+JOZkNeWq+9tuilxFud7S6dZH4WvQv KtuGfytYIFna9JBL0ENlBPRuDuKbSciKvWkscmWW2g/EKu8NhYh614gjgH+7P784Hdgg tzmy2UHRzyYQsMyvWR4hY8T5RW5X1xiEvT+Gi7l6CnzE0p0bOO4SikrNzNUbAVQk44NP pa7A== X-Gm-Message-State: AOJu0YyVNwP5Yk1DenIFRxz/B6M6EJdts2O3rFnZ3qXouJEWNHC20+b9 b5CKzKxRk4wX5BcbP9E2HYKPiIfinyLdgocxYlHBQuADznq1+KpUSjLaDRXjD/Q2q3feU13jsFt S X-Gm-Gg: ASbGncuD3/+AYbGXMZ66tnAr5YT/3vtQXEJZh/K9CPfPk0mw85TZh5XciK3kEMHtMPC qM+BQpkxWkGaw3cLMD9q2h0/Kz26wsar2saYDvaO5DbiLAHEtKRJadjuQsLmSlTANAzYI8SWG2p 0HS+dcVA1pOZp/Vtumc+IUXdzXBBCbaRy7W+dc5yTbYLKnf1jHR0hfg41RDpjt2kg+jmwPP/Zoa DOVs/Bfk7OC2z0zVfHgumyO7JQ62ARQEOeIaT4STJ56xssuuW3VlNZ3imG2AeVNdPgI7IYjlmJ8 firl24zu/k1zQIpYtmYZl6OlgEHgwC3Sca3UVaJ+OVIqFPk= X-Google-Smtp-Source: AGHT+IH/hjQiogzL2MzHI19Iv3mYjq/SeUn6i1JKzPQjqdPB7JErQ8SVN1xXAad+T+VKGSdebqmcMw== X-Received: by 2002:a05:6a00:4615:b0:725:f1b1:cb9f with SMTP id d2e1a72fcca58-72dafad530bmr20813531b3a.20.1737396364315; Mon, 20 Jan 2025 10:06:04 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2025 10:06:04 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev Subject: [PATCH 06/15] acl: add allocation function attributes Date: Mon, 20 Jan 2025 10:03:24 -0800 Message-ID: <20250120180550.198121-7-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 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