Skip to contentSkip to conversation

net: extend VXLAN header to support more extensions

RFC In review Gavin Li 4 participants 14 messages Jan 30, 2024 – Feb 19, 2024

lore
Share & tools
lore

Gavin Li

author
#0 lore raw

cover net: extend VXLAN header to support more extensions

This patch is to extend standard VXLAN header to support more extensions

Gavin Li (1):
net: extend VXLAN header to support more extensions
---
changelog:
v0->v1
- Addressed bit fields definition bug in union
---

 doc/guides/rel_notes/deprecation.rst |  5 +++
 lib/ethdev/rte_flow.h                | 13 +++++-
 lib/net/rte_vxlan.h                  | 67 ++++++++++++++++++++++++++--
 3 files changed, 80 insertions(+), 5 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

RFC 1/1 net: extend VXLAN header to support more extensions

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.

---
 doc/guides/rel_notes/deprecation.rst |  5 +++
 lib/ethdev/rte_flow.h                | 13 +++++-
 lib/net/rte_vxlan.h                  | 67 ++++++++++++++++++++++++++--
 3 files changed, 80 insertions(+), 5 deletions(-)
doc/guides/rel_notes/deprecation.rst +5 -0
index 81b93515cb..f9cf931b77 100644
@@ -95,6 +95,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``.
lib/ethdev/rte_flow.h +11 -2
index 1267c146e5..a9943106d9 100644
@@ -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.
@@ -1096,7 +1097,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 {
@@ -1339,6 +1344,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.
@@ -1360,7 +1366,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",
lib/net/rte_vxlan.h +64 -3

85 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

30/01/2024 12:25, Gavin Li:

Quoted 4 lines

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.

So VXLAN GPE, GBP, and original ones will all use the same struct. Asking confirmation to other reviewers:
- do we want to deprecate specific VXLAN GPE?
- do we want to plan for VXLAN GPE removal?

[...]

Quoted 6 lines
doc/guides/rel_notes/deprecation.rst +4 -0
+* 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.

[...]

Quoted 58 lines
doc/guides/rel_notes/deprecation.rst +52 -2
@@ -38,8 +38,65 @@ 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
+				};
+				/* Flag bits defined by GBP */
+				struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+					uint8_t rsvd_gbp1:3,
+						flag_i_gbp:1,
+						rsvd_gbp2: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
+				};
+			};
+			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. */
+				};
+				struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+					uint8_t rsvd0_gbp1:3,
+						policy_applied:1,
+						rsvd0_gbp2:2,
+						dont_learn:1,
+						rsvd0_gbp3:1;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+					uint8_t rsvd0_gbp1:1,
+						dont_learn:1,

doc/guides/rel_notes/deprecation.rst struct rte_vxlan_hdr { · line 102

Quoted 10 lines
doc/guides/rel_notes/deprecation.rst +7 -0
+						rsvd0_gbp2:2,
+						policy_applied:1,
+						rsvd0_gbp3:3;
+#endif
+					uint16_t policy_id;
+				};
+			};
 			uint8_t    vni[3];   /**< VXLAN identifier. */
 			uint8_t    rsvd1;    /**< Reserved. */
 		};

Naming looks OK.
Any different opinion?

#3 lore raw
Quoted 10 lines · Thomas Monjalon

30/01/2024 12:25, Gavin Li:

Quoted 4 lines

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.

So VXLAN GPE, GBP, and original ones will all use the same struct. Asking confirmation to other reviewers:
- do we want to deprecate specific VXLAN GPE?

For start, yes.

Quoted 1 line

- do we want to plan for VXLAN GPE removal?

Once deprecated, we can remove it.

Quoted 72 lines

[...]

Quoted 6 lines
doc/guides/rel_notes/deprecation.rst +4 -0
+* 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.

[...]

Quoted 62 lines
doc/guides/rel_notes/deprecation.rst +56 -2
@@ -38,8 +38,65 @@ 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
+                             };
+                             /* Flag bits defined by GBP */
+                             struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+                                     uint8_t rsvd_gbp1:3,
+                                             flag_i_gbp:1,
+                                             rsvd_gbp2: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
+                             };
+                     };
+                     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. */
+                             };
+                             struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+                                     uint8_t rsvd0_gbp1:3,
+                                             policy_applied:1,
+                                             rsvd0_gbp2:2,
+                                             dont_learn:1,
+                                             rsvd0_gbp3:1;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+                                     uint8_t rsvd0_gbp1:1,
+                                             dont_learn:1,
+                                             rsvd0_gbp2:2,
+                                             policy_applied:1,
+                                             rsvd0_gbp3:3;
+#endif
Quoted 8 lines

doc/guides/rel_notes/deprecation.rst struct rte_vxlan_hdr { · line 102

Quoted 6 lines
doc/guides/rel_notes/deprecation.rst +3 -0
+                                     uint16_t policy_id;
+                             };
+                     };
                      uint8_t    vni[3];   /**< VXLAN identifier. */
                      uint8_t    rsvd1;    /**< Reserved. */
              };

Naming looks OK.

+1

Quoted 3 lines

Any different opinion?

#4 lore raw
In reply to Gavin Li
Quoted 36 lines · Gavin Li

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    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Quoted 8 lines

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.

Hi Gavin,

The motivation is to prevent code duplication, and the code mentioned is
the driver code, right?

Overall OK to unify "struct rte_vxlan_hdr" although it makes the struct a little complex, perhaps we can consider extraction some nested structs as named struct, no strong opinion.

But not sure about removing the flow item types for VXLAN-GPE, or not adding for VXLAN-GBP.

Think about a case user adding a rule, which has a item type as VXLAN and in the protocol header some bits are set, lets say first word, last byte is set, how driver will know if to take it as GPE "next protocol" or "group policy id".

