[PATCH v6 14/15] sched: add allocation function attributes
Stephen Hemminger
stephen at networkplumber.org
Sat Jan 25 19:36:48 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 | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/lib/sched/rte_sched.h b/lib/sched/rte_sched.h
index 222e6b3583..e98f43072d 100644
--- a/lib/sched/rte_sched.h
+++ b/lib/sched/rte_sched.h
@@ -51,6 +51,7 @@
* queues within same pipe lowest priority traffic class (best-effort).
*/
+#include <rte_common.h>
#include <rte_mbuf.h>
#include <rte_meter.h>
@@ -310,16 +311,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 +323,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