net/mlx5: fix flow operation wrapper per OS
authorOphir Munk <ophirmu@nvidia.com>
Mon, 28 Dec 2020 12:32:50 +0000 (14:32 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Jan 2021 15:03:08 +0000 (16:03 +0100)
Wrap glue call dv_create_flow_action_dest_devx_tir() with an OS API.

Fixes: b293fbf9672b ("net/mlx5: add OS specific flow actions operations")
Cc: stable@dpdk.org
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_devx.c

index 7706b3b..6f3b732 100644 (file)
@@ -366,6 +366,32 @@ mlx5_flow_os_create_flow_action_default_miss(void **action)
        return (*action) ? 0 : -1;
 }
 
+/**
+ * Create flow action: dest_devx_tir
+ *
+ * @param[in] tir
+ *   Pointer to DevX tir object
+ * @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_dest_devx_tir(struct mlx5_devx_obj *tir,
+                                             void **action)
+{
+#ifdef HAVE_IBV_FLOW_DV_SUPPORT
+       *action = mlx5_glue->dv_create_flow_action_dest_devx_tir(tir->obj);
+       return (*action) ? 0 : -1;
+#else
+       /* If no DV support - skip the operation and return success */
+       RTE_SET_USED(tir);
+       *action = 0;
+       return 0;
+#endif
+}
+
 /**
  * Destroy flow action.
  *
index 84a5c55..aa8ca7f 100644 (file)
@@ -23,7 +23,7 @@
 #include "mlx5_utils.h"
 #include "mlx5_devx.h"
 #include "mlx5_flow.h"
-
+#include "mlx5_flow_os.h"
 
 /**
  * Modify RQ vlan stripping offload
@@ -942,9 +942,8 @@ mlx5_devx_hrxq_new(struct rte_eth_dev *dev, struct mlx5_hrxq *hrxq,
                goto error;
        }
 #ifdef HAVE_IBV_FLOW_DV_SUPPORT
-       hrxq->action = mlx5_glue->dv_create_flow_action_dest_devx_tir
-                                                              (hrxq->tir->obj);
-       if (!hrxq->action) {
+       if (mlx5_flow_os_create_flow_action_dest_devx_tir(hrxq->tir,
+                                                         &hrxq->action)) {
                rte_errno = errno;
                goto error;
        }