[02/24] pipeline: move thread inline functions to header file

Message ID 20210910123003.85448-2-cristian.dumitrescu@intel.com (mailing list archive)
State Superseded, archived
Headers
Series [01/24] pipeline: move data structures to internal header file |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Cristian Dumitrescu Sept. 10, 2021, 12:29 p.m. UTC
  Move the thread inline functions to the internal header file.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/pipeline/rte_swx_pipeline.c          | 56 ----------------------
 lib/pipeline/rte_swx_pipeline_internal.h | 59 ++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 56 deletions(-)
  

Patch

diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
index ae9b2056db..7e01453c27 100644
--- a/lib/pipeline/rte_swx_pipeline.c
+++ b/lib/pipeline/rte_swx_pipeline.c
@@ -1492,62 +1492,6 @@  struct_field_parse(struct rte_swx_pipeline *p,
 	}
 }
 
-static inline void
-pipeline_port_inc(struct rte_swx_pipeline *p)
-{
-	p->port_id = (p->port_id + 1) & (p->n_ports_in - 1);
-}
-
-static inline void
-thread_ip_reset(struct rte_swx_pipeline *p, struct thread *t)
-{
-	t->ip = p->instructions;
-}
-
-static inline void
-thread_ip_set(struct thread *t, struct instruction *ip)
-{
-	t->ip = ip;
-}
-
-static inline void
-thread_ip_action_call(struct rte_swx_pipeline *p,
-		      struct thread *t,
-		      uint32_t action_id)
-{
-	t->ret = t->ip + 1;
-	t->ip = p->action_instructions[action_id];
-}
-
-static inline void
-thread_ip_inc(struct rte_swx_pipeline *p);
-
-static inline void
-thread_ip_inc(struct rte_swx_pipeline *p)
-{
-	struct thread *t = &p->threads[p->thread_id];
-
-	t->ip++;
-}
-
-static inline void
-thread_ip_inc_cond(struct thread *t, int cond)
-{
-	t->ip += cond;
-}
-
-static inline void
-thread_yield(struct rte_swx_pipeline *p)
-{
-	p->thread_id = (p->thread_id + 1) & (RTE_SWX_PIPELINE_THREADS_MAX - 1);
-}
-
-static inline void
-thread_yield_cond(struct rte_swx_pipeline *p, int cond)
-{
-	p->thread_id = (p->thread_id + cond) & (RTE_SWX_PIPELINE_THREADS_MAX - 1);
-}
-
 /*
  * rx.
  */
diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h
index 5d80dd8451..682f4c86a0 100644
--- a/lib/pipeline/rte_swx_pipeline_internal.h
+++ b/lib/pipeline/rte_swx_pipeline_internal.h
@@ -1380,4 +1380,63 @@  struct rte_swx_pipeline {
 	int numa_node;
 };
 
+/*
+ * Instruction.
+ */
+static inline void
+pipeline_port_inc(struct rte_swx_pipeline *p)
+{
+	p->port_id = (p->port_id + 1) & (p->n_ports_in - 1);
+}
+
+static inline void
+thread_ip_reset(struct rte_swx_pipeline *p, struct thread *t)
+{
+	t->ip = p->instructions;
+}
+
+static inline void
+thread_ip_set(struct thread *t, struct instruction *ip)
+{
+	t->ip = ip;
+}
+
+static inline void
+thread_ip_action_call(struct rte_swx_pipeline *p,
+		      struct thread *t,
+		      uint32_t action_id)
+{
+	t->ret = t->ip + 1;
+	t->ip = p->action_instructions[action_id];
+}
+
+static inline void
+thread_ip_inc(struct rte_swx_pipeline *p);
+
+static inline void
+thread_ip_inc(struct rte_swx_pipeline *p)
+{
+	struct thread *t = &p->threads[p->thread_id];
+
+	t->ip++;
+}
+
+static inline void
+thread_ip_inc_cond(struct thread *t, int cond)
+{
+	t->ip += cond;
+}
+
+static inline void
+thread_yield(struct rte_swx_pipeline *p)
+{
+	p->thread_id = (p->thread_id + 1) & (RTE_SWX_PIPELINE_THREADS_MAX - 1);
+}
+
+static inline void
+thread_yield_cond(struct rte_swx_pipeline *p, int cond)
+{
+	p->thread_id = (p->thread_id + cond) & (RTE_SWX_PIPELINE_THREADS_MAX - 1);
+}
+
 #endif