net/mlx5: wrap default miss flow action per OS
authorOphir Munk <ophirmu@nvidia.com>
Mon, 28 Dec 2020 12:32:49 +0000 (14:32 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Jan 2021 15:03:08 +0000 (16:03 +0100)
Wrap glue call dr_create_flow_action_default_miss() with an OS API. This
commit is a follow up on [1].

[1]
commit d4d85aa6f13a ("common/mlx5: add default miss action")
commit b293fbf9672b ("net/mlx5: add OS specific flow actions operations")

Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/linux/mlx5_flow_os.h
drivers/net/mlx5/mlx5_flow_dv.c

index c7003a1..7706b3b 100644 (file)
@@ -350,6 +350,22 @@ mlx5_flow_os_create_flow_action_drop(void **action)
        return (*action) ? 0 : -1;
 }
 
+/**
+ * Create flow action: default miss.
+ *
+ * @param[out] action
+ *   Pointer to a valid action on success, NULL otherwise.
+ *
+ * @return
+ *   0 on success, or -1 on failure and errno is set.
+ */
+static inline int
+mlx5_flow_os_create_flow_action_default_miss(void **action)
+{
+       *action = mlx5_glue->dr_create_flow_action_default_miss();
+       return (*action) ? 0 : -1;
+}
+
 /**
  * Destroy flow action.
  *
index c7845f8..44fdc05 100644 (file)
@@ -8762,11 +8762,13 @@ 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) {
-               cache_resource->default_miss =
-                               mlx5_glue->dr_create_flow_action_default_miss();
-               if (!cache_resource->default_miss) {
+               ret = mlx5_flow_os_create_flow_action_default_miss
+                       (&cache_resource->default_miss);
+               if (!ret) {
                        rte_flow_error_set(error, ENOMEM,
                                                RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
                                                NULL,