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 DDEE8460E8; Wed, 22 Jan 2025 18:36:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D8D440671; Wed, 22 Jan 2025 18:36:04 +0100 (CET) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mails.dpdk.org (Postfix) with ESMTP id 2F3084065A for ; Wed, 22 Jan 2025 18:35:57 +0100 (CET) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-216426b0865so125517935ad.0 for ; Wed, 22 Jan 2025 09:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737567356; x=1738172156; 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=us1XOju4xU2ZYCG/d6w21g1SHVdvEPzn7Hy4nW91IiLchjvQRe6NdIwYXOoG6f5OaB bVKhYr2ei+LUu/cyhf3wYhYRuj2I+aD+HAvc/gAUtPCfFHO0cvwJWKNo4YAKFDUkFxWM B7lQTFxY7c1ovHElexvOPmSrsLLSpZwVOFiN4iVAUzbYvproQIlk67ZsGTsNHHcVIABC HNn8ud8PRylB2jrFsn34cea3s5RlnAGeVKSwnGpgjLnnXBWqBcchKK8e+QHlefAdJTjD GeMh5hOC3n5vUFLnEXHQ4Xr67+3UlBLzQN8hPsqBIy7J9bitsLDZYp92G1bPvHFH9QSR /szQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737567356; x=1738172156; 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=deeQLqUU4KO3z+xlkYglN54F9Pc2y3nGakh+xu7rOsPNrTe0H8HzSAWVmCcuYULnFD qScMASIWY6hnmJIUFeX3kS+GDdFxZ0c5UFzTSG9/UGPr76uIogOjlW+vRH+KAYzYt8h7 jZA7chtKlwju6KGQ4LwKirJgJbj/rcAGb8i9BfAp6qtmTPfBbmLE38EclzzF4kh4QfU2 e+x3FTumqi1qkmTFTdh8Ys2ErtZ/7L9TzfCszUKMdz8umFujlGl5/S88v6bDjbt1nG+O qpXwz2dkfNQ3Tvq2XUgux10tfQSk7vMQDfW1+CHXP6HlDo8u50ZjDKzscKg8ngmIkyC+ FQ7Q== X-Gm-Message-State: AOJu0YwRhYekbdzh5sxNJKLzG33PkknR5pSkT2cFTLnZOncZPstOnVCz k5Ot7dlZOlpESJ0xPuz9ng2AL5BRphdm1SxGu8yGbo6e123bTJGP4gEzZVGqzEHZvEfe8iLgr8u 7 X-Gm-Gg: ASbGncu89sjuigAIqsK5Rp0mGkc/sW6ZXweyFRtXv8d8Qrbxr1N9FOUc6ecMXVRkGbH d1MB7Io49RCXLseQR++pjZVywOur3/rfF5M9GPFFzfA1PWMpxuIQ0l92H0tZSifHyv9wzHE7O2p 30m5ya0N3h+Z3lgQMO5rhC2VT38aDNdrA2JPjjrM2eH4hZywk0cKZQ6s2/tOXl38xhH0fVtA2qO ZC7Vh3BaryMga8iUbqkVwt70iJsxRtrbYNCMWSxoD33bgbjTpFeWk2k1m3ArlIqPXL7pmUKA+KG TyoZdGXRRlIdpqwejXqmAb9gVfZ/hk1HrGF+nk59AoiUyGM= X-Google-Smtp-Source: AGHT+IEWw/n3W96lEGDhEp/qKT0B6QWwLNoAjdK65BxzmUJYrRSpqC2uCpkeW4GieZeHNrp21RI4tA== X-Received: by 2002:a17:902:c951:b0:216:5268:9aab with SMTP id d9443c01a7336-21c355e832amr311545005ad.46.1737567356360; Wed, 22 Jan 2025 09:35:56 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21c2d3bc64dsm97469285ad.122.2025.01.22.09.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 09:35:55 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Yipeng Wang , Sameh Gobriel Subject: [PATCH v2 08/15] member: add allocation function attributes Date: Wed, 22 Jan 2025 09:32:52 -0800 Message-ID: <20250122173521.305108-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250122173521.305108-1-stephen@networkplumber.org> References: <20250120180550.198121-1-stephen@networkplumber.org> <20250122173521.305108-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