bus/pci: fix use after free on unplug
[dpdk.git] / lib / pipeline / rte_swx_pipeline_internal.h
index 64625b4..1921fdc 100644 (file)
@@ -448,7 +448,7 @@ enum instruction_type {
        INSTR_LEARNER,
        INSTR_LEARNER_AF,
 
-       /* learn LEARNER ACTION_NAME */
+       /* learn LEARNER ACTION_NAME [ m.action_first_arg ] */
        INSTR_LEARNER_LEARN,
 
        /* forget */
@@ -583,6 +583,7 @@ struct instr_table {
 
 struct instr_learn {
        uint8_t action_id;
+       uint8_t mf_offset;
 };
 
 struct instr_extern_obj {
@@ -745,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;
@@ -809,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;
@@ -826,7 +830,6 @@ TAILQ_HEAD(learner_tailq, learner);
 struct learner_runtime {
        void *mailbox;
        uint8_t **key;
-       uint8_t **action_data;
 };
 
 struct learner_statistics {
@@ -1407,6 +1410,7 @@ struct rte_swx_pipeline {
        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;
@@ -2016,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];
@@ -2028,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,