net/mlx5: make header reformat action thread safe
[dpdk.git] / drivers / net / mlx5 / linux / mlx5_os.c
index db32b39..d017c23 100644 (file)
@@ -239,29 +239,42 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv)
        /* Create tags hash list table. */
        snprintf(s, sizeof(s), "%s_tags", sh->ibdev_name);
        sh->tag_table = mlx5_hlist_create(s, MLX5_TAGS_HLIST_ARRAY_SIZE, 0,
-                                         0, NULL, NULL, NULL);
+                                         MLX5_HLIST_WRITE_MOST,
+                                         flow_dv_tag_create_cb, NULL,
+                                         flow_dv_tag_remove_cb);
        if (!sh->tag_table) {
                DRV_LOG(ERR, "tags with hash creation failed.");
                err = ENOMEM;
                goto error;
        }
+       sh->tag_table->ctx = sh;
        snprintf(s, sizeof(s), "%s_hdr_modify", sh->ibdev_name);
        sh->modify_cmds = mlx5_hlist_create(s, MLX5_FLOW_HDR_MODIFY_HTABLE_SZ,
-                                           0, 0, NULL, NULL, NULL);
+                                           0, MLX5_HLIST_WRITE_MOST |
+                                           MLX5_HLIST_DIRECT_KEY,
+                                           flow_dv_modify_create_cb,
+                                           flow_dv_modify_match_cb,
+                                           flow_dv_modify_remove_cb);
        if (!sh->modify_cmds) {
                DRV_LOG(ERR, "hdr modify hash creation failed");
                err = ENOMEM;
                goto error;
        }
+       sh->modify_cmds->ctx = sh;
        snprintf(s, sizeof(s), "%s_encaps_decaps", sh->ibdev_name);
        sh->encaps_decaps = mlx5_hlist_create(s,
                                              MLX5_FLOW_ENCAP_DECAP_HTABLE_SZ,
-                                             0, 0, NULL, NULL, NULL);
+                                             0, MLX5_HLIST_DIRECT_KEY |
+                                             MLX5_HLIST_WRITE_MOST,
+                                             flow_dv_encap_decap_create_cb,
+                                             flow_dv_encap_decap_match_cb,
+                                             flow_dv_encap_decap_remove_cb);
        if (!sh->encaps_decaps) {
                DRV_LOG(ERR, "encap decap hash creation failed");
                err = ENOMEM;
                goto error;
        }
+       sh->encaps_decaps->ctx = sh;
 #endif
 #ifdef HAVE_MLX5DV_DR
        void *domain;
@@ -1480,11 +1493,14 @@ err_secondary:
                priv->mreg_cp_tbl = mlx5_hlist_create(MLX5_FLOW_MREG_HNAME,
                                                      MLX5_FLOW_MREG_HTABLE_SZ,
                                                      0, 0,
-                                                     NULL, NULL, NULL);
+                                                     flow_dv_mreg_create_cb,
+                                                     NULL,
+                                                     flow_dv_mreg_remove_cb);
                if (!priv->mreg_cp_tbl) {
                        err = ENOMEM;
                        goto error;
                }
+               priv->mreg_cp_tbl->ctx = eth_dev;
        }
        mlx5_flow_counter_mode_config(eth_dev);
        return eth_dev;