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 6C2404601A; Mon, 20 Jan 2025 19:06:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CCE9D4278F; Mon, 20 Jan 2025 19:06:10 +0100 (CET) Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by mails.dpdk.org (Postfix) with ESMTP id 9ADA84278F for ; Mon, 20 Jan 2025 19:06:06 +0100 (CET) Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2efd81c7ca4so6285500a91.2 for ; Mon, 20 Jan 2025 10:06:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737396366; x=1738001166; 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=Tkg9675k60/Cr+F3RSDKuPp/FKprdyFzd/bzpEBs21UX4a8HxRcnf+9Fk70rRtF/3F aGdpeq2B8Toep1qG/hgiFqWqlsrpDDUEPvMTszAhTtSNOwvEltAYXlxu2QlHqU0oSxE2 IanDtJg9DAQ3TObz83a+me3+9FxTl0IH9Yq7BKnWFbdOz0B/VdLavLmLusAGfJ9JDCaW RzTj+BSZn9lcaqn7PeuKRkZNYYIAw0LV5c079XnnV/10zyGtB/smF8fqSsuE3g8rQj4N AxB2yYOC7I7Zr63/QPrglkk9MuboaQte8Vhk3wZ1lUZz8k3vccl8ibU/cFjwziRdeoBc JtFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737396366; x=1738001166; 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=gEhdBlBJWoHvHifJ0PTSMpl2/b+pPKf2vaugSg47S9HwNHHyqv9H6yOahkzZUidOpk M8yT31W9NqnYb/qIt+N2LTe8Ouw/RUzoIfQyBoiPsNcM/gDALLtcYxH0JyHh8UWjzo5r Hz2EXaE7vv+EvjC0CzmTOEzDYF0d9NfGyySqjSW/I7f36JK3owE00QkdppGMKORVNvsC WsWiezjnlw6rP/l9zSRqaRMI11cllgaGyE9PdNl9h0OB56tR7ous3ggRNIGPzVVk4H/c 7cw6L+V4i8MWRiYn4nGI+vHl/36VLx6DW0CPVMVVNCEeqPgD2k15lKr4gj7zQqOuMwXm 1eSw== X-Gm-Message-State: AOJu0YxeGaiM6Ti2YldeVITWWqvvsAXtkFGYwYI3F6mv0QOu1obYo0ZD 5ovZeL3I1Crh1/SOneJPoTShSOi6Klqf2QU8+rFkpTYzeuPnEWEoXdmbFyJrNgdMZEsluqEqACh c X-Gm-Gg: ASbGncszGomdNV8EfjQ5s2nvkAw7KAWBmbEh1p7lWnzEgpHZBTTy7G0Hc28/z5ukiua dLskfl5MVAg5JedtKw8YO5E++bVAq/knxEDAUsUs2XqoyE6O19cfrHFTv+NqGbKkCu3reSGuYwe qVnkBRlxp/bFviWeLLSGY1eZvKrp1EMf76Cj7b/kamZogpEDZhcKJEm7PW/zQyap9Aa9m6JY4nF 7mxL43ILlGexKbC8KbwCRpnfBsKKC6MT+/SK8Pl6TS3zEJQwdRj0fSrSofLn2H/zd/MNu4wCG/E BG1sjKVCQF2kMiMbxhiZNa3lmnjjBeokEknaHZoehcl/Tzg= X-Google-Smtp-Source: AGHT+IFCjSHXziOvfmE0PzHSbSXT4Xb641eOXOv9oeyZu7uUguYIt8aEvA2yDkmY4Ouxyc1NO+7kFg== X-Received: by 2002:a05:6a00:148d:b0:725:eb85:f802 with SMTP id d2e1a72fcca58-72daf930e3cmr20392696b3a.2.1737396365804; Mon, 20 Jan 2025 10:06:05 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2025 10:06:05 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Yipeng Wang , Sameh Gobriel Subject: [PATCH 08/15] member: add allocation function attributes Date: Mon, 20 Jan 2025 10:03:26 -0800 Message-ID: <20250120180550.198121-9-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 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