DPDK patches and discussions
 help / color / mirror / Atom feed
* [v1 0/2] extend VXLAN header to support more extensions
@ 2024-05-17  8:07 Gavin Li
  2024-05-17  8:07 ` [v1 1/2] net: " Gavin Li
  2024-05-17  8:07 ` [v1 2/2] app/testpmd: introduce VXLAN-GBP and VXLAN-GPE fields Gavin Li
  0 siblings, 2 replies; 4+ messages in thread
From: Gavin Li @ 2024-05-17  8:07 UTC (permalink / raw)
  To: matan, viacheslavo, orika, thomas; +Cc: dev, rasland

In this patch series, all the VXLAN extension header will be merged with
VXLAN as union if the overlapped field has different format among
protocols. The existing VXLAN-GPE will be marked as deprecated and new
extensions of VXLAN should be added to VXLAN instead of a new RTE item.

RFC
https://patches.dpdk.org/project/dpdk/patch/20240130112520.1971315-2-gavinl@nvidia.com/

PMD changes
https://patches.dpdk.org/project/dpdk/patch/20240514032131.153409-1-rongweil@nvidia.com/


Gavin Li (2):
  net: extend VXLAN header to support more extensions
  app/testpmd: introduce VXLAN-GBP and VXLAN-GPE fields

 app/test-pmd/cmdline_flow.c                 | 40 ++++++++++++
 doc/guides/rel_notes/deprecation.rst        |  5 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  4 ++
 lib/ethdev/rte_flow.h                       | 13 +++-
 lib/net/rte_vxlan.h                         | 69 +++++++++++++++++++--
 5 files changed, 125 insertions(+), 6 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [v1 1/2] net: extend VXLAN header to support more extensions
  2024-05-17  8:07 [v1 0/2] extend VXLAN header to support more extensions Gavin Li
@ 2024-05-17  8:07 ` Gavin Li
  2024-05-17  8:07 ` [v1 2/2] app/testpmd: introduce VXLAN-GBP and VXLAN-GPE fields Gavin Li
  1 sibling, 0 replies; 4+ messages in thread
From: Gavin Li @ 2024-05-17  8:07 UTC (permalink / raw)
  To: matan, viacheslavo, orika, thomas, Ferruh Yigit, Andrew Rybchenko
  Cc: dev, rasland

Currently, DPDK supports VXLAN and VXLAN-GPE with similar header
structures and we are working on adding support for VXLAN-GBP which is
another extension to VXLAN. More extension of VXLAN may be added in the
future.

VXLAN and VXLAN-GBP use the same UDP port(4789) while VXLAN-GPE uses a
different one, 4790. The three protocols have the same header length and
overall similar header structure as below.
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |R|R|R|R|I|R|R|R|            Reserved                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                VXLAN Network Identifier (VNI) |   Reserved    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                           Figure 1: VXLAN Header

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |R|R|Ver|I|P|B|O|       Reserved                |Next Protocol  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                VXLAN Network Identifier (VNI) |   Reserved    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Figure 2: VXLAN-GPE Header

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |G|R|R|R|I|R|R|R|R|D|R|R|A|R|R|R|        Group Policy ID        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          VXLAN Network Identifier (VNI)       |   Reserved    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                          Figure 3: VXLAN-GBP Extension

Both VXLAN-GPE and VXLAN-GBP extended VXLAN by redefining its reserved
bits, which means the packets can be processed with same pattern and most
of the code can be reused. Instead of adding more new items by
copying/pasting code for the VXLAN extensions in the future, it’s better
to use existing VXLAN infrastructure and add support code in it.

In this patch, all the VXLAN extension header will be merged with VXLAN as
union if the overlapped field has different format among protocols. The
existing VXLAN-GPE will be marked as deprecated and new extensions of
VXLAN should be added to VXLAN instead of a new RTE item.

Signed-off-by: Gavin Li <gavinl@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
---
 doc/guides/rel_notes/deprecation.rst |  5 ++
 lib/ethdev/rte_flow.h                | 13 +++++-
 lib/net/rte_vxlan.h                  | 69 ++++++++++++++++++++++++++--
 3 files changed, 81 insertions(+), 6 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 6948641ff6..c9c8cf1868 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -91,6 +91,11 @@ Deprecation Notices
   - ``rte_flow_item_pppoe``
   - ``rte_flow_item_pppoe_proto_id``
 
