Skip to contentSkip to conversation

regexdev: add new response flag

PATCH Applied Ori Kam 2 participants 5 messages Dec 17, 2020 – Jan 12, 2021

lore
Share & tools
lore

Ori Kam

author
#0 lore raw

cover regexdev: add new response flag

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(-)
Signature · 1 line
2.25.1
author
#1 lore raw

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.

---
 lib/librte_regexdev/rte_regexdev.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/librte_regexdev/rte_regexdev.h +5 -0
index 0001658925..86f0b231b0 100644
@@ -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.
Signature · 1 line
2.25.1
author
#2 lore raw

Re: [dpdk-dev] [PATCH 1/2] regexdev: add resource limit reached rsp flag

Hi

I would very much like a review for this patch.

Thank you,
Ori

Quoted 35 lines

-----Original Message-----
From: Ori Kam <[email protected]>
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.

---
 lib/librte_regexdev/rte_regexdev.h | 5 +++++
 1 file changed, 5 insertions(+)
lib/librte_regexdev/rte_regexdev.h +5 -1
index 0001658925..86f0b231b0 100644
@@ -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

author
#3 lore raw

PATCH 2/2 regex/mlx5: add regex response flags

In reply to Ori Kam

This commit propagate the response flags from the regex engine.

---
 drivers/regex/mlx5/mlx5_regex_fastpath.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/regex/mlx5/mlx5_regex_fastpath.c +22 -1
index ee72f89c99..593b7d183a 100644
@@ -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 *
Signature · 1 line
2.25.1
#4 lore raw
In reply to Ori Kam

17/12/2020 11:37, Ori Kam:

Quoted 11 lines

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.