DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rongwei Liu <rongweil@nvidia.com>
To: <dev@dpdk.org>, <matan@nvidia.com>, <viacheslavo@nvidia.com>,
	<orika@nvidia.com>, <suanmingm@nvidia.com>, <thomas@monjalon.net>
Cc: Dariusz Sosnowski <dsosnowski@nvidia.com>
Subject: [PATCH v6 4/4] net/mlx5: implement VXLAN last reserved modification
Date: Wed, 5 Jun 2024 13:21:36 +0300	[thread overview]
Message-ID: <20240605102136.117614-5-rongweil@nvidia.com> (raw)
In-Reply-To: <20240605102136.117614-1-rongweil@nvidia.com>

Implementing the VxLAN last reserved byte modification.
Following the RFC, the field is only 1 byte and needs to
use the field_length as 8 instead of the real dst_field->size.

Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
 doc/guides/nics/mlx5.rst        |  5 +++++
 drivers/net/mlx5/mlx5_flow_dv.c | 12 ++++++++++++
 drivers/net/mlx5/mlx5_flow_hw.c |  5 +++++
 3 files changed, 22 insertions(+)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index b5928d40b2..8b3aaf5aac 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -637,6 +637,11 @@ Limitations
   - Modify field action using ``RTE_FLOW_FIELD_RANDOM`` is not supported.
   - Modification of the 802.1Q tag is not supported.
   - Modification of VXLAN network or GENEVE network ID is supported only for HW steering.
+  - Modification of the VXLAN header is supported with below limitations:
+
+    - Only for HW steering (``dv_flow_en=2``).
+    - Support VNI and the last reserved byte modifications for traffic with default
+      UDP destination port. 4789 for VXLAN and VXLAN-GBP, 4790 for VXLAN-GPE.
   - Modification of GENEVE network ID is not supported when configured
     ``FLEX_PARSER_PROFILE_ENABLE`` supports Geneve TLV options.
     See :ref:`mlx5_firmware_config` for more flex parser information.
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 06f5427abf..99abb2f2fb 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1439,6 +1439,8 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,
 	case RTE_FLOW_FIELD_VXLAN_VNI:
 	case RTE_FLOW_FIELD_GENEVE_VNI:
 		return 24;
+	case RTE_FLOW_FIELD_VXLAN_LAST_RSVD:
+		return 8;
 	case RTE_FLOW_FIELD_GTP_TEID:
 	case RTE_FLOW_FIELD_MPLS:
 	case RTE_FLOW_FIELD_TAG:
@@ -2038,6 +2040,16 @@ mlx5_flow_field_id_to_modify_info
 		else
 			info[idx].offset = off_be;
 		break;