And if a specific HW detects VXLAN-GPE and VXLAN-GBP protocols as two separate protocols, won't only having capability to describe VXLAN protocol in SW be a limitation.

If the target is to remove code duplication in the driver, can it be accomplished by extracting code that parse the common fields of these protocols?

Quoted 17 lines

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.

---
 doc/guides/rel_notes/deprecation.rst |  5 +++
 lib/ethdev/rte_flow.h                | 13 +++++-
 lib/net/rte_vxlan.h                  | 67 ++++++++++++++++++++++++++--
 3 files changed, 80 insertions(+), 5 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -0
index 81b93515cb..f9cf931b77 100644

doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 103

Quoted 9 lines
doc/guides/rel_notes/deprecation.rst +5 -0
@@ -95,6 +95,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.
+
 

We have 24.11 in between.

Quoted 140 lines
doc/guides/rel_notes/deprecation.rst +0 -0
 * 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``.
lib/ethdev/rte_flow.h +11 -2
index 1267c146e5..a9943106d9 100644
@@ -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.
@@ -1096,7 +1097,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 {
@@ -1339,6 +1344,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.
@@ -1360,7 +1366,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",
lib/net/rte_vxlan.h +64 -3
index 997fc784fc..255c30f71d 100644
@@ -38,8 +38,65 @@ 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
+				};
+				/* Flag bits defined by GBP */
+				struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+					uint8_t rsvd_gbp1:3,
+						flag_i_gbp:1,
+						rsvd_gbp2: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
+				};
+			};
+			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. */
+				};
+				struct {
+#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
+					uint8_t rsvd0_gbp1:3,
+						policy_applied:1,
+						rsvd0_gbp2:2,
+						dont_learn:1,
+						rsvd0_gbp3:1;
+#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
+					uint8_t rsvd0_gbp1:1,
+						dont_learn:1,
+						rsvd0_gbp2:2,
+						policy_applied:1,
+						rsvd0_gbp3:3;
+#endif
+					uint16_t policy_id;
+				};
+			};
 			uint8_t    vni[3];   /**< VXLAN identifier. */
 			uint8_t    rsvd1;    /**< Reserved. */
 		};
@@ -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))
 
#5 lore raw

09/02/2024 00:54, Ferruh Yigit:

Quoted 46 lines · Gavin Li
Quoted 36 lines

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    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Quoted 8 lines

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.

Quoted 4 lines

Hi Gavin,

The motivation is to prevent code duplication, and the code mentioned is
the driver code, right?

The motivation is mainly to provide a unified and more explicit API.

Quoted 5 lines

Overall OK to unify "struct rte_vxlan_hdr" although it makes the struct a little complex, perhaps we can consider extraction some nested structs as named struct, no strong opinion.

Quoted 7 lines

But not sure about removing the flow item types for VXLAN-GPE, or not adding for VXLAN-GBP.

Think about a case user adding a rule, which has a item type as VXLAN and in the protocol header some bits are set, lets say first word, last byte is set, how driver will know if to take it as GPE "next protocol" or "group policy id".

The driver may decide depending on the UDP port and some distinguishing flags. If you want to match on GBP, you should includes the GBP flag in your pattern, no need to use a separate item.

Quoted 3 lines

And if a specific HW detects VXLAN-GPE and VXLAN-GBP protocols as two separate protocols, won't only having capability to describe VXLAN protocol in SW be a limitation.

I think the driver may know based on the flow rule.

That's a good question about the item granularity.
What is the separation between a different protocol and protocol options? How flow item should match protocol variations?
My current thinking is that we should minimize the number of items.

Quoted 3 lines

If the target is to remove code duplication in the driver, can it be accomplished by extracting code that parse the common fields of these protocols?

Driver code is not a concern as far as any driver can implement the API.

Quoted 20 lines
Quoted 20 lines

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.

---
 doc/guides/rel_notes/deprecation.rst |  5 +++
 lib/ethdev/rte_flow.h                | 13 +++++-
 lib/net/rte_vxlan.h                  | 67 ++++++++++++++++++++++++++--
 3 files changed, 80 insertions(+), 5 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -0
index 81b93515cb..f9cf931b77 100644
@@ -95,6 +95,11 @@ Deprecation Notices
   - ``rte_flow_item_pppoe``
   - ``rte_flow_item_pppoe_proto_id``
 
Quoted 8 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices

Quoted 6 lines
doc/guides/rel_notes/deprecation.rst +5 -0
+* 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.
+
 

We have 24.11 in between.

Isn't it too soon?
Should we remove at all?

#6 lore raw
Quoted 47 lines · Thomas Monjalon

09/02/2024 00:54, Ferruh Yigit:

Quoted 46 lines · Gavin Li
Quoted 44 lines

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.

Quoted 7 lines
Quoted 4 lines

Hi Gavin,

The motivation is to prevent code duplication, and the code mentioned is
the driver code, right?

The motivation is mainly to provide a unified and more explicit API.

From user perspective, I think existing approach is more explicit, because it sets VXLAN or VXLAN_GPE flow types.

I am trying to understand the benefit, how unifying flow type in the API helps to the user?

Quoted 8 lines
Quoted 8 lines

Overall OK to unify "struct rte_vxlan_hdr" although it makes the struct a little complex, perhaps we can consider extraction some nested structs as named struct, no strong opinion.

But not sure about removing the flow item types for VXLAN-GPE, or not adding for VXLAN-GBP.

Quoted 9 lines
Quoted 4 lines

Think about a case user adding a rule, which has a item type as VXLAN and in the protocol header some bits are set, lets say first word, last byte is set, how driver will know if to take it as GPE "next protocol" or "group policy id".

