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 9B7B746114; Sat, 25 Jan 2025 19:40:54 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D0C0340657; Sat, 25 Jan 2025 19:40:31 +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 D4FE8402EB for ; Sat, 25 Jan 2025 19:40:25 +0100 (CET) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-21675fd60feso71631925ad.2 for ; Sat, 25 Jan 2025 10:40:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737830425; x=1738435225; 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=ISEe6e6+ovzLXof9V+qQUOYZvhpjOaaHuUvxpBpN/G7huJQPKlKIrNZ0y2iZhHHFdr ZYVhHeNeK9CeO5sblL/dahnUU4uys5YiD+5ufK3QUiIHIpDv1ir+pzz+UMiUrrjLQJ9T cLd6dr7aam4LBrdEEHPXR5FZm/gHNc+t52cge6tF1+b0HhwXVilkq6P3QIWMYDNJ7K6K WvapIenIGUXwOgrqN3MaGiv5hG47oU6sSUfX2G9h9gjF0xba0d+PBTynC/GnQunSr9e8 8s3rXO0UkZ2y5v7vT4KCGUgd2VyOMdgKJzSchB/UtL8hSqLKvUVhHrDpOxPXukaic/To giUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737830425; x=1738435225; 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=hLnKtUMR+xWvPSvit7rPCiF2ty3Q7DUdDvWNW9uTds3eN+32h6YpRooKHhm7cxIKxV Z+ufOos7ocvKJbj0Uno2tQ4OnPm/RbHyQrvp/t//YYOYD/u73R48LVML63XsKlhjEZrc rd00/0QaBmdvXsntA6Dpmj+8V72xNDFMQ/VNQS1Q7JtlJZQf6vWZ5RIDH3HE7D4EkgIZ Vt90S2ARnId+ahC3sJ02gQloB8lhXvNcBLqDFKagCbxmICi0NDci4wEXO1c8isSyeA5H PwyZn1VbbHXYB8VXDMAj1U/Q4/Pd1R/Le5C2rM7otLeGqThcTw05bkD1S30Jw10mEpfI xU7g== X-Gm-Message-State: AOJu0Yw0afDyEakKheUagLe8GsgF+Nr2DTTggMPKwVVQ3Xe1quH3mYQ9 uayFXF+mpFAkhtD1S/f6ZbD5KyIoiNnleQZ3Er2mcpVdnBzNYF6SUaP9bz71nK/TB/yOnXHvoSN z X-Gm-Gg: ASbGncswpbDHAHomjEuFvzIq9Ik0QJ2egj90dQingfF8Viqb91gcnCFbyTVDTFTxcjq 20N71AmsWuLrvDBSs/goU06DDBiCRY0WzlxTpaltSlv7VxTjh24rPLG2mrt/+ty9/fExdeq8lIq o5ryL2K9VzOitUcKMYa9Qcs51TtxOFsuikfPPRRIZqEPe2VDAUmxKpWhv7FWJkROYrZaCzB364B bZRnT4oaT3uLaMT6BhZG/iyQnxcqWnu6a/MCexCjaFzuBqmCOUm2KLH2lfWQBOZzXEO8BV9Gf47 2QbuvDODr1E2wZYzDjCii0Q0YVeDNdGxoYb8gcBP0Ou337B6mMO0JChRcQ== X-Google-Smtp-Source: AGHT+IHWOPYg0iLw7oQm0ypU5IiqcIouVSfOu1WTLqIpOXgB7qgl1TP8SKRbV1kFXIRiIqiZYz4J9A== X-Received: by 2002:a05:6a21:3406:b0:1e1:9b77:e237 with SMTP id adf61e73a8af0-1eb215dab81mr60302747637.40.1737830425109; Sat, 25 Jan 2025 10:40:25 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a7614f4sm4100547b3a.97.2025.01.25.10.40.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jan 2025 10:40:24 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Konstantin Ananyev Subject: [PATCH v6 05/15] acl: add allocation function attributes Date: Sat, 25 Jan 2025 10:36:39 -0800 Message-ID: <20250125184010.782330-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250125184010.782330-1-stephen@networkplumber.org> References: <20250120180550.198121-1-stephen@networkplumber.org> <20250125184010.782330-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