[PATCH v5 12/16] reorder: add allocation function attributes
Stephen Hemminger
stephen at networkplumber.org
Sat Jan 25 03:11:25 CET 2025
Use function attributes to catch cases where reorder table is allocated
but not freed correctly.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Volodymyr Fialko <vfialko at marvell.com>
---
lib/reorder/rte_reorder.h | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/lib/reorder/rte_reorder.h b/lib/reorder/rte_reorder.h
index 56a6507f9f..1c8c1d5079 100644
--- a/lib/reorder/rte_reorder.h
+++ b/lib/reorder/rte_reorder.h
@@ -14,6 +14,7 @@
* sequence number present in mbuf.
*/
+#include <rte_common.h>
#include <rte_compat.h>
#include <rte_mbuf.h>
#include <rte_mbuf_dyn.h>
@@ -44,6 +45,16 @@ rte_reorder_seqn(struct rte_mbuf *mbuf)
rte_reorder_seqn_t *);
}
+/**
+ * Free reorder buffer instance.
+ *
+ * @param b
+ * Pointer to reorder buffer instance.
+ * If b is NULL, no operation is performed.
+ */
+void
+rte_reorder_free(struct rte_reorder_buffer *b);
+
/**
* Create a new reorder buffer instance
*
@@ -64,7 +75,8 @@ rte_reorder_seqn(struct rte_mbuf *mbuf)
* - EINVAL - invalid parameters
*/
struct rte_reorder_buffer *
-rte_reorder_create(const char *name, unsigned socket_id, unsigned int size);
+rte_reorder_create(const char *name, unsigned int socket_id, unsigned int size)
+ __rte_malloc __rte_dealloc(rte_reorder_free, 1);
/**
* Initializes given reorder buffer instance
@@ -111,16 +123,6 @@ rte_reorder_find_existing(const char *name);
void
rte_reorder_reset(struct rte_reorder_buffer *b);
-/**
- * Free reorder buffer instance.
- *
- * @param b
- * Pointer to reorder buffer instance.
- * If b is NULL, no operation is performed.
- */
-void
-rte_reorder_free(struct rte_reorder_buffer *b);
-
/**
* Insert given mbuf in reorder buffer in its correct position
*
--
2.45.2
More information about the dev
mailing list