+* ethdev: The flow item ``RTE_FLOW_ITEM_TYPE_VXLAN_GPE`` is replaced with ``RTE_FLOW_ITEM_TYPE_VXLAN``.
+  The item ``RTE_FLOW_ITEM_TYPE_VXLAN_GPE``, the struct ``rte_flow_item_vxlan_gpe``, its mask ``rte_flow_item_vxlan_gpe_mask``,
+  and the header struct ``rte_vxlan_gpe_hdr`` with the macro ``RTE_ETHER_VXLAN_GPE_HLEN``
+  will be removed in DPDK 25.11.
+
 * ethdev: Queue specific stats fields will be removed from ``struct rte_eth_stats``.
   Mentioned fields are: ``q_ipackets``, ``q_opackets``, ``q_ibytes``, ``q_obytes``,
   ``q_errors``.
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 6e8ab1d4c7..635b291f90 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -355,6 +355,7 @@ enum rte_flow_item_type {
 	RTE_FLOW_ITEM_TYPE_GENEVE,
 
 	/**
+	 * @deprecated Replaced with ``RTE_FLOW_ITEM_TYPE_VXLAN``.
 	 * Matches a VXLAN-GPE header.
 	 *
 	 * See struct rte_flow_item_vxlan_gpe.
@@ -1103,7 +1104,11 @@ static const struct rte_flow_item_sctp rte_flow_item_sctp_mask = {
 /**
  * RTE_FLOW_ITEM_TYPE_VXLAN.
  *
- * Matches a VXLAN header (RFC 7348).
+ * Matches a VXLAN header (RFC 7348), including GPE (draft-ietf-nvo3-vxlan-gpe-13.txt)
+ * and GBP (draft-smith-vxlan-group-policy-05.txt).
+ *
+ * GPE is distinguished with its UDP port.
+ * UDP port may be specified with ``rte_eth_dev_udp_tunnel_port_add()``.
  */
 struct rte_flow_item_vxlan {
 	union {
@@ -1346,6 +1351,7 @@ static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
 #endif
 
 /**
+ * @deprecated Replaced with ``rte_flow_item_vxlan``.
  * RTE_FLOW_ITEM_TYPE_VXLAN_GPE (draft-ietf-nvo3-vxlan-gpe-05).
  *
  * Matches a VXLAN-GPE header.
@@ -1367,7 +1373,10 @@ struct rte_flow_item_vxlan_gpe {
 	};
 };
 
-/** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */
+/**
+ * @deprecated Replaced with ``rte_flow_item_vxlan_mask``.
+ * Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE.
+ */
 #ifndef __cplusplus
 static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = {
 	.hdr.vni = "\xff\xff\xff",
diff --git a/lib/net/rte_vxlan.h b/lib/net/rte_vxlan.h
index 997fc784fc..2f3024a7fe 100644
--- a/lib/net/rte_vxlan.h
+++ b/lib/net/rte_vxlan.h
@@ -38,11 +38,68 @@ struct rte_vxlan_hdr {
 			rte_be32_t vx_vni;   /**< VNI (24) + Reserved (8). */
 		};
 		struct {
-			uint8_t    flags;    /**< Should be 8 (I flag). */
-			uint8_t    rsvd0[3]; /**< Reserved. */
+			union {
+				uint8_t    flags;    /**< Should be 8 (I flag). */
+				/* Flag bits defined by GPE */
+				struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+					uint8_t flag_o:1,
+						flag_b:1,
+						flag_p:1,
+						flag_i_gpe:1,
+						flag_ver:2,
+						rsvd_gpe:2;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+					uint8_t rsvd_gpe:2,
+						flag_ver:2,
+						flag_i_gpe:1,
+						flag_p:1,
+						flag_b:1,
+						flag_o:1;
+#endif
+				} __rte_packed;
+				/* Flag bits defined by GBP */
+				struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+					uint8_t rsvd_gbp2:3,
+						flag_i_gbp:1,
+						rsvd_gbp1:3,
+						flag_g:1;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+					uint8_t flag_g:1,
+						rsvd_gbp1:3,
+						flag_i_gbp:1,
+						rsvd_gbp2:3;
+#endif
+				} __rte_packed;
+			};
+			union {
+				uint8_t    rsvd0[3]; /**< Reserved. */
+				/* Overlap with rte_vxlan_gpe_hdr which is deprecated.*/
+				struct {
+					uint8_t rsvd0_gpe[2]; /**< Reserved. */
+					uint8_t proto;	   /**< Next protocol. */
+				} __rte_packed;
+				struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+					uint8_t rsvd0_gbp3:3,
+						flag_a:1,
+						rsvd0_gbp2:2,
+						flag_d:1,
+						rsvd0_gbp1:1;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+					uint8_t rsvd0_gbp1:1,
+						flag_d:1,
+						rsvd0_gbp2:2,
+						flag_a:1,
+						rsvd0_gbp3:3;
+#endif
+					uint16_t policy_id;
+				} __rte_packed;
+			} __rte_packed;
 			uint8_t    vni[3];   /**< VXLAN identifier. */
 			uint8_t    rsvd1;    /**< Reserved. */
-		};
+		} __rte_packed;
 	};
 } __rte_packed;
 
