regex/mlx5: forbid changing maximum match number

Added check so user gets error if they try to configure the
nb_max_matches value when using rte_regexdev_configure().

Signed-off-by: Gerry Gribbon <ggribbon@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
This commit is contained in:
Gerry Gribbon 2022-09-01 08:28:02 +00:00 committed by Thomas Monjalon
parent ab74680160
commit 383049f179

View File

@ -293,6 +293,11 @@ mlx5_regex_configure(struct rte_regexdev *dev,
if (priv->prog_mode == MLX5_RXP_MODE_NOT_DEFINED)
return -1;
if (cfg->nb_max_matches != MLX5_REGEX_MAX_MATCHES) {
DRV_LOG(ERR, "nb_max_matches is not configurable.");
rte_errno = EINVAL;
return -rte_errno;
}
priv->nb_queues = cfg->nb_queue_pairs;
dev->data->dev_conf.nb_queue_pairs = priv->nb_queues;
priv->qps = rte_zmalloc(NULL, sizeof(struct mlx5_regex_qp) *