DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michael Baum <michaelba@nvidia.com>
To: <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>,
	Dariusz Sosnowski <dsosnowski@nvidia.com>,
	 Raslan Darawsheh <rasland@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Ori Kam <orika@nvidia.com>, Suanming Mou <suanmingm@nvidia.com>
Subject: [PATCH v7 3/3] net/mlx5/hws: add compare ESP sequence number support
Date: Mon, 26 Feb 2024 15:18:48 +0200	[thread overview]
Message-ID: <20240226131848.2982242-4-michaelba@nvidia.com> (raw)
In-Reply-To: <20240226131848.2982242-1-michaelba@nvidia.com>

Add support for compare item with "RTE_FLOW_FIELD_ESP_SEQ_NUM" field.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Suanming Mou <suanmingm@nvidia.com>
---
 doc/guides/nics/mlx5.rst              |  1 +
 drivers/net/mlx5/hws/mlx5dr_definer.c | 22 ++++++++++++++++++++--
 drivers/net/mlx5/mlx5_flow_hw.c       |  3 +++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index c0a5768117..d7bf81161e 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -434,6 +434,7 @@ Limitations
   - Only single item is supported per pattern template.
   - Only 32-bit comparison is supported or 16-bits for random field.
   - Only supported for ``RTE_FLOW_FIELD_META``, ``RTE_FLOW_FIELD_TAG``,
+    ``RTE_FLOW_FIELD_ESP_SEQ_NUM``,
     ``RTE_FLOW_FIELD_RANDOM`` and ``RTE_FLOW_FIELD_VALUE``.
   - The field type ``RTE_FLOW_FIELD_VALUE`` must be the base (``b``) field.
   - The field type ``RTE_FLOW_FIELD_RANDOM`` can only be compared with
diff --git a/drivers/net/mlx5/hws/mlx5dr_definer.c b/drivers/net/mlx5/hws/mlx5dr_definer.c
index 45e5bc5a61..c1508e6b53 100644
--- a/drivers/net/mlx5/hws/mlx5dr_definer.c
+++ b/drivers/net/mlx5/hws/mlx5dr_definer.c
@@ -424,10 +424,20 @@ mlx5dr_definer_compare_base_value_set(const void *item_spec,
 
 	value = (const uint32_t *)&b->value[0];
 
-	if (a->field == RTE_FLOW_FIELD_RANDOM)
+	switch (a->field) {
+	case RTE_FLOW_FIELD_RANDOM:
 		*base = htobe32(*value << 16);
-	else
+		break;
+	case RTE_FLOW_FIELD_TAG:
+	case RTE_FLOW_FIELD_META:
 		*base = htobe32(*value);
+		break;
+	case RTE_FLOW_FIELD_ESP_SEQ_NUM:
+		*base = *value;
+		break;
+	default:
+		break;
+	}
 
 	MLX5_SET(ste_match_4dw_range_ctrl_dw, ctrl, base0, 1);
 }
