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 0EA514601A; Mon, 20 Jan 2025 19:07:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90A1B427C7; Mon, 20 Jan 2025 19:06:17 +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 A31E3427B5 for ; Mon, 20 Jan 2025 19:06:11 +0100 (CET) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-216634dd574so54077405ad.2 for ; Mon, 20 Jan 2025 10:06:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737396371; x=1738001171; 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=+DrV2TLi0/0J8n3P9Xxm+fM+XswZPA9vdFO93ygEnFM=; b=bwPupALgbB70snCKYQQJW4JcbrVt09MhbE3dN+Wd39dUDaGCiqCkcXvmfb3tssQ+oM KfS/tUvxjQRZKX6NC19fxdUcXhvSLrVEVI1FlocNeBXG+2/LfTzUkFlSRUO6STcBIyDI i7we2U1uIDD1THyMqL9OALYK1+TsIascZHunYnSMAK36dnXq0sginY4f51vyg+gtjJRX DMnYf16402cknX8MU6oFU5qQw/GJT0a12/OGO/6GTiqKBzDB/plCeWRxcwYdsyZNHOXt z9cVF8NkbOiOqgtuNb+6P7OSG0O8xcz4a1O7RI7RWsrBvTwCv8lYbHLiaH4rQGxulvYf kC2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737396371; x=1738001171; 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=+DrV2TLi0/0J8n3P9Xxm+fM+XswZPA9vdFO93ygEnFM=; b=eKTwy40QHYk+oNi5hIguT1D6eWaesjGlDDA9LYgZKGVOq/Ks4/VDjFyAxs83lF7IEP 6nA8NT6H8IT4l6UykRmpD81oNr3ZGRiB4lcaFjytqzYd2/QbcUBtrSyUH2Sguskwz7GF JQp7m7a3HdV1hFG3uxAByCQ5yeIAYn+MlvNDp7mwg/NOVkz5zgSv1M8XtKpvsgATtS+C QQRiJyn7s3VTw5h8unpx7eTtmnCTPZ913I/C+nzBHBhc2WaXXd6gZYFFoXOovqohO3Aa lFjB1XgaLlyiC1gIQGSKMUYB2K/DIIrrnm84YW4nZRi8AMIRWaauQR3SPfpgT5GNr1SK cq3Q== X-Gm-Message-State: AOJu0Yw7DzHhyiFbtUm7pT3eeYdBIJYHDw/3jf3Y5OJ49zKy4y4c+v6Z XD+lscU0nzMwqAeET8RyMzxOEw1KqI94qtuGIkSpk0dQ0x7mg7mGn4u0SXJHVDX1YG2xAnofb+c L X-Gm-Gg: ASbGnctkmuGyAPBopA3FKCpeTgnZGFHEOSKkp16VlhUi2ZEzHKKANeFczh0eM29QqSS wbBVPdOQ9jeqryjerEF5QqWVBKkK5qvTfUsAzXAcsTQzV0BDF3uyiaaTfxjyEVENkTVZpc3ag7N nZNGib8pr3jUtxljIyayYxwB6RgsJNa3zGOfBMYKfDOpGv/0J93zanXujhW9Y90qfLEwPGcdj/+ cxlKJO1uzIT9mevR4pVJTix4viVnVCnYwHmJE1DmH97kT9nzzjNQO4hw3IAt76+BJz1MtKLod0r Uu0mHchNm7NnAxo7y4NpaHzZrTZ+6V1sOv8J6Syve/olmqA= X-Google-Smtp-Source: AGHT+IG6DMTlTf7llNrPwJ4okJpbdWI5o4qrpkDLYxNAzjQExeWc9EWt1kd4JtSRLu4rXbHO1Aog1w== X-Received: by 2002:a05:6a21:9105:b0:1eb:22e5:bb76 with SMTP id adf61e73a8af0-1eb22e5bedemr17632017637.42.1737396370791; Mon, 20 Jan 2025 10:06:10 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2025 10:06:10 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson Subject: [PATCH 14/15] telemetry: add allocation function attributes Date: Mon, 20 Jan 2025 10:03:32 -0800 Message-ID: <20250120180550.198121-15-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 telemetry data is allocated but not freed correctly. Signed-off-by: Stephen Hemminger --- 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