[PATCH v12 1/7] graph: add API to override node process function
Nitin Saxena
nsaxena at marvell.com
Thu Jun 5 19:33:06 CEST 2025
New internal API used by feature arc library to override node's original
process() func.
Signed-off-by: Nitin Saxena <nsaxena at marvell.com>
---
lib/graph/graph_private.h | 11 +++++++++++
lib/graph/node.c | 22 ++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h
index 813dd78b9d..579546e658 100644
--- a/lib/graph/graph_private.h
+++ b/lib/graph/graph_private.h
@@ -198,6 +198,17 @@ struct node_head *node_list_head_get(void);
*/
struct node *node_from_name(const char *name);
+/**
+ * @internal
+ *
+ * Override process func of a node.
+ *
+ * @return
+ * - 0: Success.
+ * - <0: Error
+ */
+int node_override_process_func(rte_node_t id, rte_node_process_t process);
+
/* Graph list functions */
STAILQ_HEAD(graph_head, graph);
diff --git a/lib/graph/node.c b/lib/graph/node.c
index 101981ec24..be53c701c7 100644
--- a/lib/graph/node.c
+++ b/lib/graph/node.c
@@ -431,3 +431,25 @@ rte_node_max_count(void)
{
return node_id;
}
+
+int
+node_override_process_func(rte_node_t id, rte_node_process_t process)
+{
+ struct node *node;
+
+ NODE_ID_CHECK(id);
+ graph_spinlock_lock();
+
+ STAILQ_FOREACH(node, &node_list, next) {
+ if (node->id == id) {
+ node->process = process;
+ graph_spinlock_unlock();
+ return 0;
+ }
+ }
+
+ graph_spinlock_unlock();
+
+fail:
+ return -1;
+}
--
2.43.0
More information about the dev
mailing list