The driver may decide depending on the UDP port and some distinguishing flags. If you want to match on GBP, you should includes the GBP flag in your pattern, no need to use a separate item.

Why not be more explicit?
It helps to driver to know more about the pattern to be able to create proper flow rule, if there is an obvious way for driver to differentiate these protocol extensions, and flow item type is redundant, I can understand the proposal, but otherwise I think better to keep flow items for extensions.

When a rule is set in HW, HW may not care about the protocol, as long as bits in the rule match with the packet, HW can apply the action. But for driver to be able to set the rule properly, it needs more explicit information.

Lets assume driver API get a pattern with 'RTE_FLOW_ITEM_TYPE_VXLAN' type and "struct rte_flow_item_vxlan", at this point driver doesn't know if it is VXLAN or any of the extensions.
Should driver go and check GBP flags to deduce if it is GBP flag, and what if they are all zero, how can driver can tell if this is GBP flag that is zero or is it VXLAN header and bit is reserved.

Or I will just make up a sample, it may not be accurate but please take it as a case to prove a point.
Lets assume driver API again get "struct rte_flow_item_vxlan" whose first word's last bit is set, which union in the struct will driver check to detect this, GPE one or GBP one?
This can be GPE-"next protocol" or GBP-"Group policy id", if driver knows this it can set the mask better for the field in the rule. Driver may try to deduce this extension information from other information, but why not proper specific flow type for each extension instead?

Quoted 11 lines
Quoted 3 lines

And if a specific HW detects VXLAN-GPE and VXLAN-GBP protocols as two separate protocols, won't only having capability to describe VXLAN protocol in SW be a limitation.

I think the driver may know based on the flow rule.

That's a good question about the item granularity.
What is the separation between a different protocol and protocol options? How flow item should match protocol variations?
My current thinking is that we should minimize the number of items.

Quoted 6 lines
Quoted 3 lines

If the target is to remove code duplication in the driver, can it be accomplished by extracting code that parse the common fields of these protocols?

Driver code is not a concern as far as any driver can implement the API.

Got it, I want to clarify this one.
Where the code duplication via copy/paste that commit log mention occurs?

Quoted 33 lines
Quoted 21 lines
Quoted 21 lines

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.

---
 doc/guides/rel_notes/deprecation.rst |  5 +++
 lib/ethdev/rte_flow.h                | 13 +++++-
 lib/net/rte_vxlan.h                  | 67 ++++++++++++++++++++++++++--
 3 files changed, 80 insertions(+), 5 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -0
index 81b93515cb..f9cf931b77 100644
@@ -95,6 +95,11 @@ Deprecation Notices
   - ``rte_flow_item_pppoe``
   - ``rte_flow_item_pppoe_proto_id``
 
Quoted 8 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices

Quoted 6 lines
doc/guides/rel_notes/deprecation.rst +5 -0
+* 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.
+
 

We have 24.11 in between.

Isn't it too soon?
Should we remove at all?

#7 lore raw

09/02/2024 13:11, Ferruh Yigit:

Quoted 80 lines · Thomas Monjalon
Quoted 47 lines

09/02/2024 00:54, Ferruh Yigit:

Quoted 46 lines · Gavin Li
Quoted 44 lines

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.

Quoted 7 lines
Quoted 4 lines

Hi Gavin,

The motivation is to prevent code duplication, and the code mentioned is
the driver code, right?

The motivation is mainly to provide a unified and more explicit API.

From user perspective, I think existing approach is more explicit, because it sets VXLAN or VXLAN_GPE flow types.

I am trying to understand the benefit, how unifying flow type in the API helps to the user?

Quoted 8 lines
Quoted 8 lines

Overall OK to unify "struct rte_vxlan_hdr" although it makes the struct a little complex, perhaps we can consider extraction some nested structs as named struct, no strong opinion.

But not sure about removing the flow item types for VXLAN-GPE, or not adding for VXLAN-GBP.

Quoted 9 lines
Quoted 4 lines

Think about a case user adding a rule, which has a item type as VXLAN and in the protocol header some bits are set, lets say first word, last byte is set, how driver will know if to take it as GPE "next protocol" or "group policy id".

The driver may decide depending on the UDP port and some distinguishing flags. If you want to match on GBP, you should includes the GBP flag in your pattern, no need to use a separate item.

Quoted 6 lines

Why not be more explicit?
It helps to driver to know more about the pattern to be able to create proper flow rule, if there is an obvious way for driver to differentiate these protocol extensions, and flow item type is redundant, I can understand the proposal, but otherwise I think better to keep flow items for extensions.

In any case we need the simple VXLAN item.
If we have GPE and GBP specialized items,
what means a match on the simple VXLAN?
Does it include packets with other extensions or exclude them? Matching the bits in the protocol make such decision explicit.

Quoted 4 lines

When a rule is set in HW, HW may not care about the protocol, as long as bits in the rule match with the packet, HW can apply the action. But for driver to be able to set the rule properly, it needs more explicit information.

Yes information is in the pattern to match.

Quoted 3 lines

Lets assume driver API get a pattern with 'RTE_FLOW_ITEM_TYPE_VXLAN' type and "struct rte_flow_item_vxlan", at this point driver doesn't know if it is VXLAN or any of the extensions.

Yes it knows because of the matched bits in the pattern. If the rule specify a match on GBP flag = 1, it is GBP only. If the rule specify a match on GBP flag = 0, it excludes GBP. If the rule does not mask GBP flag, it includes GBP.

Quoted 1 line

Should driver go and check GBP flags to deduce if it is GBP flag, and

Yes

Quoted 2 lines

what if they are all zero, how can driver can tell if this is GBP flag that is zero or is it VXLAN header and bit is reserved.