@@ -52,6 +109,7 @@ struct rte_vxlan_hdr {
 
 
 /**
+ * @deprecated Replaced with ``rte_vxlan_hdr``.
  * VXLAN-GPE protocol header (draft-ietf-nvo3-vxlan-gpe-05).
  * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network
  * Identifier and Reserved fields (16 bits and 8 bits).
@@ -75,7 +133,10 @@ struct rte_vxlan_gpe_hdr {
 	};
 } __rte_packed;
 
-/** VXLAN-GPE tunnel header length. */
+/**
+ * @deprecated Replaced with ``RTE_ETHER_VXLAN_HLEN``.
+ * VXLAN-GPE tunnel header length.
+ */
 #define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \
 		sizeof(struct rte_vxlan_gpe_hdr))
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [v1 2/2] app/testpmd: introduce VXLAN-GBP and VXLAN-GPE fields
  2024-05-17  8:07 [v1 0/2] extend VXLAN header to support more extensions Gavin Li
  2024-05-17  8:07 ` [v1 1/2] net: " Gavin Li
@ 2024-05-17  8:07 ` Gavin Li
  2024-05-23  8:20   ` Ori Kam
  1 sibling, 1 reply; 4+ messages in thread
From: Gavin Li @ 2024-05-17  8:07 UTC (permalink / raw)
  To: matan, viacheslavo, orika, thomas, Aman Singh, Yuying Zhang; +Cc: dev, rasland

After unification of VXLAN and all its extension protocols(VXLAN-GPE and
VXLAN-GBP currently), all related RTE items should be spicified after
'vxlan'. And it's user's responsibility to specify correct UDP port for
the protocol to be matched.

Below are the examples to match standard VXLAN, VXLAN-GPE and VXLAN-GBP.
To match standard vxlan,
... / udp dst is 4789 / vxlan ... / ...
To match VXLAN-GBP group policy ID 4321,
... / udp dst is 4789 / vxlan group_policy_id is 4321 ... / ...
To match VXLAN-GPE,
... / udp dst is 4790 / vxlan protocol is 2 ... / ...

Signed-off-by: Gavin Li <gavinl@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
---
 app/test-pmd/cmdline_flow.c                 | 40 +++++++++++++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  4 +++
 2 files changed, 44 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 60ee9337cf..78b31d9bcd 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -383,6 +383,10 @@ enum index {
 	ITEM_VXLAN,
 	ITEM_VXLAN_VNI,
 	ITEM_VXLAN_LAST_RSVD,
+	ITEM_VXLAN_FLAGS,
+	ITEM_VXLAN_EXT_GBP_GPI,
+	ITEM_VXLAN_EXT_GPE_PROTO,
+	ITEM_VXLAN_EXT_GPE_RSVD0,
 	ITEM_E_TAG,
 	ITEM_E_TAG_GRP_ECID_B,
 	ITEM_NVGRE,
@@ -1779,6 +1783,10 @@ static const enum index item_sctp[] = {
 static const enum index item_vxlan[] = {
 	ITEM_VXLAN_VNI,
 	ITEM_VXLAN_LAST_RSVD,
+	ITEM_VXLAN_FLAGS,
+	ITEM_VXLAN_EXT_GBP_GPI,
+	ITEM_VXLAN_EXT_GPE_PROTO,
+	ITEM_VXLAN_EXT_GPE_RSVD0,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -4918,6 +4926,38 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan,
 					     hdr.rsvd1)),
 	},
+	[ITEM_VXLAN_FLAGS] = {
+		.name = "flags",
+		.help = "VXLAN flags",
+		.next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan,
+					     flags)),
+	},
+	[ITEM_VXLAN_EXT_GBP_GPI] = {
+		.name = "group_policy_id",
+		.help = "VXLAN Group Based Policy ID",
+		.next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan,
+					     hdr.policy_id)),
+	},
+	[ITEM_VXLAN_EXT_GPE_PROTO] = {
+		.name = "protocol",
+		.help = "VXLAN-GPE next protocol",
+		.next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan,
+					     hdr.proto)),
+	},
+	[ITEM_VXLAN_EXT_GPE_RSVD0] = {
+		.name = "rsvd0_gpe",
+		.help = "VXLAN-GPE rsvd0",
+		.next = NEXT(item_vxlan, NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan,
+					     hdr.rsvd0_gpe)),
+	},
 	[ITEM_E_TAG] = {
 		.name = "e_tag",
 		.help = "match E-Tag header",
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 2fbf9220d8..f1770ab950 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3697,6 +3697,10 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``vni {unsigned}``: VXLAN identifier.
   - ``last_rsvd {unsigned}``: VXLAN last reserved 8-bits.
+  - ``flags {unsigned}``: VXLAN flags
+  - ``group_policy_id {unsigned}``: VXLAN-GBP Group Policy ID.
+  - ``protocol {unsigned}`` : VXLAN-GPE next protocol
+  - ``rsvd0_gpe {unsigned}`` : VXLAN-GPE rsvd0
 
 - ``e_tag``: match IEEE 802.1BR E-Tag header.
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [v1 2/2] app/testpmd: introduce VXLAN-GBP and VXLAN-GPE fields
  2024-05-17  8:07 ` [v1 2/2] app/testpmd: introduce VXLAN-GBP and VXLAN-GPE fields Gavin Li
