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 182F246130; Fri, 24 Jan 2025 19:18:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B7AD42E46; Fri, 24 Jan 2025 19:17:37 +0100 (CET) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mails.dpdk.org (Postfix) with ESMTP id 83BBE42D27 for ; Fri, 24 Jan 2025 19:17:28 +0100 (CET) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2164b662090so48645815ad.1 for ; Fri, 24 Jan 2025 10:17:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737742648; x=1738347448; 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=0WaNZD3DgZ/JBG26plRGTB6EAs+5YX3c55xL2QkRQ9GcZr1r7rA3ZxkuxcmIfNvroY 9z+yj11j6TaG5JGUYDnPmhxfG0mejuJ2h9Fhd+6tH1G+65JEUdQIWP5rnblsaro334h1 LRDoAtEfDDm0gk46+Gmp8rBW5SPIrn36zlGaPVqKSStOxMwTqcYA4ar46BQIaLauAKle khrhvjtAghXgRg2d/uVNjShmYyBvduQ1pf+t78IMdn6hlxaROnJR6t2nBMLdPjpE20/Z qY7NyFi4zpI803IPY1R1K5WS5mIe6ai+MqOXZ2NeNk2kMi3s6b7fd+d2a4EQo96Bjf71 rDAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737742648; x=1738347448; 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=TyrtAyeijkRDkI/+H1MuZAMOEkIGbC3LhOBk4PEVZ4Xz6hngTLY7KnVSPjGZRfkpbO lw2yTXltAaMrfE6Q548NvS6hPJyqVvIyIyYhp0Mgo3LTfWmKWYTLZouGswAFVqd20mng axeQI56v1FE9AASPWGFBGVOPSYFKNE2r68h7qb9LvhQUylJy0S3G5KW+O6QGikh2J2k/ MecM1Um43nbaQDtuJ5C9Mws5j/FVSLyTsFT/qYsz+N5v2FC8iEcFCoQgUoUI1aLbY1y3 9dCi+jcOCxVjcEv70bfNKQkcYEnH1SHewwEd5jSLlT8XCW5185M2cDlwLWG9mV2LW94Q N0BQ== X-Gm-Message-State: AOJu0Yy7X+IRoDw671Gl2AOetDWV7/wqpfxhYfrxpBvn2SCov3XE78U9 B5zODfLr6Hxvp2Su0TIRl6AarnV3H5JVmbjzovjVtqnxzixWbfrcIILNfG86OVR1Bt/JRLZLY9m Y X-Gm-Gg: ASbGncv4XSZVAIlV3jXuOW/0fyVCYqDe4vSqa9PiQMUzi8MPX4r9R8uYigcED8WRZns 4udrwvmtsmncBB4HL7+2tV5O456j5prKAA8RBfkQTHsIpcipqMB5tXgODk0/gq9RWimgiNZDE8J Uth7Flgh0zjQK0qHzOCelYWJol8AmPG7MofwpivhRha/YcSS9gUU+5ioK3ItBtb5FrXynvhYcDR DUspBRE8/EmgkVvSFm3uTWqXU6a8q03dMpIWoqMcXX+4goZ0gUA/RXpvs2dKPZS3U2o7891+gwA yyKqpAuzQr9FxsjQUoJKERWMpssuFoWTm8VAt8ls4JrzVshniLKkIPoZCuIAg69yPcFv X-Google-Smtp-Source: AGHT+IEVD6pWFAkdwCra9aEi6vN+AAgOlkC8KhKj9g2eOvKXxQzVj+UU+O1TNwp9zy7XFGoaLbaAkA== X-Received: by 2002:a05:6a21:6da4:b0:1e8:bd15:6845 with SMTP id adf61e73a8af0-1eb2144d3aemr48862467637.1.1737742647833; Fri, 24 Jan 2025 10:17:27 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a6b2ed8sm2184477b3a.41.2025.01.24.10.17.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 10:17:27 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson Subject: [PATCH v4 14/16] telemetry: add allocation function attributes Date: Fri, 24 Jan 2025 10:15:05 -0800 Message-ID: <20250124181704.86567-15-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250124181704.86567-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250124181704.86567-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