[PATCH v2 15/15] sched: add allocation function attributes
Stephen Hemminger
stephen at networkplumber.org
Wed Jan 22 18:32:59 CET 2025
Use function attributes to catch cases where sched port config
is allocated but not freed correctly.
Signed-off-by: Stephen Hemminger <stephen at 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
More information about the dev
mailing list