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 91C1C46114; Sat, 25 Jan 2025 19:41:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 35ECC40684; Sat, 25 Jan 2025 19:40:43 +0100 (CET) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by mails.dpdk.org (Postfix) with ESMTP id AC39B40656 for ; Sat, 25 Jan 2025 19:40:32 +0100 (CET) Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-2f4448bf96fso4349536a91.0 for ; Sat, 25 Jan 2025 10:40:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1737830432; x=1738435232; 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=O4rJKUUC0mcL1OI0QnwkiYM7Xfj9Qj9O2q6h1bVrtgsMWnS9x9hGElhmLqMqQW4Bby 6v7gcGpwgLOe/uUVxm5r9kHWjPnwV/hWGV7/kmKLlRf5oXM0kU3O/SWlu3oXuKS6rkzN usJn6lM/Wp5QwrFgYGnGM6xE+tYhUdp4Ix+ev0YQB5+8u9UvEkZSjdMMa+voPMy7p/K6 v7u5uC/WCqmJRweRI/qsu/VD8fX8jnAwy2zhSuQNOD0LTud2SV+SGEuKM9lyjDTeRHub 4/uE1XRMklD6dNviuOZX57x6tMsFH6rkcnRiH7zQycrBLO4x056vMW+POTbGtKK00bl0 gxwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737830432; x=1738435232; 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=eBWH1MICS4p1yX9p6+ZXJDS+Xk35texfmINhOQqzbZjYUczbdoDvMAwg9v8fZnQvzW bqeiH2CtnUjY9zCa+5CdjRJt0bFVacNu36x0sKtbVSwkw4vA8/XwKkPtg8VdT3xmpyLJ Duze6WDgHbTmkACxYkAkOtOzkA3QfrXifskKFC4SW10CXkUfllU6GiEUE9yLKVGJVWsY 1VvwC8zsXG590q+4ebwBLsYSrT1cdhzc/4CZV/eTNUey6kVzPTb6830YdLWUAxp+vBUW v5aJrIfyWQuxEGsqBiEudKXm9X2mzh0+sgW/pB89+pnyto4OeavnQ0Bfw6/q4DZltsaW zKzw== X-Gm-Message-State: AOJu0YzxHDQg6wKmN/IBd3AVs2tn2Bha+NxrvLvcupAKmbikyiftvnGo KJl9KXC6eGZ0ANhn7Xg3kWjF6NmND8Di5Ij7fZtm9Z+839IC1F6VsROszPoRMCllO+cDyQ9Sb9B v X-Gm-Gg: ASbGncvebR1KwYz5kL7dX6gWkJgK5W07p5rP8pOobJLO/AciBUhFsdH1IbeQM/3iKuM oOLmYSltc1coa3g6bwMek7Z6Lt4iplaEtga1x9n5EDHbskDj997TQYn4g2iejGIzTmbnD6NFVXs dEqAQ0m+8bBrAji+xrg/WoKVcBNjJJag18igoWHx5HRP/VpPxJV9dKPK2fqNOvFIHIUX9UHcMq5 BEgge2oeWx8h+oen+fR/80+VX9CO52DNhmL71Sf/Bk9rqsQq/bQw+I/EswWATR7GHdsW9sYlRuf tPk2mlSOrbaTmlmMMoGcCqS6rLLaq7DVh3CHMRHcY52KqAkCboyBaPiHxQ== X-Google-Smtp-Source: AGHT+IF1sf3h9cD+//7RBS3n9AdKVxzzgOJ9088qMFvtOz2X21tH6WlVEamnPP7vyRi2uL16Pm995g== X-Received: by 2002:a05:6a00:1954:b0:72d:8d98:c247 with SMTP id d2e1a72fcca58-72daf9e0b54mr58006035b3a.8.1737830431869; Sat, 25 Jan 2025 10:40:31 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a7614f4sm4100547b3a.97.2025.01.25.10.40.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jan 2025 10:40:31 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Bruce Richardson Subject: [PATCH v6 13/15] telemetry: add allocation function attributes Date: Sat, 25 Jan 2025 10:36:47 -0800 Message-ID: <20250125184010.782330-14-stephen@networkplumber.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250125184010.782330-1-stephen@networkplumber.org> References: <20250120180550.198121-1-stephen@networkplumber.org> <20250125184010.782330-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