The RegEx engine is using HW resources that may reach some limit for different reasons. In current API the RegEx can report only on max threads reached. This commit introduce a new flag to report to the app that some HW resource limit has been reached. Ori Kam (2): regexdev: add resource limit reached rsp flag regex/mlx5: add regex response flags drivers/regex/mlx5/mlx5_regex_fastpath.c | 23 ++++++++++++++++++++++- lib/librte_regexdev/rte_regexdev.h | 5 +++++ 2 files changed, 27 insertions(+), 1 deletion(-) -- 2.25.1
When scanning a buffer it is possible that the scan will abort due to some internal resource limit. This commit adds such response flag, so application can handle such cases. Signed-off-by: Francis Kelly <fkelly@nvidia.com> Signed-off-by: Ori Kam <orika@nvidia.com> --- lib/librte_regexdev/rte_regexdev.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/librte_regexdev/rte_regexdev.h b/lib/librte_regexdev/rte_regexdev.h index 0001658925..86f0b231b0 100644 --- a/lib/librte_regexdev/rte_regexdev.h +++ b/lib/librte_regexdev/rte_regexdev.h @@ -1333,6 +1333,11 @@ struct rte_regexdev_match { * @see RTE_REGEXDEV_ATTR_MAX_PREFIX */ +#define RTE_REGEX_OPS_RSP_RESOURCE_LIMIT_REACHED_F (1 << 4) +/**< Indicates that the RegEx device has reached the max allowed resource + * allowed while scanning the given buffer. + */ + /** * The generic *rte_regex_ops* structure to hold the RegEx attributes * for enqueue and dequeue operation. -- 2.25.1
This commit propagate the response flags from the regex engine. Signed-off-by: Francis Kelly <fkelly@nvidia.com> Signed-off-by: Ori Kam <orika@nvidia.com> --- drivers/regex/mlx5/mlx5_regex_fastpath.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/regex/mlx5/mlx5_regex_fastpath.c b/drivers/regex/mlx5/mlx5_regex_fastpath.c index ee72f89c99..593b7d183a 100644 --- a/drivers/regex/mlx5/mlx5_regex_fastpath.c +++ b/drivers/regex/mlx5/mlx5_regex_fastpath.c @@ -209,7 +209,10 @@ mlx5_regexdev_enqueue(struct rte_regexdev *dev, uint16_t qp_id, static inline void extract_result(struct rte_regex_ops *op, struct mlx5_regex_job *job) { - size_t j, offset; + size_t j; + size_t offset; + uint16_t status; + op->user_id = job->user_id; op->nb_matches = MLX5_GET_VOLATILE(regexp_metadata, job->metadata + MLX5_REGEX_METADATA_OFF, @@ -230,6 +233,24 @@ extract_result(struct rte_regex_ops *op, struct mlx5_regex_job *job) MLX5_GET_VOLATILE(regexp_match_tuple, (job->output + offset), length); } + status = MLX5_GET_VOLATILE(regexp_metadata, job->metadata + + MLX5_REGEX_METADATA_OFF, + status); + op->rsp_flags = 0; + if (status & MLX5_RXP_RESP_STATUS_PMI_SOJ) + op->rsp_flags |= RTE_REGEX_OPS_RSP_PMI_SOJ_F; + if (status & MLX5_RXP_RESP_STATUS_PMI_EOJ) + op->rsp_flags |= RTE_REGEX_OPS_RSP_PMI_EOJ_F; + if (status & MLX5_RXP_RESP_STATUS_MAX_LATENCY) + op->rsp_flags |= RTE_REGEX_OPS_RSP_MAX_SCAN_TIMEOUT_F; + if (status & MLX5_RXP_RESP_STATUS_MAX_MATCH) + op->rsp_flags |= RTE_REGEX_OPS_RSP_MAX_MATCH_F; + if (status & MLX5_RXP_RESP_STATUS_MAX_PREFIX) + op->rsp_flags |= RTE_REGEX_OPS_RSP_MAX_PREFIX_F; + if (status & MLX5_RXP_RESP_STATUS_MAX_PRI_THREADS) + op->rsp_flags |= RTE_REGEX_OPS_RSP_RESOURCE_LIMIT_REACHED_F; + if (status & MLX5_RXP_RESP_STATUS_MAX_SEC_THREADS) + op->rsp_flags |= RTE_REGEX_OPS_RSP_RESOURCE_LIMIT_REACHED_F; } static inline volatile struct mlx5_cqe * -- 2.25.1
Hi
I would very much like a review for this patch.
Thank you,
Ori
> -----Original Message-----
> From: Ori Kam <orika@nvidia.com>
> Sent: Thursday, December 17, 2020 12:38 PM
> Subject: [PATCH 1/2] regexdev: add resource limit reached rsp flag
>
> When scanning a buffer it is possible that the scan will abort
> due to some internal resource limit.
>
> This commit adds such response flag, so application can handle such cases.
>
> Signed-off-by: Francis Kelly <fkelly@nvidia.com>
> Signed-off-by: Ori Kam <orika@nvidia.com>
> ---
> lib/librte_regexdev/rte_regexdev.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/lib/librte_regexdev/rte_regexdev.h
> b/lib/librte_regexdev/rte_regexdev.h
> index 0001658925..86f0b231b0 100644
> --- a/lib/librte_regexdev/rte_regexdev.h
> +++ b/lib/librte_regexdev/rte_regexdev.h
> @@ -1333,6 +1333,11 @@ struct rte_regexdev_match {
> * @see RTE_REGEXDEV_ATTR_MAX_PREFIX
> */
>
> +#define RTE_REGEX_OPS_RSP_RESOURCE_LIMIT_REACHED_F (1 << 4)
> +/**< Indicates that the RegEx device has reached the max allowed resource
> + * allowed while scanning the given buffer.
> + */
> +
> /**
> * The generic *rte_regex_ops* structure to hold the RegEx attributes
> * for enqueue and dequeue operation.
> --
> 2.25.1
17/12/2020 11:37, Ori Kam:
> The RegEx engine is using HW resources that may reach some limit for
> different reasons.
> In current API the RegEx can report only on max threads reached.
>
> This commit introduce a new flag to report to the app that some
> HW resource limit has been reached.
>
>
> Ori Kam (2):
> regexdev: add resource limit reached rsp flag
> regex/mlx5: add regex response flags
Applied, thanks.