From b5832a0d1524b31782eb04a6e8f95f952a7eed66 Mon Sep 17 00:00:00 2001 From: Ady Agbarih Date: Fri, 22 Oct 2021 15:45:59 +0000 Subject: [PATCH] regex/mlx5: prevent double setup of queue pair When mlx5_regex_qp_setup() is called, make sure the provided QP is not already setup. Signed-off-by: Ady Agbarih Acked-by: Ori Kam --- drivers/regex/mlx5/mlx5_regex_control.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c index 6a032755ac..6b3fe6b722 100644 --- a/drivers/regex/mlx5/mlx5_regex_control.c +++ b/drivers/regex/mlx5/mlx5_regex_control.c @@ -204,6 +204,12 @@ mlx5_regex_qp_setup(struct rte_regexdev *dev, uint16_t qp_ind, uint16_t log_desc; qp = &priv->qps[qp_ind]; + if (qp->jobs) { + DRV_LOG(ERR, "Attempting to setup QP a second time."); + rte_errno = EINVAL; + return -rte_errno; + } + qp->flags = cfg->qp_conf_flags; log_desc = rte_log2_u32(cfg->nb_desc); /*