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 AC8B846114; Sat, 25 Jan 2025 19:41:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A93034065A; Sat, 25 Jan 2025 19:40:34 +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 724B9402E3 for ; Sat, 25 Jan 2025 19:40:27 +0100 (CET) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-21670dce0a7so65234515ad.1 for ; Sat, 25 Jan 2025 10:40:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737830426; x=1738435226; 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=tF+eCNjsO8YDizkk4p9UUhsKZdTQ2uBVelBuvAhAaLUGx+zipxZVnNl0coZLonwHKB 7n7PrOn2LpxcN4Fb5OAFql04glDNH1Mh9uMomRMHiHTt0k+9xcqP57utvP/h8/v4y89C Ho7TVVPPJwsny4kuB8tmxUPUbuskZY9kVFzDwXj5s1AXHle50XZLwN1soD3SpQwTGNk/ 7nzy5iT17Xni6qJpZSK34k01ZWaLtoukPW4X2bUIDevBSl7g83tdYbqGzl7nIO+dnYqC O1YGGUFT1QAStUH9bQ/gJglGQUSLXuSWGTrPFeFZzpEoOxw55VA9ArPFLtE58ZUoAGGU /XeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737830426; x=1738435226; 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=ZGVbdafdx+NwVxTcKb2Pdlwr1poBo/qVtgtFtXUE0r3wNlXFUMxIkZtlfj4MooZ8e8 ve4K3JnN2W4ufyWy+iFP4tvl4hv0V6n/Rc7DGenwlfvqurQe7G61hhR1MOlXd9GlHJVj SENHR6OrCA+UEhmnPYBmrVGhuCgHyG8lIoPsKrU39IKPFKFEMcvVDinHEumwnrDlb6ER db+oPBRTLLyd6pwRPt7UnD1z6MQhRVP1hiRVeseBT/Dg5vk6jJXizJAdwJvD23CcM0ER /YBft4H3i1PHjDXdRE81eqN5orU+8kTUOfkLb2WIuwTXyIONEOlGmpT3vcRqy53E913O MFqQ== X-Gm-Message-State: AOJu0YyAHlbVIE0PfwpsK2IKBqB/6YABi6iTLHEaMzMBQkor48B9VGAm 9xGppSTMacH5Mk2JIKp4EAcFiKbfEUgiKdsTtiUuIzr57/A+MGT/uSxvrkBDr2jBukaQD+74mB4 q X-Gm-Gg: ASbGncvCda+uIa1pTzbor1Ev78GTZ1rKBw55BEKRFc2EvpEP3H0lvWlTTm1GeRNo3ni hkHxXVY382pfjYRHaTFg6x7BmLDajFxUNBRgpzjn7rlMaoHk1mHNII+q/HRO8/2z7qyy6LAFnQG uoFu/CXJ37hOkNhROiHsMlCYdro3JGEUW4y0NW+WA6S0be9q0lv566B9MwH/e9xuQY1u9pTlEYH 6eTcf5BydGYJ9iMg3PMkqQXLWQBbVCGZNheM9J5lIqsyFCxqbPLmwIM5CeN20xPsJPFYI5IvTFk xf1vsgZ6nnlBTkUl4i00KoPr46FaJaR4dNBVCXUmPAfGqPXbMMF07IxhuA== X-Google-Smtp-Source: AGHT+IH6HksTofYgK9P+bleh+458YSnlgIHlhVibFgyepdsSmZiaHipQRpvIMEojYanBWYcV4184sQ== X-Received: by 2002:a05:6a20:3d8e:b0:1e1:c4e4:8898 with SMTP id adf61e73a8af0-1eb2118c995mr57310218637.0.1737830426661; Sat, 25 Jan 2025 10:40:26 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jan 2025 10:40:26 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v6 07/15] member: add allocation function attributes Date: Sat, 25 Jan 2025 10:36:41 -0800 Message-ID: <20250125184010.782330-8-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 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