diff mbox series

[09/10] regex/mlx5: prevent QP double setup

Message ID 20211022154600.2180938-9-fkelly@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series [01/10] common/mlx5: update PRM definitions for regex availability | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Francis Kelly Oct. 22, 2021, 3:45 p.m. UTC
From: Ady Agbarih <adypodoman@gmail.com>

When mlx5_regex_qp_setup() is called make sure
 the provided QP is not already setup.

Signed-off-by: Ady Agbarih <adypodoman@gmail.com>
---
 drivers/regex/mlx5/mlx5_regex_control.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Ori Kam Oct. 24, 2021, 1:43 p.m. UTC | #1
> -----Original Message-----
> From: Francis Kelly <fkelly@nvidia.com>
> Sent: Friday, October 22, 2021 6:46 PM
> Subject: [PATCH 09/10] regex/mlx5: prevent QP double setup
> 
> From: Ady Agbarih <adypodoman@gmail.com>
> 
> When mlx5_regex_qp_setup() is called make sure
>  the provided QP is not already setup.
> 
> Signed-off-by: Ady Agbarih <adypodoman@gmail.com>
> ---
>  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 52f66ecce8..17573c2e74 100644
> --- a/drivers/regex/mlx5/mlx5_regex_control.c
> +++ b/drivers/regex/mlx5/mlx5_regex_control.c
> @@ -207,6 +207,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);
>  	/*
> --
> 2.25.1

Acked-by: Ori Kam <orika@nvidia.com>
Best,
Ori
diff mbox series

Patch

diff --git a/drivers/regex/mlx5/mlx5_regex_control.c b/drivers/regex/mlx5/mlx5_regex_control.c
index 52f66ecce8..17573c2e74 100644
--- a/drivers/regex/mlx5/mlx5_regex_control.c
+++ b/drivers/regex/mlx5/mlx5_regex_control.c
@@ -207,6 +207,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);
 	/*