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 BDD8F460FF; Thu, 23 Jan 2025 17:31:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A49940E34; Thu, 23 Jan 2025 17:30:40 +0100 (CET) Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mails.dpdk.org (Postfix) with ESMTP id 7AE8F40DFB for ; Thu, 23 Jan 2025 17:30:30 +0100 (CET) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2166651f752so9608165ad.3 for ; Thu, 23 Jan 2025 08:30:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737649830; x=1738254630; 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=lXrvZlTkt+k+zR4p+AlPncIshLAu42H2WhSGQ0iLfy52YwU5UUpk2HLaN5oykoERFW y3AU+4ZSHR1k3ZVNQMJyt5Qv3D5Rz1E8BMQL2RTB/HcJf9+2pGOZh1wvA+lSf5aRNJus JUPHxezfoO7bbvWjzf85n5gu2f5u0ZINT0jnIQn+HTbWjBuU3AQKxl6H4rdQ8gGeeKKn MN0qS7tgjU9KEAWqCcaze7lRAphDAXCYY/Nu2ZhAcQP/ps6E8SDuxf1iV3Wad6cZe1LA dDeii0zBpNr5qtHFyYdFS3+K2YcXI6SbtMtcNzf78BObS8cDJi7ae8jv4j5zTrEMPsR5 IMmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737649830; x=1738254630; 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=Ii/2DSSPqdvdMgxSUQFSzEcT6R0A6pkK9N/T0RuDTxlLcIuyMhquQHb4DF30buq/vW /QkdY3nqyKocx08S3vkkFcCKF/faECY0fnYN4SpRqFgk9yxaAyvA9dU2NoBeT9EDZHY6 qvnudPFl/Ve15pn3v2OvQxfgCIRCisXbCWtkVxeuGzv2IEBVPf0ryz33WeVzV1L8qet8 3PV+PIxiv/oVz3c6O/PP+k/MUJnT2jk12ESu08nNpN4YNIaGO1apM3yMQQ8RF2fAcaa3 UaSi84/oIG0mZeLjXY0C70ahLqLNClbjvFqoB5hALyRMJJPIPsTa7jT6EKzzkd2iWS44 sUGA== X-Gm-Message-State: AOJu0Yytj+JXH8RJ6eZG4jIIzwPXI7i/DlAA9X2sKiCT+AIN/u/9J02a KaE5JyD+lmVsz/DK9mKlcO9OlTRvfmyCif8hlPoPxFUswGAkPq+7GumYJaiax3Y0owsWUuIARwh t X-Gm-Gg: ASbGnct/KORNOTO3Ujc5fZtu585EBUhwaXi+XBAj5iyYGI9A8k9wtCuSzZ0zdGb6K7+ XvSwY/AJGY0FkVtl3HJso1wG6GL8l257LvQ1Rc+maVEm01attbgR8aFKFs2+1AukGjZJwbjN7Ww Q1Im85rWC4CaIQXQfNpHzie/qk2dXB1B3BNpq3dMX0gGnn/usMvR4sp+tuhPIAOYrgYxotGR15z HbaZQsbLKdlXihf9VjmNXcB/OJ4BDRHb0IdtxxER6s9RM45w7S0hY6YoZGFyMhp2dg4YavQOuRU BuzWWcks77bYwqlN6ZqL9QPhpxE/zWQVivJK867V1TgoCnUnzFRWTl8N9Q== X-Google-Smtp-Source: AGHT+IErTdLgMgrhfi/iCkAXv9KnVezUt0rWjU5ZAFIO5Jl5bhhTaHelSdhQH93qYQJUCeYTqhj3jw== X-Received: by 2002:a05:6a21:788b:b0:1e1:9bea:659e with SMTP id adf61e73a8af0-1eb215d4c46mr44524331637.35.1737649829763; Thu, 23 Jan 2025 08:30:29 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-ac4907f076dsm64601a12.37.2025.01.23.08.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 08:30:29 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson Subject: [PATCH v3 14/15] telemetry: add allocation function attributes Date: Thu, 23 Jan 2025 08:28:14 -0800 Message-ID: <20250123163003.23394-15-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250123163003.23394-1-stephen@networkplumber.org> References: <20250110170603.538756-1-stephen@networkplumber.or> <20250123163003.23394-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