+	case RTE_FLOW_FIELD_VXLAN_LAST_RSVD:
+		MLX5_ASSERT(data->offset + width <= 8);
+		/* Last_rsvd is on bits 7-0 of TUNNEL_HDR_DW_1. */
+		off_be = 8 - (data->offset + width);
+		info[idx] = (struct field_modify_info){1, 0, MLX5_MODI_TUNNEL_HDR_DW_1};
+		if (mask)
+			mask[idx] = flow_modify_info_mask_8(width, off_be);
+		else
+			info[idx].offset = off_be;
+		break;
 	case RTE_FLOW_FIELD_GENEVE_OPT_TYPE:
 		MLX5_ASSERT(data->offset + width <= 8);
 		modi_id = flow_geneve_opt_modi_field_get(priv, data);
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 63194935a3..01362ae121 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -1385,6 +1385,10 @@ flow_hw_modify_field_compile(struct rte_eth_dev *dev,
 			value = *(const uint8_t *)item.spec;
 			value = rte_cpu_to_be_32(value << 8);
 			item.spec = &value;
+		} else if (conf->dst.field == RTE_FLOW_FIELD_VXLAN_LAST_RSVD) {
+			value = *(const uint8_t *)item.spec << 24;
+			value = rte_cpu_to_be_32(value);
+			item.spec = &value;
 		}
 	} else {
 		type = conf->operation == RTE_FLOW_MODIFY_SET ?
@@ -5580,6 +5584,7 @@ flow_hw_validate_modify_field_level(const struct rte_flow_field_data *data,
 	case RTE_FLOW_FIELD_ESP_SPI:
 	case RTE_FLOW_FIELD_ESP_SEQ_NUM:
 	case RTE_FLOW_FIELD_VXLAN_VNI:
+	case RTE_FLOW_FIELD_VXLAN_LAST_RSVD:
 	case RTE_FLOW_FIELD_GENEVE_VNI:
 	case RTE_FLOW_FIELD_GENEVE_OPT_TYPE:
 	case RTE_FLOW_FIELD_GENEVE_OPT_CLASS:
-- 
2.27.0


  parent reply	other threads:[~2024-06-05 10:22 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23  7:28 [PATCH v1 0/3] support VXLAN rsvd1 modification Rongwei Liu
2024-05-23  7:28 ` [PATCH v1 1/3] ethdev: add VXLAN last reserved field Rongwei Liu
2024-05-23  7:28 ` [PATCH v1 2/3] app/testpmd: add VXLAN last reserved modification command Rongwei Liu
2024-05-24 15:53   ` Dariusz Sosnowski
2024-05-27  2:47     ` [PATCH v2 0/4] support VXLAN rsvd1 modification Rongwei Liu
2024-05-27  2:47       ` [PATCH v2 1/4] app/testpmd: fix the testpmd field string sequence Rongwei Liu
2024-05-30  8:22         ` rongwei liu
2024-06-03  7:30         ` Dariusz Sosnowski
2024-05-27  2:47       ` [PATCH v2 2/4] ethdev: add VXLAN last reserved field Rongwei Liu
2024-06-04 11:27         ` rongwei liu
2024-06-04 11:59         ` Thomas Monjalon
2024-06-04 12:06           ` rongwei liu
2024-06-04 12:14           ` [PATCH v3 0/3] support VXLAN rsvd1 modification Rongwei Liu
2024-06-04 12:15             ` [PATCH v3 1/3] app/testpmd: fix the testpmd field string sequence Rongwei Liu
2024-06-04 12:15             ` [PATCH v3 2/3] ethdev: add VXLAN last reserved field Rongwei Liu
2024-06-04 12:15             ` [PATCH v3 3/3] net/mlx5: implement VXLAN last reserved modification Rongwei Liu
2024-05-27  2:47       ` [PATCH v2 3/4] app/testpmd: add VXLAN last reserved modification command Rongwei Liu
2024-06-04 12:00         ` Thomas Monjalon
2024-05-27  2:47       ` [PATCH v2 4/4] net/mlx5: implement VXLAN last reserved modification Rongwei Liu
2024-06-04 12:19         ` Thomas Monjalon
2024-06-04 12:24           ` rongwei liu
2024-06-04 12:38           ` [PATCH v4 0/3] support VXLAN rsvd1 modification Rongwei Liu
2024-06-04 12:38             ` [PATCH v4 1/3] app/testpmd: fix the testpmd field string sequence Rongwei Liu
2024-06-04 12:38             ` [PATCH v4 2/3] ethdev: add VXLAN last reserved field Rongwei Liu
2024-06-04 15:03               ` Thomas Monjalon
2024-06-04 16:29                 ` rongwei liu
2024-06-04 16:40                   ` Dariusz Sosnowski
2024-06-04 18:37                     ` Thomas Monjalon
2024-06-05  1:16                       ` rongwei liu
2024-06-05  7:13                         ` Thomas Monjalon
2024-06-05  8:14                           ` rongwei liu
2024-06-05  9:35                             ` Thomas Monjalon
2024-06-05  9:41                               ` rongwei liu
2024-06-05  9:53                                 ` Thomas Monjalon
2024-06-05 10:21                                   ` [PATCH v6 0/4] support VXLAN last reserved byte modification Rongwei Liu
2024-06-05 10:21                                     ` [PATCH v6 1/4] app/testpmd: fix the testpmd field string sequence Rongwei Liu
2024-06-09 14:29                                       ` Ori Kam
2024-06-05 10:21                                     ` [PATCH v6 2/4] net: add new union into VXLAN header Rongwei Liu
2024-06-05 10:42                                       ` Thomas Monjalon
2024-06-05 11:28                                         ` rongwei liu
2024-06-05 12:14                                           ` Thomas Monjalon
2024-06-05 13:04                                             ` [PATCH v7 0/3] support VXLAN last reserved byte modification Rongwei Liu
2024-06-05 13:04                                               ` [PATCH v7 1/3] app/testpmd: fix the testpmd field string sequence Rongwei Liu
2024-06-05 13:04                                               ` [PATCH v7 2/3] ethdev: add VXLAN last reserved field Rongwei Liu
2024-06-07 13:25                                                 ` Thomas Monjalon
2024-06-07 13:55                                                   ` rongwei liu
2024-06-07 14:02                                                   ` [PATCH v8 0/3] support VXLAN last reserved byte modification Rongwei Liu
2024-06-07 14:02                                                     ` [PATCH v8 1/3] app/testpmd: fix the testpmd field string sequence Rongwei Liu
2024-06-11  6:59                                                       ` Ori Kam
2024-06-11 14:52                                                       ` Ferruh Yigit
2024-06-07 14:02                                                     ` [PATCH v8 2/3] ethdev: add VXLAN last reserved field Rongwei Liu
2024-06-09 10:32                                                       ` Thomas Monjalon
2024-06-11 14:52                                                       ` Ferruh Yigit
2024-06-12  1:25                                                         ` rongwei liu
2024-06-25 14:46                                                           ` Thomas Monjalon
2024-06-07 14:02                                                     ` [PATCH v8 3/3] net/mlx5: implement VXLAN last reserved modification Rongwei Liu
2024-06-11 14:52                                                     ` [PATCH v8 0/3] support VXLAN last reserved byte modification Ferruh Yigit
2024-06-05 13:04                                               ` [PATCH v7 3/3] net/mlx5: implement VXLAN last reserved modification Rongwei Liu
2024-06-05 10:21                                     ` [PATCH v6 3/4] ethdev: add VXLAN last reserved field Rongwei Liu
2024-06-05 10:21                                     ` Rongwei Liu [this message]
2024-06-05  8:41                           ` [PATCH v5 0/3] support VXLAN last reserved byte modification Rongwei Liu
2024-06-05  8:41                             ` [PATCH v5 1/3] app/testpmd: fix the testpmd field string sequence Rongwei Liu
2024-06-05  8:41                             ` [PATCH v5 2/3] ethdev: add VXLAN last reserved field Rongwei Liu
2024-06-05  8:41                             ` [PATCH v5 3/3] net/mlx5: implement VXLAN last reserved modification Rongwei Liu
2024-06-04 12:38             ` [PATCH v4 " Rongwei Liu
2024-05-27  2:56     ` [PATCH v1 2/3] app/testpmd: add VXLAN last reserved modification command rongwei liu
2024-05-23  7:28 ` [PATCH v1 3/3] net/mlx5: implement VXLAN last reserved modification Rongwei Liu

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=20240605102136.117614-5-rongweil@nvidia.com \
    --to=rongweil@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --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).