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 B3C3B460E8; Wed, 22 Jan 2025 18:37:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26ADD40A6B; Wed, 22 Jan 2025 18:36:12 +0100 (CET) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id B12C74066D for ; Wed, 22 Jan 2025 18:36:02 +0100 (CET) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-21a7ed0155cso118725475ad.3 for ; Wed, 22 Jan 2025 09:36:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737567362; x=1738172162; 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=QoQ35Pt71TAeBj+VxStwGVTdvQ0staJ7MW+L5A9cg1I=; b=NjOKvWU8TYrMXwsHihklUvKfQfUiO1iVAmTsGrfEieiIPuzAAmyNnRfzMIlYil1fMI djskOsT//bDbsIv0TgT2jJGSZjJDo+u7DlM3FHHnPuuWI4KrwDea7leIBsTbqaJc9zgv lTpIIkzCxrT+Sf+HCWkAJgVs1bI127tEPPzkZB1+eDMeEAGXtP8QdtLarPIbT+o0BuMa AgQAAVd5eCjecm3Zp2CbvpRkgLkPdlVu65D4Z/yxIkbfupEQeXRxn3dQULbo+f5ynCAz 5fLU2e2QCznky37CqxQ0/0J+Sdr7Td8zz3x3FP9Nk/qlMfDm1gzbmXP3xnQJaf+MIQ2m O5TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737567362; x=1738172162; 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=QoQ35Pt71TAeBj+VxStwGVTdvQ0staJ7MW+L5A9cg1I=; b=dED3nbxu53Z9mcNCwonupK1aj2yE/WmDie9iC7m0QD4FPg7ZfxYYlXmH40hJPICtc2 0aCaJgiCkncbQz85lVs2jFtBsZKbAfXUgvL3l2KdnnYjcV99vydUvjGNuLbFN1aiRDAY Ej+9cmFp1Ti2DsYTjlxFdBiugDi54YtFP6OhkTPj6Y4v9lH8gdmpE5+BVycJj77XyI2D gr0P+kjs4wi3oavLpQk+eh5+YQ7Wq/jYrhfGcY71nPNphiW1Ov6kPZsD0Q5pJ7wDxy+2 6U2wkPiQFLS/yDqfreT1QMFRjoJ7JYTGdGI8KJINoYWybsjONsY5q/ggwxy5+AccecxC pcug== X-Gm-Message-State: AOJu0Yzn0aQ7ZYUzbVyfx6h0IfMOZmi9WVkl0aD1a5x9Cc5a8U7siIog X7F7RILY9IOF+iMTF2NI+L6WQP0pPvw7cTEP2vPqPyuaWimIHw1qH4Ss3CBP7nJ1o3HPZob5yz+ m X-Gm-Gg: ASbGncsCY2bjuLBux4EE6tnJZTDmJR1rU21Qrluor7x4jGT+qKAuMJc/ZaJCswnGW3H sRNuxbQ9yiSS8SDYWY0egVsiisKyFhnLLjmwfB0LiYNj72I6nhuYVUZKzIpsWZJZvSpQj0xyEZ8 JI3XJuCXS0VqYUlc9O9AX++G3WHL71LFqCdJ8HR9aso3y0IuirxLDxx3DqLNRRN6xkIfQPGLL6Q xPhSKJnjEkXh2jRzH95lTDm6omWEe6VxnTEIfuoha1iUQt1geVquUjOu7m+AWe4VfmTnuwk0Tkh T+x0NMMTWJQviLhFl7NeVtKqUtP2HXoQshT3VaWVs0FbIsA= X-Google-Smtp-Source: AGHT+IHKilJ777PMGyX5i/TrPRpC4mIb5WL9d3WA0PwvB0DydrZrbkBJqMG6BgD65b1b8Eq7bSJ91g== X-Received: by 2002:a17:902:f706:b0:216:282d:c67b with SMTP id d9443c01a7336-21c355c4287mr379798465ad.35.1737567361925; Wed, 22 Jan 2025 09:36:01 -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.36.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 09:36:01 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson Subject: [PATCH v2 14/15] telemetry: add allocation function attributes Date: Wed, 22 Jan 2025 09:32:58 -0800 Message-ID: <20250122173521.305108-15-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 telemetry data is allocated but not freed correctly. Signed-off-by: Stephen Hemminger Acked-by: Bruce Richardson --- lib/telemetry/rte_telemetry.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h index 2ccfc73a5f..c4554e4028 100644 --- a/lib/telemetry/rte_telemetry.h +++ b/lib/telemetry/rte_telemetry.h @@ -414,16 +414,6 @@ __rte_experimental int rte_telemetry_register_cmd_arg(const char *cmd, telemetry_arg_cb fn, void *arg, const char *help); -/** - * Get a pointer to a container with memory allocated. The container is to be - * used embedded within an existing telemetry dict/array. - * - * @return - * Pointer to a container. - */ -struct rte_tel_data * -rte_tel_data_alloc(void); - /** * @internal * Free a container that has memory allocated. @@ -435,6 +425,17 @@ rte_tel_data_alloc(void); void rte_tel_data_free(struct rte_tel_data *data); +/** + * Get a pointer to a container with memory allocated. The container is to be + * used embedded within an existing telemetry dict/array. + * + * @return + * Pointer to a container. + */ +struct rte_tel_data * +rte_tel_data_alloc(void) + __rte_malloc __rte_dealloc(rte_tel_data_free, 1); + #ifdef __cplusplus } #endif -- 2.45.2