net/mlx5: use global default miss for E-Switch sampling
authorJiawei Wang <jiaweiw@nvidia.com>
Tue, 26 Jan 2021 12:53:33 +0000 (14:53 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 29 Jan 2021 17:16:09 +0000 (18:16 +0100)
In E-Switch steering domain there was dedicated default miss action
created for every sampling flow.
The patch replaces this one with the global default miss action.

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
drivers/net/mlx5/mlx5_flow.h
drivers/net/mlx5/mlx5_flow_dv.c

index 2178a04..e9e3397 100644 (file)
@@ -598,7 +598,6 @@ struct mlx5_flow_dv_sample_resource {
        uint32_t ratio;   /** Sample Ratio */
        uint64_t set_action; /** Restore reg_c0 value */
        void *normal_path_tbl; /** Flow Table pointer */
-       void *default_miss; /** default_miss dr_action. */
        struct mlx5_flow_sub_actions_idx sample_idx;
        /**< Action index resources. */
        struct mlx5_flow_sub_actions_list sample_act;
index 8a948fc..78cae46 100644 (file)
@@ -9149,22 +9149,18 @@ flow_dv_sample_create_cb(struct mlx5_cache_list *list __rte_unused,
                                          "for sample");
                goto error;
        }
-       int ret;
-
        cache_resource->normal_path_tbl = tbl;
        if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB) {
-               ret = mlx5_flow_os_create_flow_action_default_miss
-                       (&cache_resource->default_miss);
-               if (ret) {
+               if (!sh->default_miss_action) {
                        rte_flow_error_set(error, ENOMEM,
                                                RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
                                                NULL,
-                                               "cannot create default miss "
-                                               "action");
+                                               "default miss action was not "
+                                               "created");
                        goto error;
                }
                sample_dv_actions[resource->sample_act.actions_num++] =
-                                               cache_resource->default_miss;
+                                               sh->default_miss_action;
        }
        /* Create a DR sample action */
        sampler_attr.sample_ratio = cache_resource->ratio;
@@ -9184,11 +9180,7 @@ flow_dv_sample_create_cb(struct mlx5_cache_list *list __rte_unused,
        cache_resource->dev = dev;
        return &cache_resource->entry;
 error:
-       if (cache_resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB &&
-           cache_resource->default_miss)
-               claim_zero(mlx5_flow_os_destroy_flow_action
-                               (cache_resource->default_miss));
-       else
+       if (cache_resource->ft_type != MLX5DV_FLOW_TABLE_TYPE_FDB)
                flow_dv_sample_sub_actions_release(dev,
                                                   &cache_resource->sample_idx);
        if (cache_resource->normal_path_tbl)
@@ -11591,11 +11583,6 @@ flow_dv_sample_remove_cb(struct mlx5_cache_list *list __rte_unused,
        if (cache_resource->verbs_action)
                claim_zero(mlx5_flow_os_destroy_flow_action
                                (cache_resource->verbs_action));
-       if (cache_resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB) {
-               if (cache_resource->default_miss)
-                       claim_zero(mlx5_flow_os_destroy_flow_action
-                         (cache_resource->default_miss));
-       }
        if (cache_resource->normal_path_tbl)
                flow_dv_tbl_resource_release(MLX5_SH(dev),
                        cache_resource->normal_path_tbl);