[V2,18/24] pipeline: introduce custom instructions

Message ID 20210910133713.93103-18-cristian.dumitrescu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [V2,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, 1:37 p.m. UTC
  For better performance, the option to create custom instructions when
the program is translated and add them on-the-fly to the pipeline is
now provided. Multiple regular instructions can now be consolidated
into a single C function optimized by the C compiler directly.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/pipeline/rte_swx_pipeline.c          | 6 +++++-
 lib/pipeline/rte_swx_pipeline_internal.h | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)
  

Patch

diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
index 0d02548137..598009c024 100644
--- a/lib/pipeline/rte_swx_pipeline.c
+++ b/lib/pipeline/rte_swx_pipeline.c
@@ -6592,7 +6592,11 @@  instruction_config(struct rte_swx_pipeline *p,
 
 typedef void (*instr_exec_t)(struct rte_swx_pipeline *);
 
-static instr_exec_t instruction_table[] = {
+#ifndef RTE_SWX_PIPELINE_INSTRUCTION_TABLE_SIZE_MAX
+#define RTE_SWX_PIPELINE_INSTRUCTION_TABLE_SIZE_MAX 256
+#endif
+
+static instr_exec_t instruction_table[RTE_SWX_PIPELINE_INSTRUCTION_TABLE_SIZE_MAX] = {
 	[INSTR_RX] = instr_rx_exec,
 	[INSTR_TX] = instr_tx_exec,
 	[INSTR_TX_I] = instr_tx_i_exec,
diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h
index 3578a10501..4ad6dd42dd 100644
--- a/lib/pipeline/rte_swx_pipeline_internal.h
+++ b/lib/pipeline/rte_swx_pipeline_internal.h
@@ -541,6 +541,9 @@  enum instruction_type {
 	 * Return from action
 	 */
 	INSTR_RETURN,
+
+	/* Start of custom instructions. */
+	INSTR_CUSTOM_0,
 };
 
 struct instr_operand {