From: Maayan Kashani <mkashani@nvidia.com>
To: <dev@dpdk.org>
Cc: <mkashani@nvidia.com>, <dsosnowski@nvidia.com>,
<rasland@nvidia.com>,
Viacheslav Ovsiienko <viacheslavo@nvidia.com>, <stable@dpdk.org>,
Matan Azrad <matan@nvidia.com>, Bing Zhao <bingz@nvidia.com>,
Ori Kam <orika@nvidia.com>, Suanming Mou <suanmingm@nvidia.com>,
Raja Zidane <rzidane@nvidia.com>
Subject: [PATCH v2 2/3] net/mlx5: fix ESP item validation to match on seqnum
Date: Tue, 9 Sep 2025 09:28:52 +0300 [thread overview]
Message-ID: <20250909062853.60592-2-mkashani@nvidia.com> (raw)
In-Reply-To: <20250909062853.60592-1-mkashani@nvidia.com>
From: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
The match on ESP sequence number is supported by hardware
steering implementation but was rejected in validation
routine shared by all steering engines.
This patch allows validation to pass with requested match on
ESP sequence number for hardware steering engine.
Fixes: fb96caa56aab ("net/mlx5: support ESP item on Windows")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++++++-
drivers/net/mlx5/linux/mlx5_flow_os.h | 3 +++
drivers/net/mlx5/mlx5_flow_dv.c | 6 ++----
drivers/net/mlx5/mlx5_flow_hw.c | 5 ++---
drivers/net/mlx5/mlx5_flow_verbs.c | 6 ++----
drivers/net/mlx5/windows/mlx5_flow_os.c | 10 +++++++++-
drivers/net/mlx5/windows/mlx5_flow_os.h | 3 +++
7 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/drivers/net/mlx5/linux/mlx5_flow_os.c b/drivers/net/mlx5/linux/mlx5_flow_os.c
index af8c02c38b8..777125e9a87 100644
--- a/drivers/net/mlx5/linux/mlx5_flow_os.c
+++ b/drivers/net/mlx5/linux/mlx5_flow_os.c
@@ -18,6 +18,7 @@ mlx5_flow_os_validate_item_esp(const struct rte_eth_dev *dev,
const struct rte_flow_item *item,
uint64_t item_flags,
uint8_t target_protocol,
+ bool allow_seq,
struct rte_flow_error *error)
{
const struct rte_flow_item_esp *mask = item->mask;
@@ -26,6 +27,12 @@ mlx5_flow_os_validate_item_esp(const struct rte_eth_dev *dev,
MLX5_FLOW_LAYER_OUTER_L3;
const uint64_t l4m = tunnel ? MLX5_FLOW_LAYER_INNER_L4 :
MLX5_FLOW_LAYER_OUTER_L4;
+ static const struct rte_flow_item_esp mlx5_flow_item_esp_mask = {
+ .hdr = {
+ .spi = RTE_BE32(0xffffffff),
+ .seq = RTE_BE32(0xffffffff),
+ },
+ };
int ret;
if (!mlx5_hws_active(dev)) {
@@ -47,7 +54,8 @@ mlx5_flow_os_validate_item_esp(const struct rte_eth_dev *dev,
mask = &rte_flow_item_esp_mask;
ret = mlx5_flow_item_acceptable
(dev, item, (const uint8_t *)mask,
- (const uint8_t *)&rte_flow_item_esp_mask,
+ allow_seq ? (const uint8_t *)&mlx5_flow_item_esp_mask :
+ (const uint8_t *)&rte_flow_item_esp_mask,
sizeof(struct rte_flow_item_esp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
error);
if (ret < 0)
diff --git a/drivers/net/mlx5/linux/mlx5_flow_os.h b/drivers/net/mlx5/linux/mlx5_flow_os.h
index 35b5871ab91..21a2ed5bec0 100644
--- a/drivers/net/mlx5/linux/mlx5_flow_os.h
+++ b/drivers/net/mlx5/linux/mlx5_flow_os.h
@@ -514,6 +514,8 @@ mlx5_os_flow_dr_sync_domain(void *domain, uint32_t flags)
* Bit-fields that holds the items detected until now.
* @param[in] target_protocol
* The next protocol in the previous item.
+ * @param[in] allow_seq
+ * The match on sequence number is supported.
* @param[out] error
* Pointer to error structure.
*
@@ -525,6 +527,7 @@ mlx5_flow_os_validate_item_esp(const struct rte_eth_dev *dev,
const struct rte_flow_item *item,
uint64_t item_flags,
uint8_t target_protocol,
+ bool allow_seq,
struct rte_flow_error *error);
/**
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index abfd54da1a9..18d0d293770 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7859,10 +7859,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
case RTE_FLOW_ITEM_TYPE_VOID:
break;
case RTE_FLOW_ITEM_TYPE_ESP:
- ret = mlx5_flow_os_validate_item_esp(dev, items,
- item_flags,
- next_protocol,
- error);
+ ret = mlx5_flow_os_validate_item_esp(dev, items, item_flags,
+ next_protocol, false, error);
if (ret < 0)
return ret;
last_item = MLX5_FLOW_ITEM_ESP;
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index c84ae726a74..2ca40b41465 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -8818,9 +8818,8 @@ __flow_hw_pattern_validate(struct rte_eth_dev *dev,
last_item = MLX5_FLOW_ITEM_QUOTA;
break;
case RTE_FLOW_ITEM_TYPE_ESP:
- ret = mlx5_flow_os_validate_item_esp(dev, item,
- *item_flags, 0xff,
- error);
+ ret = mlx5_flow_os_validate_item_esp(dev, item, *item_flags,
+ 0xff, true, error);
if (ret < 0)
return ret;
last_item = MLX5_FLOW_ITEM_ESP;
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 5b4a4eda3bb..67d199ce15e 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1332,10 +1332,8 @@ flow_verbs_validate(struct rte_eth_dev *dev,
switch (items->type) {
#ifdef HAVE_IBV_FLOW_SPEC_ESP
case RTE_FLOW_ITEM_TYPE_ESP:
- ret = mlx5_flow_os_validate_item_esp(dev, items,
- item_flags,
- next_protocol,
- error);
+ ret = mlx5_flow_os_validate_item_esp(dev, items, item_flags,
+ next_protocol, false, error);
if (ret < 0)
return ret;
last_item = MLX5_FLOW_ITEM_ESP;
diff --git a/drivers/net/mlx5/windows/mlx5_flow_os.c b/drivers/net/mlx5/windows/mlx5_flow_os.c
index bf93da9f1e1..7a625fb880a 100644
--- a/drivers/net/mlx5/windows/mlx5_flow_os.c
+++ b/drivers/net/mlx5/windows/mlx5_flow_os.c
@@ -428,6 +428,7 @@ mlx5_flow_os_validate_item_esp(const struct rte_eth_dev *dev,
const struct rte_flow_item *item,
uint64_t item_flags,
uint8_t target_protocol,
+ bool allow_seq,
struct rte_flow_error *error)
{
const struct rte_flow_item_esp *mask = item->mask;
@@ -437,6 +438,12 @@ mlx5_flow_os_validate_item_esp(const struct rte_eth_dev *dev,
MLX5_FLOW_LAYER_OUTER_L3;
const uint64_t l4m = tunnel ? MLX5_FLOW_LAYER_INNER_L4 :
MLX5_FLOW_LAYER_OUTER_L4;
+ static const struct rte_flow_item_esp mlx5_flow_item_esp_mask = {
+ .hdr = {
+ .spi = RTE_BE32(0xffffffff),
+ .seq = RTE_BE32(0xffffffff),
+ },
+ };
int ret;
if (!(item_flags & l3m))
@@ -461,7 +468,8 @@ mlx5_flow_os_validate_item_esp(const struct rte_eth_dev *dev,
" supported on Windows");
ret = mlx5_flow_item_acceptable
(dev, item, (const uint8_t *)mask,
- (const uint8_t *)&rte_flow_item_esp_mask,
+ allow_seq ? (const uint8_t *)&mlx5_flow_item_esp_mask :
+ (const uint8_t *)&rte_flow_item_esp_mask,
sizeof(struct rte_flow_item_esp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
error);
if (ret < 0)
diff --git a/drivers/net/mlx5/windows/mlx5_flow_os.h b/drivers/net/mlx5/windows/mlx5_flow_os.h
index 36edc3d5328..2cd4e953256 100644
--- a/drivers/net/mlx5/windows/mlx5_flow_os.h
+++ b/drivers/net/mlx5/windows/mlx5_flow_os.h
@@ -461,6 +461,8 @@ int mlx5_flow_os_destroy_flow(void *drv_flow_ptr);
* Bit-fields that holds the items detected until now.
* @param[in] target_protocol
* The next protocol in the previous item.
+ * @param[in] allow_seq
+ * The match on sequence number is supported.
* @param[out] error
* Pointer to error structure.
*
@@ -472,6 +474,7 @@ mlx5_flow_os_validate_item_esp(const struct rte_eth_dev *dev,
const struct rte_flow_item *item,
uint64_t item_flags,
uint8_t target_protocol,
+ bool allow_seq,
struct rte_flow_error *error);
/**
--
2.21.0
next prev parent reply other threads:[~2025-09-09 6:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-04 5:05 [PATCH] net/mlx5/hws: fix ESP header match in strict mode Viacheslav Ovsiienko
2025-08-08 7:30 ` Dariusz Sosnowski
2025-08-18 6:33 ` Raslan Darawsheh
2025-09-08 12:12 ` Maayan Kashani
2025-09-08 12:26 ` Raslan Darawsheh
2025-09-09 6:28 ` [PATCH v2 1/3] net/mlx5: " Maayan Kashani
2025-09-09 6:28 ` Maayan Kashani [this message]
2025-09-09 6:28 ` [PATCH v2 3/3] net/mlx5: fix ESP header match after UDP for group 0 Maayan Kashani
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=20250909062853.60592-2-mkashani@nvidia.com \
--to=mkashani@nvidia.com \
--cc=bingz@nvidia.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=rasland@nvidia.com \
--cc=rzidane@nvidia.com \
--cc=stable@dpdk.org \
--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).