vhost: remove async batch threshold
[dpdk.git] / lib / pipeline / rte_swx_pipeline_internal.h
index 7a02d6c..1921fdc 100644 (file)
@@ -443,10 +443,12 @@ enum instruction_type {
 
        /* table TABLE */
        INSTR_TABLE,
+       INSTR_TABLE_AF,
        INSTR_SELECTOR,
        INSTR_LEARNER,
+       INSTR_LEARNER_AF,
 
-       /* learn LEARNER ACTION_NAME */
+       /* learn LEARNER ACTION_NAME [ m.action_first_arg ] */
        INSTR_LEARNER_LEARN,
 
        /* forget */
@@ -539,6 +541,9 @@ enum instruction_type {
         * Return from action
         */
        INSTR_RETURN,
+
+       /* Start of custom instructions. */
+       INSTR_CUSTOM_0,
 };
 
 struct instr_operand {
@@ -578,6 +583,7 @@ struct instr_table {
 
 struct instr_learn {
        uint8_t action_id;
+       uint8_t mf_offset;
 };
 
 struct instr_extern_obj {
@@ -684,9 +690,14 @@ struct instruction_data {
        int invalid;
 };
 
+typedef void (*instr_exec_t)(struct rte_swx_pipeline *);
+
 /*
  * Action.
  */
+typedef void
+(*action_func_t)(struct rte_swx_pipeline *p);
+
 struct action {
        TAILQ_ENTRY(action) node;
        char name[RTE_SWX_NAME_SIZE];
@@ -735,6 +746,8 @@ struct table {
        uint32_t n_actions;
        int default_action_is_const;
        uint32_t action_data_size_max;
+       int *action_is_for_table_entries;
+       int *action_is_for_default_entry;
 
        uint32_t size;
        uint32_t id;
@@ -799,12 +812,13 @@ struct learner {
 
        /* Action. */
        struct action **actions;
-       struct field **action_arg;
        struct action *default_action;
        uint8_t *default_action_data;
        uint32_t n_actions;
        int default_action_is_const;
        uint32_t action_data_size_max;
+       int *action_is_for_table_entries;
+       int *action_is_for_default_entry;
 
        uint32_t size;
        uint32_t timeout;
@@ -816,7 +830,6 @@ TAILQ_HEAD(learner_tailq, learner);
 struct learner_runtime {
        void *mailbox;
        uint8_t **key;
-       uint8_t **action_data;
 };
 
 struct learner_statistics {
@@ -1358,6 +1371,10 @@ instr_operand_nbo(struct thread *t, const struct instr_operand *x)
 #define RTE_SWX_PIPELINE_THREADS_MAX 16
 #endif
 
+#ifndef RTE_SWX_PIPELINE_INSTRUCTION_TABLE_SIZE_MAX
+#define RTE_SWX_PIPELINE_INSTRUCTION_TABLE_SIZE_MAX 256
+#endif
+
 struct rte_swx_pipeline {
        struct struct_type_tailq struct_types;
        struct port_in_type_tailq port_in_types;
@@ -1382,6 +1399,7 @@ struct rte_swx_pipeline {
        struct port_in_runtime *in;
        struct port_out_runtime *out;
        struct instruction **action_instructions;
+       action_func_t *action_funcs;
        struct rte_swx_table_state *table_state;
        struct table_statistics *table_stats;
        struct selector_statistics *selector_stats;
@@ -1390,7 +1408,9 @@ struct rte_swx_pipeline {
        struct metarray_runtime *metarray_runtime;
        struct instruction *instructions;
        struct instruction_data *instruction_data;
+       instr_exec_t *instruction_table;
        struct thread threads[RTE_SWX_PIPELINE_THREADS_MAX];
+       void *lib;
 
        uint32_t n_structs;
        uint32_t n_ports_in;
@@ -2000,6 +2020,7 @@ __instr_learn_exec(struct rte_swx_pipeline *p,
                   const struct instruction *ip)
 {
        uint64_t action_id = ip->learn.action_id;
+       uint32_t mf_offset = ip->learn.mf_offset;
        uint32_t learner_id = t->learner_id;
        struct rte_swx_table_state *ts = &t->table_state[p->n_tables +
                p->n_selectors + learner_id];
@@ -2012,7 +2033,7 @@ __instr_learn_exec(struct rte_swx_pipeline *p,
                                           l->mailbox,
                                           t->time,
                                           action_id,
-                                          l->action_data[action_id]);
+                                          &t->metadata[mf_offset]);
 
        TRACE("[Thread %2u] learner %u learn %s\n",
              p->thread_id,