@@ -2930,6 +2940,14 @@ mlx5dr_definer_conv_item_compare_field(const struct rte_flow_field_data *f,
 		fc->compare_idx = dw_offset;
 		DR_CALC_SET_HDR(fc, random_number, random_number);
 		break;
+	case RTE_FLOW_FIELD_ESP_SEQ_NUM:
+		fc = &cd->fc[MLX5DR_DEFINER_FNAME_ESP_SEQUENCE_NUMBER];
+		fc->item_idx = item_idx;
+		fc->tag_set = &mlx5dr_definer_compare_set;
+		fc->tag_mask_set = &mlx5dr_definer_ones_set;
+		fc->compare_idx = dw_offset;
+		DR_CALC_SET_HDR(fc, ipsec, sequence_number);
+		break;
 	default:
 		DR_LOG(ERR, "%u field is not supported", f->field);
 		goto err_notsup;
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index f31ba2df2b..531c90e0ee 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -6729,6 +6729,7 @@ flow_hw_item_compare_field_validate(enum rte_flow_field_id arg_field,
 	switch (arg_field) {
 	case RTE_FLOW_FIELD_TAG:
 	case RTE_FLOW_FIELD_META:
+	case RTE_FLOW_FIELD_ESP_SEQ_NUM:
 		break;
 	case RTE_FLOW_FIELD_RANDOM:
 		if (base_field == RTE_FLOW_FIELD_VALUE)
@@ -6747,6 +6748,7 @@ flow_hw_item_compare_field_validate(enum rte_flow_field_id arg_field,
 	case RTE_FLOW_FIELD_TAG:
 	case RTE_FLOW_FIELD_META:
 	case RTE_FLOW_FIELD_VALUE:
+	case RTE_FLOW_FIELD_ESP_SEQ_NUM:
 		break;
 	default:
 		return rte_flow_error_set(error, ENOTSUP,
@@ -6763,6 +6765,7 @@ flow_hw_item_compare_width_supported(enum rte_flow_field_id field)
 	switch (field) {
 	case RTE_FLOW_FIELD_TAG:
 	case RTE_FLOW_FIELD_META:
+	case RTE_FLOW_FIELD_ESP_SEQ_NUM:
 		return 32;
 	case RTE_FLOW_FIELD_RANDOM:
 		return 16;
-- 
2.25.1


  parent reply	other threads:[~2024-02-26 13:19 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-25 10:45 [PATCH v1 0/2] net/mlx5: add random compare support Michael Baum
2023-12-25 10:45 ` [PATCH v1 1/2] net/mlx5/hws: add support for compare matcher Michael Baum
2023-12-25 10:45 ` [PATCH v1 2/2] net/mlx5: add support to compare random value Michael Baum
2024-01-28 10:22 ` [PATCH v2 0/2] net/mlx5: add random compare support Michael Baum
2024-01-28 10:22   ` [PATCH v2 1/2] net/mlx5/hws: add support for compare matcher Michael Baum
2024-01-28 10:22   ` [PATCH v2 2/2] net/mlx5: add support to compare random value Michael Baum
2024-01-29 13:44   ` [PATCH v3 0/2] net/mlx5: add random compare support Michael Baum
2024-01-29 13:44     ` [PATCH v3 1/2] net/mlx5/hws: add support for compare matcher Michael Baum
2024-01-29 13:44     ` [PATCH v3 2/2] net/mlx5: add support to compare random value Michael Baum
2024-02-07 16:14     ` [PATCH v4 0/2] net/mlx5: add random compare support Michael Baum
2024-02-07 16:14       ` [PATCH v4 1/2] net/mlx5/hws: add support for compare matcher Michael Baum
2024-02-07 16:14       ` [PATCH v4 2/2] net/mlx5: add support to compare random value Michael Baum
2024-02-14  7:30       ` [PATCH v5 0/3] net/mlx5: add compare item support Michael Baum
2024-02-14  7:30         ` [PATCH v5 1/3] net/mlx5/hws: add support for compare matcher Michael Baum
2024-02-19  3:00           ` Suanming Mou
2024-02-14  7:30         ` [PATCH v5 2/3] net/mlx5: add support to compare random value Michael Baum
2024-02-19  3:00           ` Suanming Mou
2024-02-14  7:30         ` [PATCH v5 3/3] net/mlx5/hws: add compare ESP sequence number support Michael Baum
2024-02-19  2:59           ` Suanming Mou
2024-02-19  7:21             ` Michael Baum
2024-02-19  7:37               ` Suanming Mou
2024-02-26 13:03         ` [PATCH v6 0/3] net/mlx5: add compare item support Michael Baum
2024-02-26 13:03           ` [PATCH v6 1/3] net/mlx5/hws: add support for compare matcher Michael Baum
2024-02-26 13:03           ` [PATCH v6 2/3] net/mlx5: add support to compare random value Michael Baum
2024-02-26 13:03           ` [PATCH v6 3/3] net/mlx5/hws: add compare ESP sequence number support Michael Baum
2024-02-26 13:18           ` [PATCH v7 0/3] net/mlx5: add compare item support Michael Baum
2024-02-26 13:18             ` [PATCH v7 1/3] net/mlx5/hws: add support for compare matcher Michael Baum
2024-02-26 13:18             ` [PATCH v7 2/3] net/mlx5: add support to compare random value Michael Baum
2024-02-26 13:18             ` Michael Baum [this message]
2024-02-27  9:08             ` [PATCH v7 0/3] net/mlx5: add compare item support Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240226131848.2982242-4-michaelba@nvidia.com \
    --to=michaelba@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).