As explained above, value & mask does the matching.

Quoted 5 lines

Or I will just make up a sample, it may not be accurate but please take it as a case to prove a point.
Lets assume driver API again get "struct rte_flow_item_vxlan" whose first word's last bit is set, which union in the struct will driver check to detect this, GPE one or GBP one?

It depends on the G flag.

Quoted 5 lines

This can be GPE-"next protocol" or GBP-"Group policy id", if driver knows this it can set the mask better for the field in the rule. Driver may try to deduce this extension information from other information, but why not proper specific flow type for each extension instead?

I believe relying on bit matching is a cleaner approach than creating a new item each time a protocol has a variation. And it makes include/exclude policy easier to understand thanks to the value/mask logic.

Quoted 53 lines
Quoted 11 lines
Quoted 3 lines

And if a specific HW detects VXLAN-GPE and VXLAN-GBP protocols as two separate protocols, won't only having capability to describe VXLAN protocol in SW be a limitation.

I think the driver may know based on the flow rule.

That's a good question about the item granularity.
What is the separation between a different protocol and protocol options? How flow item should match protocol variations?
My current thinking is that we should minimize the number of items.

Quoted 6 lines
Quoted 3 lines

If the target is to remove code duplication in the driver, can it be accomplished by extracting code that parse the common fields of these protocols?

Driver code is not a concern as far as any driver can implement the API.

Got it, I want to clarify this one.
Where the code duplication via copy/paste that commit log mention occurs?

Quoted 32 lines
Quoted 21 lines
Quoted 21 lines

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.

---
 doc/guides/rel_notes/deprecation.rst |  5 +++
 lib/ethdev/rte_flow.h                | 13 +++++-
 lib/net/rte_vxlan.h                  | 67 ++++++++++++++++++++++++++--
 3 files changed, 80 insertions(+), 5 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -0
index 81b93515cb..f9cf931b77 100644
@@ -95,6 +95,11 @@ Deprecation Notices
   - ``rte_flow_item_pppoe``
   - ``rte_flow_item_pppoe_proto_id``
 
Quoted 8 lines

doc/guides/rel_notes/deprecation.rst Deprecation Notices

Quoted 6 lines
doc/guides/rel_notes/deprecation.rst +5 -0
+* 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.
+
 

We have 24.11 in between.

Isn't it too soon?
Should we remove at all?

#8 lore raw
Quoted 101 lines · Thomas Monjalon

09/02/2024 13:11, Ferruh Yigit:

Quoted 80 lines · Thomas Monjalon
Quoted 47 lines

09/02/2024 00:54, Ferruh Yigit:

Quoted 46 lines · Gavin Li
Quoted 44 lines

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.

Quoted 7 lines
Quoted 4 lines

Hi Gavin,

The motivation is to prevent code duplication, and the code mentioned is
the driver code, right?

The motivation is mainly to provide a unified and more explicit API.

From user perspective, I think existing approach is more explicit, because it sets VXLAN or VXLAN_GPE flow types.

I am trying to understand the benefit, how unifying flow type in the API helps to the user?

Quoted 8 lines
Quoted 8 lines

Overall OK to unify "struct rte_vxlan_hdr" although it makes the struct a little complex, perhaps we can consider extraction some nested structs as named struct, no strong opinion.

But not sure about removing the flow item types for VXLAN-GPE, or not adding for VXLAN-GBP.

Quoted 9 lines
Quoted 4 lines

Think about a case user adding a rule, which has a item type as VXLAN and in the protocol header some bits are set, lets say first word, last byte is set, how driver will know if to take it as GPE "next protocol" or "group policy id".

The driver may decide depending on the UDP port and some distinguishing flags. If you want to match on GBP, you should includes the GBP flag in your pattern, no need to use a separate item.

Quoted 6 lines

Why not be more explicit?
It helps to driver to know more about the pattern to be able to create proper flow rule, if there is an obvious way for driver to differentiate these protocol extensions, and flow item type is redundant, I can understand the proposal, but otherwise I think better to keep flow items for extensions.

In any case we need the simple VXLAN item.
If we have GPE and GBP specialized items,
what means a match on the simple VXLAN?
Does it include packets with other extensions or exclude them? Matching the bits in the protocol make such decision explicit.

Quoted 4 lines

When a rule is set in HW, HW may not care about the protocol, as long as bits in the rule match with the packet, HW can apply the action. But for driver to be able to set the rule properly, it needs more explicit information.

Yes information is in the pattern to match.

Quoted 9 lines
Quoted 3 lines

Lets assume driver API get a pattern with 'RTE_FLOW_ITEM_TYPE_VXLAN' type and "struct rte_flow_item_vxlan", at this point driver doesn't know if it is VXLAN or any of the extensions.

Yes it knows because of the matched bits in the pattern. If the rule specify a match on GBP flag = 1, it is GBP only. If the rule specify a match on GBP flag = 0, it excludes GBP. If the rule does not mask GBP flag, it includes GBP.

OK, VXLAN-GBP protocol has a GBP flag that gives a way to differentiate the extension, so flow item for it becomes redundant and we can get rid of it.

Is it same for the other extensions?
If we use VXLAN flow item and by setting specific field in pattern can we differentiate VXLAN and any other extension?
Or in some cases other information, like UDP port, needs to be taken into account to differentiate protocol/extension?

I found a spec for VXLAN-GBP, but it shows as sub-header for VXLAN-GPE, different than what this RFC describes:
https://datatracker.ietf.org/doc/html/draft-lemon-vxlan-gpe-gbp

Can you please share link for VXLAN-GBP Extension spec?

#9 lore raw

09/02/2024 15:58, Ferruh Yigit:

Quoted 113 lines · Thomas Monjalon
Quoted 101 lines

09/02/2024 13:11, Ferruh Yigit:

Quoted 80 lines · Thomas Monjalon
Quoted 47 lines

09/02/2024 00:54, Ferruh Yigit:

Quoted 46 lines · Gavin Li
Quoted 44 lines

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.

Quoted 7 lines
Quoted 4 lines

Hi Gavin,

The motivation is to prevent code duplication, and the code mentioned is
the driver code, right?

The motivation is mainly to provide a unified and more explicit API.

From user perspective, I think existing approach is more explicit, because it sets VXLAN or VXLAN_GPE flow types.

I am trying to understand the benefit, how unifying flow type in the API helps to the user?

Quoted 8 lines
Quoted 8 lines

Overall OK to unify "struct rte_vxlan_hdr" although it makes the struct a little complex, perhaps we can consider extraction some nested structs as named struct, no strong opinion.

But not sure about removing the flow item types for VXLAN-GPE, or not adding for VXLAN-GBP.

Quoted 9 lines
Quoted 4 lines

Think about a case user adding a rule, which has a item type as VXLAN and in the protocol header some bits are set, lets say first word, last byte is set, how driver will know if to take it as GPE "next protocol" or "group policy id".

The driver may decide depending on the UDP port and some distinguishing flags. If you want to match on GBP, you should includes the GBP flag in your pattern, no need to use a separate item.

Quoted 6 lines

Why not be more explicit?
It helps to driver to know more about the pattern to be able to create proper flow rule, if there is an obvious way for driver to differentiate these protocol extensions, and flow item type is redundant, I can understand the proposal, but otherwise I think better to keep flow items for extensions.

In any case we need the simple VXLAN item.
If we have GPE and GBP specialized items,
what means a match on the simple VXLAN?
Does it include packets with other extensions or exclude them? Matching the bits in the protocol make such decision explicit.

Quoted 4 lines

When a rule is set in HW, HW may not care about the protocol, as long as bits in the rule match with the packet, HW can apply the action. But for driver to be able to set the rule properly, it needs more explicit information.

Yes information is in the pattern to match.

Quoted 9 lines
Quoted 3 lines

Lets assume driver API get a pattern with 'RTE_FLOW_ITEM_TYPE_VXLAN' type and "struct rte_flow_item_vxlan", at this point driver doesn't know if it is VXLAN or any of the extensions.

Yes it knows because of the matched bits in the pattern. If the rule specify a match on GBP flag = 1, it is GBP only. If the rule specify a match on GBP flag = 0, it excludes GBP. If the rule does not mask GBP flag, it includes GBP.

Quoted 3 lines

OK, VXLAN-GBP protocol has a GBP flag that gives a way to differentiate the extension, so flow item for it becomes redundant and we can get rid of it.

Yes I think so.

Quoted 5 lines

Is it same for the other extensions?
If we use VXLAN flow item and by setting specific field in pattern can we differentiate VXLAN and any other extension?
Or in some cases other information, like UDP port, needs to be taken into account to differentiate protocol/extension?

For VXLAN-GPE, differentiation is on UDP port.
Remember we have an API to fill some UDP ports:
rte_eth_dev_udp_tunnel_port_add with RTE_ETH_TUNNEL_TYPE_VXLAN_GPE

The UDP port value/mask may be part of the flow rule pattern.

Quoted 5 lines

I found a spec for VXLAN-GBP, but it shows as sub-header for VXLAN-GPE, different than what this RFC describes:
https://datatracker.ietf.org/doc/html/draft-lemon-vxlan-gpe-gbp

Can you please share link for VXLAN-GBP Extension spec?

I will let Gavin explain here, I'm not an expert.

#10 lore raw
Quoted 126 lines · Thomas Monjalon

09/02/2024 15:58, Ferruh Yigit:

Quoted 113 lines · Thomas Monjalon
Quoted 101 lines

09/02/2024 13:11, Ferruh Yigit:

Quoted 80 lines · Thomas Monjalon
Quoted 47 lines

09/02/2024 00:54, Ferruh Yigit:

Quoted 46 lines · Gavin Li
Quoted 44 lines

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.

Quoted 7 lines
Quoted 4 lines

Hi Gavin,

The motivation is to prevent code duplication, and the code mentioned is
the driver code, right?

The motivation is mainly to provide a unified and more explicit API.

From user perspective, I think existing approach is more explicit, because it sets VXLAN or VXLAN_GPE flow types.

I am trying to understand the benefit, how unifying flow type in the API helps to the user?

Quoted 8 lines
Quoted 8 lines

Overall OK to unify "struct rte_vxlan_hdr" although it makes the struct a little complex, perhaps we can consider extraction some nested structs as named struct, no strong opinion.

But not sure about removing the flow item types for VXLAN-GPE, or not adding for VXLAN-GBP.

Quoted 9 lines
Quoted 4 lines

Think about a case user adding a rule, which has a item type as VXLAN and in the protocol header some bits are set, lets say first word, last byte is set, how driver will know if to take it as GPE "next protocol" or "group policy id".

The driver may decide depending on the UDP port and some distinguishing flags. If you want to match on GBP, you should includes the GBP flag in your pattern, no need to use a separate item.

Quoted 6 lines

Why not be more explicit?
It helps to driver to know more about the pattern to be able to create proper flow rule, if there is an obvious way for driver to differentiate these protocol extensions, and flow item type is redundant, I can understand the proposal, but otherwise I think better to keep flow items for extensions.

In any case we need the simple VXLAN item.
If we have GPE and GBP specialized items,
what means a match on the simple VXLAN?
Does it include packets with other extensions or exclude them? Matching the bits in the protocol make such decision explicit.

