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 CA4F346130; Fri, 24 Jan 2025 19:17:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E4A7C42D27; Fri, 24 Jan 2025 19:17:28 +0100 (CET) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 1B1ED427C2 for ; Fri, 24 Jan 2025 19:17:23 +0100 (CET) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2164b1f05caso42749965ad.3 for ; Fri, 24 Jan 2025 10:17:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737742642; x=1738347442; 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=FTDXA9LPkUqWkSmOEs7UkaxrpcOwPgE9InDvOlmy4kGQluuVp1NgkVerl5kHEp0kmW l6ufQ3JvrOETVduMDTgkYJ5NpMjVg2Tx9QB42UT4kp7ptQs3IDfYJMBYyWK+0B9H8Crs OZv2NJykMLxUG/Xldc9AEbMNWewRxShfvUNWZ98HXSrHTyYnWRD206i1F2DPoz32Wndj szuWCCmkUi3mx0Kq2cRGbXO9vcf8W7Lhh9TJXIgXERZswfJQXQ/NL1vUDKb6Mxy6FxX9 h4F+NA8XTw/a+RrUnUGNGny4dd4dxccLF50OgnfCDl1XYAWdvo9IkfwJUxkr2wmH1zPq YAFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737742642; x=1738347442; 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=EOSMLqyueorTT5WQQ7ZqdM/C+X7gDJf6oKS8fx6NSBhnjWlmhxd5k88QiDxArWNkwR nKB8TIvI7k3vbk21nOMXXyc6E4A8kbzwF863/XZQEtLORAGBwerWMCijsaJzOkvAhOmD yBz9bvLg/PS03xuGkQkaJq5nImRUduIVQ2+3GDgrSjRaytpSuZ6E5bAbyrrYuopftzmL qZJjRJkFfHPiTGIIpxCJNHdgPxryMvf+qhoEDkXOBzpbdNd8v3giA7xD/0EyNam6VFai d6PLLdu7xh+LAlqB32n/NO8zCpvF2FkP21bCUogHK/fdANv9gQWcr9XYeOnEP2TYG2VV 9s0w== X-Gm-Message-State: AOJu0YwoB6Prt3gM3Dlo+t532vr2Q56jaUXfvSEDwQsBm3LOLkeeEiPc E4b+IRfEhd5JG0ve6dJbhYJvDlXBvhff8+DsB/d8E2EHHdIr8aq/OAHAEz7FaRElsjl8seDylFP S X-Gm-Gg: ASbGncurpLqlrFD58MTTll9/ZeU5JBWpj4wmI06CxmQToWFMcLGSzFY13cO6DRhCeSQ th3OsXtNhBxAv/0w0e+99jRPdgZClpk8+aX+f89FuPtULEfMHmKzrwhHTffBE3yV7sCsgnonzqz GeHowK22dSld8TFoYMYGhF7l+xRhh+EOeSN8nfquzJDn+gMb0AFVRSmD40dcAo/Qh6/v2thW0fa GefISwX+Rdzzn5NJ9QZgaSU4HtL+dQG5MBeEVdAc7nxcCkRFfWqXD+DTk2qZh1q/OCjyusIts/H g7bPEpRo7I+5KMb9Rp7+lvBZnL3CyzoijM7WyyjZE3VLjJ7j0uhBmuUtdw== X-Google-Smtp-Source: AGHT+IHbRUkf+jlEq6+mXarGsBXK88tx+c8oBAto9ofGeVTyOtfQoC6hy2zspzR9bAQLn0xYHnHVOA== X-Received: by 2002:a05:6a00:3487:b0:725:456e:76e with SMTP id d2e1a72fcca58-72daf94f68dmr43003823b3a.6.1737742642379; Fri, 24 Jan 2025 10:17:22 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a6b2ed8sm2184477b3a.41.2025.01.24.10.17.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 10:17:22 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Yipeng Wang , Sameh Gobriel Subject: [PATCH v4 08/16] member: add allocation function attributes Date: Fri, 24 Jan 2025 10:14:59 -0800 Message-ID: <20250124181704.86567-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250124181704.86567-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250124181704.86567-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