common/mlx5: add send to kernel flow action

Add new glue callback dr_create_flow_action_send_to_kernel.
Default callback invokes mlx5dv_dr_action_create_dest_root_table().

Add static inline mlx5_flow_os_create_flow_action_send_to_kernel(),
which calls dr_create_flow_action_send_to_kernel glue callback.

Define HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE macro if function
mlx5dv_dr_action_create_dest_root_table exists in infiniband/mlx5dv.h

Signed-off-by: Michael Savisko <michaelsav@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
This commit is contained in:
Michael Savisko 2022-10-19 21:40:04 +03:00 committed by Raslan Darawsheh
parent 4df7f801ff
commit 80f998da1d
5 changed files with 67 additions and 0 deletions

View File

@ -213,6 +213,8 @@ has_sym_args = [
'ibv_reg_mr_iova' ],
[ 'HAVE_MLX5_IBV_IMPORT_CTX_PD_AND_MR', 'infiniband/verbs.h',
'ibv_import_device' ],
[ 'HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE', 'infiniband/mlx5dv.h',
'mlx5dv_dr_action_create_dest_root_table' ],
]
if libmtcr_ul_found
has_sym_args += [

View File

@ -1434,6 +1434,21 @@ mlx5_glue_dv_free_pp(struct mlx5dv_pp *pp)
#endif
}
static void *
mlx5_glue_dr_create_flow_action_send_to_kernel(void *tbl, uint16_t priority)
{
#ifdef HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE
struct mlx5dv_dr_table *table = (struct mlx5dv_dr_table *)tbl;
return mlx5dv_dr_action_create_dest_root_table(table, priority);
#else
RTE_SET_USED(tbl);
RTE_SET_USED(priority);
errno = ENOTSUP;
return NULL;
#endif
}
__rte_cache_aligned
const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
.version = MLX5_GLUE_VERSION,
@ -1561,4 +1576,6 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
.dv_free_var = mlx5_glue_dv_free_var,
.dv_alloc_pp = mlx5_glue_dv_alloc_pp,
.dv_free_pp = mlx5_glue_dv_free_pp,
.dr_create_flow_action_send_to_kernel =
mlx5_glue_dr_create_flow_action_send_to_kernel,
};

View File

@ -373,6 +373,8 @@ struct mlx5_glue {
void *(*dv_create_flow_action_aso)
(struct mlx5dv_dr_domain *domain, void *aso_obj,
uint32_t offset, uint32_t flags, uint8_t return_reg_c);
void *(*dr_create_flow_action_send_to_kernel)(void *tbl,
uint16_t priority);
};
extern const struct mlx5_glue *mlx5_glue;

View File

@ -368,6 +368,28 @@ mlx5_flow_os_create_flow_action_default_miss(void **action)
return (*action) ? 0 : -1;
}
/**
* Create flow action: send_to_kernel.
*
* @param[in] tbl
* Pointer to destination root table.
* @param[in] priority
* Priority to which traffic will arrive.
* @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_send_to_kernel(void *tbl, uint16_t priority,
void **action)
{
*action = mlx5_glue->dr_create_flow_action_send_to_kernel(tbl,
priority);
return (*action) ? 0 : -1;
}
/**
* Create flow action: dest_devx_tir
*

View File

@ -326,6 +326,30 @@ mlx5_flow_os_create_flow_action_default_miss(void **action)
return 0;
}
/**
* Create flow action: send_to_kernel.
*
* @param[in] tbl
* Pointer to destination root table.
* @param[in] priority
* Priority to which traffic will arrive.
* @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_send_to_kernel(void *tbl, uint16_t priority,
void **action)
{
RTE_SET_USED(tbl);
RTE_SET_USED(priority);
*action = NULL;
rte_errno = ENOTSUP;
return -rte_errno;
}
/**
* Create flow action: sampler
*