Quoted 4 lines

When a rule is set in HW, HW may not care about the protocol, as long as bits in the rule match with the packet, HW can apply the action. But for driver to be able to set the rule properly, it needs more explicit information.

Yes information is in the pattern to match.

Quoted 9 lines
Quoted 3 lines

Lets assume driver API get a pattern with 'RTE_FLOW_ITEM_TYPE_VXLAN' type and "struct rte_flow_item_vxlan", at this point driver doesn't know if it is VXLAN or any of the extensions.

Yes it knows because of the matched bits in the pattern. If the rule specify a match on GBP flag = 1, it is GBP only. If the rule specify a match on GBP flag = 0, it excludes GBP. If the rule does not mask GBP flag, it includes GBP.

Quoted 3 lines

OK, VXLAN-GBP protocol has a GBP flag that gives a way to differentiate the extension, so flow item for it becomes redundant and we can get rid of it.

Yes I think so.

Quoted 5 lines

Is it same for the other extensions?
If we use VXLAN flow item and by setting specific field in pattern can we differentiate VXLAN and any other extension?
Or in some cases other information, like UDP port, needs to be taken into account to differentiate protocol/extension?

Quoted 6 lines

For VXLAN-GPE, differentiation is on UDP port.
Remember we have an API to fill some UDP ports:
rte_eth_dev_udp_tunnel_port_add with RTE_ETH_TUNNEL_TYPE_VXLAN_GPE

The UDP port value/mask may be part of the flow rule pattern.

So one option is use vxlan extension specific flow item, which is current case.

Other option is use generic vxlan flow item, and detect the extension using other fields, which is this proposal.

Both works, but specially if driver needs other protocol information, like UDP port, to detect the vxlan protocol extension, why not just keep continue with existing explicit flow item.

OK for merging vxlan struct in net library.
But I am failing to see benefit to change the flow item and structs. No strong opinion, it can be good to get more comments.

Quoted 10 lines
Quoted 6 lines

I found a spec for VXLAN-GBP, but it shows as sub-header for VXLAN-GPE, different than what this RFC describes:
https://datatracker.ietf.org/doc/html/draft-lemon-vxlan-gpe-gbp

Can you please share link for VXLAN-GBP Extension spec?

I will let Gavin explain here, I'm not an expert.

author
#11 lore raw
In reply to Thomas Monjalon
Quoted 133 lines · Thomas Monjalon

09/02/2024 15:58, Ferruh Yigit:

Quoted 113 lines · Thomas Monjalon
Quoted 101 lines

09/02/2024 13:11, Ferruh Yigit:

Quoted 80 lines · Thomas Monjalon
Quoted 47 lines

09/02/2024 00:54, Ferruh Yigit:

Quoted 46 lines · Gavin Li
Quoted 44 lines

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.

Quoted 7 lines
Quoted 4 lines

Hi Gavin,

The motivation is to prevent code duplication, and the code mentioned is
the driver code, right?

The motivation is mainly to provide a unified and more explicit API.

From user perspective, I think existing approach is more explicit,
because it sets VXLAN or VXLAN_GPE flow types.

I am trying to understand the benefit, how unifying flow type in the API helps to the user?

Quoted 8 lines
Quoted 8 lines

Overall OK to unify "struct rte_vxlan_hdr" although it makes the struct a little complex, perhaps we can consider extraction some nested structs as named struct, no strong opinion.

But not sure about removing the flow item types for VXLAN-GPE, or not adding for VXLAN-GBP.

Quoted 9 lines
Quoted 4 lines

Think about a case user adding a rule, which has a item type as VXLAN and in the protocol header some bits are set, lets say first word, last byte is set, how driver will know if to take it as GPE "next protocol" or "group policy id".

The driver may decide depending on the UDP port and some distinguishing flags. If you want to match on GBP, you should includes the GBP flag in your pattern, no need to use a separate item.

Quoted 6 lines

Why not be more explicit?
It helps to driver to know more about the pattern to be able to create proper flow rule, if there is an obvious way for driver to differentiate these protocol extensions, and flow item type is redundant, I can understand the proposal, but otherwise I think better to keep flow items for extensions.

In any case we need the simple VXLAN item.
If we have GPE and GBP specialized items,
what means a match on the simple VXLAN?
Does it include packets with other extensions or exclude them? Matching the bits in the protocol make such decision explicit.

Quoted 4 lines

When a rule is set in HW, HW may not care about the protocol, as long as bits in the rule match with the packet, HW can apply the action. But for driver to be able to set the rule properly, it needs more explicit information.

Yes information is in the pattern to match.

Quoted 9 lines
Quoted 3 lines

Lets assume driver API get a pattern with 'RTE_FLOW_ITEM_TYPE_VXLAN' type and "struct rte_flow_item_vxlan", at this point driver doesn't know if it is VXLAN or any of the extensions.

Yes it knows because of the matched bits in the pattern. If the rule specify a match on GBP flag = 1, it is GBP only. If the rule specify a match on GBP flag = 0, it excludes GBP. If the rule does not mask GBP flag, it includes GBP.

Quoted 3 lines

OK, VXLAN-GBP protocol has a GBP flag that gives a way to differentiate the extension, so flow item for it becomes redundant and we can get rid of it.

Yes I think so.

Quoted 5 lines

Is it same for the other extensions?
If we use VXLAN flow item and by setting specific field in pattern can we differentiate VXLAN and any other extension?
Or in some cases other information, like UDP port, needs to be taken into account to differentiate protocol/extension?

For VXLAN-GPE, differentiation is on UDP port.
Remember we have an API to fill some UDP ports:
rte_eth_dev_udp_tunnel_port_add with RTE_ETH_TUNNEL_TYPE_VXLAN_GPE

