[dpdk-dev] [PATCH 18/24] pipeline: introduce custom instructions
Cristian Dumitrescu
cristian.dumitrescu at intel.com
Fri Sep 10 14:29:57 CEST 2021
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 at intel.com>
---
lib/pipeline/rte_swx_pipeline.c | 6 +++++-
lib/pipeline/rte_swx_pipeline_internal.h | 3 +++
2 files changed, 8 insertions(+), 1 deletion(-)
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 {
--
2.17.1
More information about the dev
mailing list