Skip to content

Commit

Permalink
net/mlx5: fix flow operation wrapper per OS
Browse files Browse the repository at this point in the history
[ upstream commit 8801972 ]

Wrap glue call dv_create_flow_action_dest_devx_tir() with an OS API.

Fixes: b293fbf ("net/mlx5: add OS specific flow actions operations")

Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
  • Loading branch information
OphirMunk authored and bluca committed Feb 2, 2021
1 parent a49c923 commit 6cb2325
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
26 changes: 26 additions & 0 deletions drivers/net/mlx5/linux/mlx5_flow_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,32 @@ mlx5_flow_os_create_flow_action_drop(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.
*
Expand Down
7 changes: 3 additions & 4 deletions drivers/net/mlx5/mlx5_devx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 6cb2325

Please sign in to comment.