The UDP port value/mask may be part of the flow rule pattern.

Quoted 7 lines
Quoted 5 lines

I found a spec for VXLAN-GBP, but it shows as sub-header for VXLAN-GPE, different than what this RFC describes:
https://datatracker.ietf.org/doc/html/draft-lemon-vxlan-gpe-gbp

Can you please share link for VXLAN-GBP Extension spec?

I will let Gavin explain here, I'm not an expertThe RFC mentioned, aka draft-lemon-vxlan-gpe-gbp was to define VXLAN-GBP

as a sub header of VXLAN-GPE by assigning a next protocol num of VXLAN-GPE for VXLAN-GBP, which has been obsoleted since draft-ietf-nvo3-vxlan-gpe-09, the latest is draft-ietf-nvo3-vxlan-gpe-13. It was temporarily valid from draft-ietf-nvo3-vxlan-gpe-05 to draft-ietf-nvo3-vxlan-gpe-08.

The VXLAN-GBP we are discussing in this thread is an VXLAN extension parallel to VXLAN-GPE.

Quoted 2 lines
author
#12 lore raw
In reply to Thomas Monjalon
Quoted 133 lines · Thomas Monjalon

09/02/2024 15:58, Ferruh Yigit:

Quoted 113 lines · Thomas Monjalon
Quoted 101 lines

09/02/2024 13:11, Ferruh Yigit:

Quoted 80 lines · Thomas Monjalon
Quoted 47 lines

09/02/2024 00:54, Ferruh Yigit:

Quoted 46 lines · Gavin Li
Quoted 44 lines

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.

Quoted 7 lines
Quoted 4 lines

Hi Gavin,

The motivation is to prevent code duplication, and the code mentioned is
the driver code, right?

The motivation is mainly to provide a unified and more explicit API.

From user perspective, I think existing approach is more explicit,
because it sets VXLAN or VXLAN_GPE flow types.

I am trying to understand the benefit, how unifying flow type in the API helps to the user?

Quoted 8 lines
Quoted 8 lines

Overall OK to unify "struct rte_vxlan_hdr" although it makes the struct a little complex, perhaps we can consider extraction some nested structs as named struct, no strong opinion.

But not sure about removing the flow item types for VXLAN-GPE, or not adding for VXLAN-GBP.

Quoted 9 lines
Quoted 4 lines

Think about a case user adding a rule, which has a item type as VXLAN and in the protocol header some bits are set, lets say first word, last byte is set, how driver will know if to take it as GPE "next protocol" or "group policy id".

The driver may decide depending on the UDP port and some distinguishing flags. If you want to match on GBP, you should includes the GBP flag in your pattern, no need to use a separate item.

Quoted 6 lines

Why not be more explicit?
It helps to driver to know more about the pattern to be able to create proper flow rule, if there is an obvious way for driver to differentiate these protocol extensions, and flow item type is redundant, I can understand the proposal, but otherwise I think better to keep flow items for extensions.

In any case we need the simple VXLAN item.
If we have GPE and GBP specialized items,
what means a match on the simple VXLAN?
Does it include packets with other extensions or exclude them? Matching the bits in the protocol make such decision explicit.

Quoted 4 lines

When a rule is set in HW, HW may not care about the protocol, as long as bits in the rule match with the packet, HW can apply the action. But for driver to be able to set the rule properly, it needs more explicit information.

Yes information is in the pattern to match.

Quoted 9 lines
Quoted 3 lines

Lets assume driver API get a pattern with 'RTE_FLOW_ITEM_TYPE_VXLAN' type and "struct rte_flow_item_vxlan", at this point driver doesn't know if it is VXLAN or any of the extensions.

Yes it knows because of the matched bits in the pattern. If the rule specify a match on GBP flag = 1, it is GBP only. If the rule specify a match on GBP flag = 0, it excludes GBP. If the rule does not mask GBP flag, it includes GBP.

Quoted 3 lines

OK, VXLAN-GBP protocol has a GBP flag that gives a way to differentiate the extension, so flow item for it becomes redundant and we can get rid of it.

Yes I think so.

Quoted 5 lines

Is it same for the other extensions?
If we use VXLAN flow item and by setting specific field in pattern can we differentiate VXLAN and any other extension?
Or in some cases other information, like UDP port, needs to be taken into account to differentiate protocol/extension?

For VXLAN-GPE, differentiation is on UDP port.
Remember we have an API to fill some UDP ports:
rte_eth_dev_udp_tunnel_port_add with RTE_ETH_TUNNEL_TYPE_VXLAN_GPE

The UDP port value/mask may be part of the flow rule pattern.

Quoted 7 lines
Quoted 5 lines

I found a spec for VXLAN-GBP, but it shows as sub-header for VXLAN-GPE, different than what this RFC describes:
https://datatracker.ietf.org/doc/html/draft-lemon-vxlan-gpe-gbp

Can you please share link for VXLAN-GBP Extension spec?

I will let Gavin explain here, I'm not an expert.

Sorry for the wrong format of my last mail. Let me try again.

The RFC mentioned, aka draft-lemon-vxlan-gpe-gbp was to define VXLAN-GBP
as a sub header of VXLAN-GPE by assigning a next protocol num of VXLAN-GPE for VXLAN-GBP, which has been obsoleted since draft-ietf-nvo3-vxlan-gpe-09, the latest is draft-ietf-nvo3-vxlan-gpe-13. It was temporarily valid from draft-ietf-nvo3-vxlan-gpe-05 to draft-ietf-nvo3-vxlan-gpe-08.

The VXLAN-GBP we are discussing in this thread is an VXLAN extension parallel to VXLAN-GPE.