@ 2024-05-23  8:20   ` Ori Kam
  0 siblings, 0 replies; 4+ messages in thread
From: Ori Kam @ 2024-05-23  8:20 UTC (permalink / raw)
  To: Minggang(Gavin) Li, Matan Azrad, Slava Ovsiienko,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Aman Singh, Yuying Zhang
  Cc: dev, Raslan Darawsheh



> -----Original Message-----
> From: Minggang(Gavin) Li <gavinl@nvidia.com>
> Sent: Friday, May 17, 2024 11:08 AM
> Subject: [v1 2/2] app/testpmd: introduce VXLAN-GBP and VXLAN-GPE fields
> 
> After unification of VXLAN and all its extension protocols(VXLAN-GPE and
> VXLAN-GBP currently), all related RTE items should be spicified after
> 'vxlan'. And it's user's responsibility to specify correct UDP port for
> the protocol to be matched.
> 
> Below are the examples to match standard VXLAN, VXLAN-GPE and VXLAN-
> GBP.
> To match standard vxlan,
> ... / udp dst is 4789 / vxlan ... / ...
> To match VXLAN-GBP group policy ID 4321,
> ... / udp dst is 4789 / vxlan group_policy_id is 4321 ... / ...
> To match VXLAN-GPE,
> ... / udp dst is 4790 / vxlan protocol is 2 ... / ...
> 
> Signed-off-by: Gavin Li <gavinl@nvidia.com>
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
> ---

Acked-by: Ori Kam <orika@nvidia.com>

Best,
Ori

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-23  8:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-17  8:07 [v1 0/2] extend VXLAN header to support more extensions Gavin Li
2024-05-17  8:07 ` [v1 1/2] net: " Gavin Li
2024-05-17  8:07 ` [v1 2/2] app/testpmd: introduce VXLAN-GBP and VXLAN-GPE fields Gavin Li
2024-05-23  8:20   ` Ori Kam

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).