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 CB26146104; Sat, 25 Jan 2025 03:14:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1EE304065C; Sat, 25 Jan 2025 03:13:35 +0100 (CET) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by mails.dpdk.org (Postfix) with ESMTP id 489A0402CE for ; Sat, 25 Jan 2025 03:13:23 +0100 (CET) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-21619108a6bso47067705ad.3 for ; Fri, 24 Jan 2025 18:13:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737771202; x=1738376002; 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=34mATj8nhQRi5zocmRZZEm8EKuw2ZcxoGU4Biu3Hvk4=; b=1WLXg47BC1aiOfFurnAHCTO076QFVlinKSB3Y+a2VKoYQ63/XMpblxZsT8Vf0dT7MR +vs2TK8kgKdIX9nwHYVLifBVqAOXkoHgkNDOXobqj3UbGYBAYW1Maxs08ePl8ZA8hbL+ Q8+T1TUV6VGrMozNm7Ff2iA6lTZadEkkYQyjFMotr258gldXHUeb6/SA/GbsWhmLmeOF woRBv4W4KVw4ekT1J3XmQPJSc5XB7XqVMdmsEmVSIR9Ra802IlBGqIScQWWlScGgHrQu xiqzJY1LM/vc8hjzR+QlOjTJpp2YXGxxyF/PTlEnbpv858GaWOr944PbyWRrZ4b1brZw 8VuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737771202; x=1738376002; 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=34mATj8nhQRi5zocmRZZEm8EKuw2ZcxoGU4Biu3Hvk4=; b=rboyyEc06wpQg/ikycEzc8s7REgsDdh892ngIWDStnCzJJ7d27zlawLIRSfKuGOC2U BhRoEALI0A2wsk0588sJR2DsFCY8Sg17wktDAe9UpTSIFIfCPrjcipHt/GXWjZtGltsi gAsFwwHzS2a8o7qscI/ldID/bu2xlnuVx7hXgTJKm2gpNzDKjIQwq6307aBv9dkn7r9M fxIhpRGNNiRNn28UArZv+nT/tGuoIVWJTO3dXu0q3QJtwYoMRMOJZ896o4mSwRsnF60A Ljey1fvDvqrQBNk+p/RqsXoRLlJ5uHfux9/GvReSRxYuCQuyvvP2r7QnT+47aungoORu Csjw== X-Gm-Message-State: AOJu0YzgTWgpyeEAKpsE8K5im41lE4v538359Y/8wtRV64qoF+u3+KTA k+vBfET/I8LbzmLOrudi+yQ0ilE0Tj16jEon3zPrw3l1dkNvEdLGMs/vghoiaklugo5uAXcORiH I X-Gm-Gg: ASbGncu7UPR0svr7U5v66HLm2z/Fs6A5d5nb+F7c25fGPJ/F090hly+OOhG6tqiEfbn hDrIFQ88wzLYu1N+8uhEO3i/zvYIp05zv1QcMgazZFWml0H4tB5kbXWEKUWYBqzydlaIoyZ1RiU 3nJ4P9xmVIQz877g5nXmLBgKjM6S8JOiIx+B7PsSjgDirKz794o+BfRajwxdv7Rp8Gx9kDOzGKp qrbJZpBd0+0Xw4ZDRbVDJD6Da1i6/4mYPSrAG0FF88Q5WUpqEXF5oK1nh8Y6CBdxQzrPR6qKRQ8 oWuf3E0G2xu0z39nInkfLQYoIvK/sv2Zt2Kwpu+WdDsNdx4+W63YRmQEDQ== X-Google-Smtp-Source: AGHT+IGqVsZcpiImgLN9rFXY8WwrzDL3oOvPvSAtQ1DHVXsBDgZLleLYtludzoKrb8Ij+O6octWWfg== X-Received: by 2002:a05:6a20:12cb:b0:1ea:df1a:f8db with SMTP id adf61e73a8af0-1eb215fb288mr52638316637.37.1737771202587; Fri, 24 Jan 2025 18:13: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-ac48e84e199sm2345256a12.11.2025.01.24.18.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 18:13:22 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Yipeng Wang , Sameh Gobriel Subject: [PATCH v5 08/16] member: add allocation function attributes Date: Fri, 24 Jan 2025 18:11:21 -0800 Message-ID: <20250125021305.76485-9-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 member table is allocated but not freed correctly. Signed-off-by: Stephen Hemminger --- lib/member/rte_member.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/member/rte_member.h b/lib/member/rte_member.h index 109bdd000b..0235bb0a81 100644 --- a/lib/member/rte_member.h +++ b/lib/member/rte_member.h @@ -341,6 +341,16 @@ struct __rte_cache_aligned rte_member_parameters { struct rte_member_setsum * rte_member_find_existing(const char *name); +/** + * De-allocate memory used by set-summary. + * + * @param setsum + * Pointer to the set summary. + * If setsum is NULL, no operation is performed. + */ +void +rte_member_free(struct rte_member_setsum *setsum); + /** * Create set-summary (SS). * @@ -351,7 +361,8 @@ rte_member_find_existing(const char *name); * Return value is NULL if the creation failed. */ struct rte_member_setsum * -rte_member_create(const struct rte_member_parameters *params); +rte_member_create(const struct rte_member_parameters *params) + __rte_malloc __rte_dealloc(rte_member_free, 1); /** * Lookup key in set-summary (SS). @@ -528,17 +539,6 @@ int rte_member_report_heavyhitter(const struct rte_member_setsum *setsum, void **keys, uint64_t *counts); - -/** - * De-allocate memory used by set-summary. - * - * @param setsum - * Pointer to the set summary. - * If setsum is NULL, no operation is performed. - */ -void -rte_member_free(struct rte_member_setsum *setsum); - /** * Reset the set-summary tables. E.g. reset bits to be 0 in BF, * reset set_id in each entry to be RTE_MEMBER_NO_MATCH in HT based SS. -- 2.45.2