regex/mlx5: add check for nb max matches

Message ID 20220901082802.2434855-1-ggribbon@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series regex/mlx5: add check for nb max matches |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS

Commit Message

Gerry Gribbon Sept. 1, 2022, 8:28 a.m. UTC
  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>
---
 drivers/regex/mlx5/mlx5_rxp.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Thomas Monjalon Oct. 9, 2022, 2:35 p.m. UTC | #1
01/09/2022 10:28, Gerry Gribbon:
> 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>

Applied, thanks.

Note the more explicit title on merge:
regex/mlx5: forbid changing maximum match number
  

Patch

diff --git a/drivers/regex/mlx5/mlx5_rxp.c b/drivers/regex/mlx5/mlx5_rxp.c
index ed3af15e40..47d32b7dd7 100644
--- a/drivers/regex/mlx5/mlx5_rxp.c
+++ b/drivers/regex/mlx5/mlx5_rxp.c
@@ -144,6 +144,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) *