[22/35] net/mlx5/linux: add OS default miss flow action

Message ID 20201217173037.11396-23-talshn@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series mlx5 Windows support - part #6 |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tal Shnaiderman Dec. 17, 2020, 5:30 p.m. UTC
  From: Ophir Munk <ophirmu@nvidia.com>

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 | 16 ++++++++++++++++
 drivers/net/mlx5/mlx5_flow_dv.c       |  8 +++++---
 2 files changed, 21 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/net/mlx5/linux/mlx5_flow_os.h b/drivers/net/mlx5/linux/mlx5_flow_os.h
index c7003a194e..7706b3be48 100644
--- a/drivers/net/mlx5/linux/mlx5_flow_os.h
+++ b/drivers/net/mlx5/linux/mlx5_flow_os.h
@@ -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.
  *
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 40c8e54a09..6d377b6dab 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -8763,11 +8763,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,