common/mlx5: update regex DevX commands

This patch modifies the SET_REGEXP_PARAMS DevX command as follows:

Remove DB setup DevX command. The command is no longer needed
in DPDK, it will always be invoked by the regex-daemon.

Add new DevX command, for programming ROF rules for a specific engine.
The command takes as an input an mkey of the ROF.
It also introduces a new field_select bit.

Signed-off-by: Ady Agbarih <adypodoman@gmail.com>
Acked-by: Ori Kam <orika@nvidia.com>
This commit is contained in:
Ady Agbarih 2021-10-22 15:45:53 +00:00 committed by Thomas Monjalon
parent fe37533668
commit 1663c1405a
5 changed files with 21 additions and 47 deletions

View File

@ -3710,17 +3710,20 @@ struct mlx5_ifc_parse_graph_flex_out_bits {
};
struct regexp_params_field_select_bits {
u8 reserved_at_0[0x1e];
u8 reserved_at_0[0x1d];
u8 rof_mkey[0x1];
u8 stop_engine[0x1];
u8 db_umem_id[0x1];
u8 reserved_at_1f[0x1];
};
struct mlx5_ifc_regexp_params_bits {
u8 reserved_at_0[0x1f];
u8 stop_engine[0x1];
u8 db_umem_id[0x20];
u8 db_umem_offset[0x40];
u8 reserved_at_80[0x100];
u8 reserved_at_20[0x60];
u8 rof_mkey[0x20];
u8 rof_size[0x20];
u8 rof_mkey_va[0x40];
u8 reserved_at_100[0x80];
};
struct mlx5_ifc_set_regexp_params_in_bits {

View File

@ -53,12 +53,9 @@ mlx5_regex_stop(struct rte_regexdev *dev __rte_unused)
rte_free(priv->qps);
priv->qps = NULL;
for (i = 0; i < (priv->nb_engines + MLX5_RXP_EM_COUNT); i++) {
if (priv->db[i].umem.umem)
mlx5_glue->devx_umem_dereg(priv->db[i].umem.umem);
rte_free(priv->db[i].ptr);
priv->db[i].ptr = NULL;
}
for (i = 0; i < priv->nb_engines; i++)
/* Stop engine. */
mlx5_devx_regex_database_stop(priv->cdev->ctx, i);
return 0;
}

View File

@ -94,8 +94,8 @@ int mlx5_devx_regex_register_read(struct ibv_context *ctx, int engine_id,
uint32_t addr, uint32_t *data);
int mlx5_devx_regex_database_stop(void *ctx, uint8_t engine);
int mlx5_devx_regex_database_resume(void *ctx, uint8_t engine);
int mlx5_devx_regex_database_program(void *ctx, uint8_t engine,
uint32_t umem_id, uint64_t umem_offset);
int mlx5_devx_regex_rules_program(void *ctx, uint8_t engine, uint32_t rof_mkey,
uint32_t rof_size, uint64_t db_mkey_offset);
/* mlx5_regex_control.c */
int mlx5_regex_qp_setup(struct rte_regexdev *dev, uint16_t qp_ind,

View File

@ -103,8 +103,8 @@ mlx5_devx_regex_database_resume(void *ctx, uint8_t engine)
}
int
mlx5_devx_regex_database_program(void *ctx, uint8_t engine, uint32_t umem_id,
uint64_t umem_offset)
mlx5_devx_regex_rules_program(void *ctx, uint8_t engine, uint32_t rof_mkey,
uint32_t rof_size, uint64_t rof_mkey_va)
{
uint32_t out[MLX5_ST_SZ_DW(set_regexp_params_out)] = {0};
uint32_t in[MLX5_ST_SZ_DW(set_regexp_params_in)] = {0};
@ -112,14 +112,15 @@ mlx5_devx_regex_database_program(void *ctx, uint8_t engine, uint32_t umem_id,
MLX5_SET(set_regexp_params_in, in, opcode, MLX5_CMD_SET_REGEX_PARAMS);
MLX5_SET(set_regexp_params_in, in, engine_id, engine);
MLX5_SET(set_regexp_params_in, in, regexp_params.db_umem_id, umem_id);
MLX5_SET64(set_regexp_params_in, in, regexp_params.db_umem_offset,
umem_offset);
MLX5_SET(set_regexp_params_in, in, field_select.db_umem_id, 1);
MLX5_SET(set_regexp_params_in, in, regexp_params.rof_mkey, rof_mkey);
MLX5_SET(set_regexp_params_in, in, regexp_params.rof_size, rof_size);
MLX5_SET64(set_regexp_params_in, in, regexp_params.rof_mkey_va,
rof_mkey_va);
MLX5_SET(set_regexp_params_in, in, field_select.rof_mkey, 1);
ret = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out,
sizeof(out));
if (ret) {
DRV_LOG(ERR, "Database program failed %d", ret);
DRV_LOG(ERR, "Rules program failed %d", ret);
rte_errno = errno;
return -errno;
}

View File

@ -33,8 +33,6 @@ rxp_poll_csr_for_value(struct ibv_context *ctx, uint32_t *value,
uint32_t address, uint32_t expected_value,
uint32_t expected_mask, uint32_t timeout_ms, uint8_t id);
static int
mlnx_set_database(struct mlx5_regex_priv *priv, uint8_t id, uint8_t db_to_use);
static int
mlnx_resume_database(struct mlx5_regex_priv *priv, uint8_t id);
static int
mlnx_update_database(struct mlx5_regex_priv *priv, uint8_t id);
@ -488,11 +486,6 @@ rxp_program_rof(struct mlx5_regex_priv *priv, const char *buf, uint32_t len,
}
}
ret = mlnx_set_database(priv, id, db_free);
if (ret < 0) {
DRV_LOG(ERR, "Failed to register db memory!");
goto parse_error;
}
rte_free(tmp);
return 0;
parse_error:
@ -500,26 +493,6 @@ rxp_program_rof(struct mlx5_regex_priv *priv, const char *buf, uint32_t len,
return ret;
}
static int
mlnx_set_database(struct mlx5_regex_priv *priv, uint8_t id, uint8_t db_to_use)
{
int ret;
uint32_t umem_id;
ret = mlx5_devx_regex_database_stop(priv->cdev->ctx, id);
if (ret < 0) {
DRV_LOG(ERR, "stop engine failed!");
return ret;
}
umem_id = mlx5_os_get_umem_id(priv->db[db_to_use].umem.umem);
ret = mlx5_devx_regex_database_program(priv->cdev->ctx, id, umem_id, 0);
if (ret < 0) {
DRV_LOG(ERR, "program db failed!");
return ret;
}
return 0;
}
static int
mlnx_resume_database(struct mlx5_regex_priv *priv, uint8_t id)
{