From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 034AB4601A;
	Mon, 20 Jan 2025 19:07:40 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 89A35427D5;
	Mon, 20 Jan 2025 19:06:19 +0100 (CET)
Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com
 [209.85.214.179])
 by mails.dpdk.org (Postfix) with ESMTP id 5AA88427A3
 for <dev@dpdk.org>; Mon, 20 Jan 2025 19:06:12 +0100 (CET)
Received: by mail-pl1-f179.google.com with SMTP id
 d9443c01a7336-2165448243fso103037425ad.1
 for <dev@dpdk.org>; Mon, 20 Jan 2025 10:06:12 -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=cVz7fv3oNzmZPVy7o5StuGHJ1iJvgRwNcuan4/jHY1M=;
 b=yDzBPxPNW72jV7eTQfNWT9kLpDP4b23ZUUikpB5/w0akrrYOgIRkxDEc9FZWZ0L0aO
 3HSct42D6YlD/XeF1o3CqNGsQZjSM/+ZFTaGr8lhDNlpWiSAbUnQhuZtEa5vi882QYdE
 g92MLMEJdOAV8ZzneUrFzlFYiUFBEXZFgMxRd1+bLt7IrR0Yfyy0kwjT9DwxVpzEz6a2
 q8IW2yNzak7ofP0cAEzgF1/1CMJMqdgjarlV/px2yWLbqn+k5jK2tJdCtgG+bAPYxOvm
 wib+2iu9jXI/lh1WtjKD/b2koQ8Ei2gRLEaw8T2MUOAD+NXTWwhuZbqAaJJDIKPR92av
 tvVA==
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=cVz7fv3oNzmZPVy7o5StuGHJ1iJvgRwNcuan4/jHY1M=;
 b=HUyDxNzBQKN9G9XxGrmM5pKJ0F6UuGAXW20+x4T5w1zExSk12dlzQLc89tRj9QZETJ
 WuyexWSY1zuH8Wf99ReR7SY8XQELkBwtYAMKdIu7FChsk8rLlNO9M+MY3LX1FY9quhAs
 C1n6tkuFioGt3KT80vUC+E4AnEWYNxPG7HAX2cav21dCXIMV3eipqFoMjn+WJdbKDogt
 a4D7/rDpp/CV7UEr9wTfiQshuaix2pO39lhIndBwPZE39vfNNkuPLPo+sCcpnegItv7J
 bJFmAP8Qm11FNVa26v4oGdc+kMMFT8UYCW3vSwnZSiPoJobBG7zrjaKBHU3y6z+ccjuO
 LgzA==
X-Gm-Message-State: AOJu0YwQIaqT37bKLj2ykayFclvKYm1WpnbiZ/+ImdIWJ9yyoDO1zlRx
 j96cuQhwHPIv9jj2OpfXbvLzvmSSKKLWOy8TZ4o4AfA4AEpZwkLILCVMXP939evzLIh2FTWt7mT
 x
X-Gm-Gg: ASbGnctjTgOHhcUpLDvPO771h8ULl4GQMJKlTFByhFgOL5Sj9EPpfFWyZndAw8AmPhp
 auGBDQrjj2FUEHNspw/U1MgkVHyhvYJ2/SWcoYO2RrzHElfKM+qkXWraBvDmrn5Gis9zELshhSF
 MTzGIK9vBs1gzfhnhh5ThIe0bSEs0uIXvZAt0r1KOux7zUZNUP163auMrF/zNaARxkNVeLNIPfZ
 DMD5dndlsQa2df9GLEiXt+6L6v7xMjHyG7+P6GGEtjvEu4nnnXokp7dcWSCjk61ras+79cR0LWt
 iRfDd60qJNYorgFURdEzmgLFXbvLUUaRjnTwyidmZSg9z0g=
X-Google-Smtp-Source: AGHT+IE7kMZ+owPyuah1gO6xciN6Lk4JW72dzbZtrwB6g8swdLYZ3pAaURXrY9F0JCT0Rk06U59vIQ==
X-Received: by 2002:a05:6a20:7343:b0:1e1:b44f:cfef with SMTP id
 adf61e73a8af0-1eb21481025mr20463256637.17.1737396371585; 
 Mon, 20 Jan 2025 10:06:11 -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.11
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 20 Jan 2025 10:06:11 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
 Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Subject: [PATCH 15/15] sched: add allocation function attributes
Date: Mon, 20 Jan 2025 10:03:33 -0800
Message-ID: <20250120180550.198121-16-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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Use function attributes to catch cases where sched port config
is allocated but not freed correctly.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/sched/rte_sched.h | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/lib/sched/rte_sched.h b/lib/sched/rte_sched.h
index 222e6b3583..7ae570aa1b 100644
--- a/lib/sched/rte_sched.h
+++ b/lib/sched/rte_sched.h
@@ -310,16 +310,7 @@ struct rte_sched_port_params {
  * Configuration
  */
 
-/**
- * Hierarchical scheduler port configuration
- *
- * @param params
- *   Port scheduler configuration parameter structure
- * @return
- *   Handle to port scheduler instance upon success or NULL otherwise.
- */
-struct rte_sched_port *
-rte_sched_port_config(struct rte_sched_port_params *params);
+struct rte_sched_port;
 
 /**
  * Hierarchical scheduler port free
@@ -331,6 +322,18 @@ rte_sched_port_config(struct rte_sched_port_params *params);
 void
 rte_sched_port_free(struct rte_sched_port *port);
 
+/**
+ * Hierarchical scheduler port configuration
+ *
+ * @param params
+ *   Port scheduler configuration parameter structure
+ * @return
+ *   Handle to port scheduler instance upon success or NULL otherwise.
+ */
+struct rte_sched_port *
+rte_sched_port_config(struct rte_sched_port_params *params)
+	__rte_malloc __rte_dealloc(rte_sched_port_free, 1);
+
 /**
  * Hierarchical scheduler pipe profile add
  *
-- 
2.45.2