The RFC introduced VXLAN-GBP sub header to VXLAN-GPE is https://datatracker.ietf.org/doc/html/draft-ietf-nvo3-vxlan-gpe-05.

The RFC obsoleted the sub header is https://datatracker.ietf.org/doc/html/draft-ietf-nvo3-vxlan-gpe-09.

The latest RFC of VXLAN-GPE is https://datatracker.ietf.org/doc/html/draft-ietf-nvo3-vxlan-gpe-13.

Quoted 2 lines
author
#13 lore raw
Quoted 158 lines · Gavin Li
Quoted 142 lines · Thomas Monjalon

09/02/2024 15:58, Ferruh Yigit:

Quoted 122 lines · Thomas Monjalon
Quoted 110 lines

09/02/2024 13:11, Ferruh Yigit:

Quoted 89 lines · Thomas Monjalon
Quoted 56 lines

09/02/2024 00:54, Ferruh Yigit:

Quoted 55 lines · Gavin Li
Quoted 53 lines

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.

Quoted 7 lines
Quoted 4 lines

Hi Gavin,

The motivation is to prevent code duplication, and the code mentioned is the driver code, right?

The motivation is mainly to provide a unified and more explicit API.

 From user perspective, I think existing approach is more explicit, because it sets VXLAN or VXLAN_GPE flow types.

I am trying to understand the benefit, how unifying flow type in the API helps to the user?

Quoted 8 lines
Quoted 8 lines

Overall OK to unify "struct rte_vxlan_hdr" although it makes the struct a little complex, perhaps we can consider extraction some nested structs as named struct, no strong opinion.

But not sure about removing the flow item types for VXLAN-GPE, or not adding for VXLAN-GBP.

Quoted 9 lines
Quoted 4 lines

Think about a case user adding a rule, which has a item type as VXLAN and in the protocol header some bits are set, lets say first word, last byte is set, how driver will know if to take it as GPE "next protocol" or "group policy id".

The driver may decide depending on the UDP port and some distinguishing flags. If you want to match on GBP, you should includes the GBP flag in your pattern, no need to use a separate item.

Quoted 6 lines

Why not be more explicit?
It helps to driver to know more about the pattern to be able to create proper flow rule, if there is an obvious way for driver to differentiate these protocol extensions, and flow item type is redundant, I can understand the proposal, but otherwise I think better to keep flow items for extensions.

In any case we need the simple VXLAN item.
If we have GPE and GBP specialized items,
what means a match on the simple VXLAN?
Does it include packets with other extensions or exclude them? Matching the bits in the protocol make such decision explicit.

Quoted 4 lines

When a rule is set in HW, HW may not care about the protocol, as long as bits in the rule match with the packet, HW can apply the action. But for driver to be able to set the rule properly, it needs more explicit information.

Yes information is in the pattern to match.

Quoted 9 lines
Quoted 3 lines

Lets assume driver API get a pattern with 'RTE_FLOW_ITEM_TYPE_VXLAN' type and "struct rte_flow_item_vxlan", at this point driver doesn't know if it is VXLAN or any of the extensions.

Yes it knows because of the matched bits in the pattern. If the rule specify a match on GBP flag = 1, it is GBP only. If the rule specify a match on GBP flag = 0, it excludes GBP. If the rule does not mask GBP flag, it includes GBP.

Quoted 3 lines

OK, VXLAN-GBP protocol has a GBP flag that gives a way to differentiate the extension, so flow item for it becomes redundant and we can get rid of it.

Yes I think so.

Quoted 5 lines

Is it same for the other extensions?
If we use VXLAN flow item and by setting specific field in pattern can we differentiate VXLAN and any other extension?
Or in some cases other information, like UDP port, needs to be taken into account to differentiate protocol/extension?

For VXLAN-GPE, differentiation is on UDP port.
Remember we have an API to fill some UDP ports:
rte_eth_dev_udp_tunnel_port_add with RTE_ETH_TUNNEL_TYPE_VXLAN_GPE

The UDP port value/mask may be part of the flow rule pattern.

Quoted 7 lines
Quoted 5 lines

I found a spec for VXLAN-GBP, but it shows as sub-header for VXLAN-GPE, different than what this RFC describes:
https://datatracker.ietf.org/doc/html/draft-lemon-vxlan-gpe-gbp

Can you please share link for VXLAN-GBP Extension spec?

I will let Gavin explain here, I'm not an expert.

Sorry for the wrong format of my last mail. Let me try again.

The RFC mentioned, aka draft-lemon-vxlan-gpe-gbp was to define VXLAN-GBP
as a sub header of VXLAN-GPE by assigning a next protocol num of VXLAN-GPE for VXLAN-GBP, which has been obsoleted since draft-ietf-nvo3-vxlan-gpe-09, the latest is draft-ietf-nvo3-vxlan-gpe-13. It was temporarily valid from draft-ietf-nvo3-vxlan-gpe-05 to draft-ietf-nvo3-vxlan-gpe-08.

Quoted 7 lines

The VXLAN-GBP we are discussing in this thread is an VXLAN extension parallel to VXLAN-GPE.

The RFC introduced VXLAN-GBP sub header to VXLAN-GPE is https://datatracker.ietf.org/doc/html/draft-ietf-nvo3-vxlan-gpe-05.

The RFC obsoleted the sub header is https://datatracker.ietf.org/doc/html/draft-ietf-nvo3-vxlan-gpe-09.

The latest RFC of VXLAN-GPE is https://datatracker.ietf.org/doc/html/draft-ietf-nvo3-vxlan-gpe-13.

And the latest RFC of VXLAN-GPB is https://datatracker.ietf.org/doc/html/draft-smith-vxlan-group-policy-05.

Quoted 4 lines
Quoted 4 lines