regex/mlx5: prevent double setup of queue pair
authorAdy Agbarih <adypodoman@gmail.com>
Fri, 22 Oct 2021 15:45:59 +0000 (15:45 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 3 Nov 2021 22:15:10 +0000 (23:15 +0100)
When mlx5_regex_qp_setup() is called, make sure
the provided QP is not already setup.

Signed-off-by: Ady Agbarih <adypodoman@gmail.com>
Acked-by: Ori Kam <orika@nvidia.com>
drivers/regex/mlx5/mlx5_regex_control.c

index 6a03275..6b3fe6b 100644 (file)
@@ -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);
        /*