Skip to contentSkip to conversation

mbuf: support eCPRI hardware packet type Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.

PATCH New Lingyu Liu 5 participants 12 messages Apr 17, 2021 – Apr 22, 2021 Network drivers

lore
Share & tools
lore

Lingyu Liu

author
#0 lore raw

PATCH 1/1 mbuf: support eCPRI hardware packet type Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.

---
 app/test-pmd/util.c              | 25 ++++++++++++++++---------
 lib/librte_mbuf/rte_mbuf_ptype.c |  2 ++
 lib/librte_mbuf/rte_mbuf_ptype.h | 22 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 9 deletions(-)
app/test-pmd/util.c +16 -9
index a9e431a8b2..494ebbf909 100644
@@ -258,16 +258,23 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 				udp_hdr = rte_pktmbuf_mtod_offset(mb,
 				struct rte_udp_hdr *,
 				l2_len + l3_len);
-				l4_len = sizeof(struct rte_udp_hdr);
-				vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
-				struct rte_vxlan_hdr *,
-				l2_len + l3_len + l4_len);
 				udp_port = RTE_BE_TO_CPU_16(udp_hdr->dst_port);
-				vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni);
-				MKDUMPSTR(print_buf, buf_size, cur_len,
-					  " - VXLAN packet: packet type =%d, "
-					  "Destination UDP port =%d, VNI = %d",
-					  packet_type, udp_port, vx_vni >> 8);
+				l4_len = sizeof(struct rte_udp_hdr);
+				if (RTE_ETH_IS_ECPRI_HDR(packet_type)) {
+					MKDUMPSTR(print_buf, buf_size, cur_len,
+						  " - eCPRI packet: packet type =%d, "
+						  "Destination UDP port =%d",
+						  packet_type, udp_port);
+				} else {
+					vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
+					struct rte_vxlan_hdr *,
+					l2_len + l3_len + l4_len);
+					vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni);
+					MKDUMPSTR(print_buf, buf_size, cur_len,
+						  " - VXLAN packet: packet type =%d, "
+						  "Destination UDP port =%d, VNI = %d",
+						  packet_type, udp_port, vx_vni >> 8);
+				}
 			}
 		}
 		MKDUMPSTR(print_buf, buf_size, cur_len,
lib/librte_mbuf/rte_mbuf_ptype.c +2 -0
index d6f906b06c..2bf97c89c6 100644
@@ -21,6 +21,7 @@ const char *rte_get_ptype_l2_name(uint32_t ptype)
 	case RTE_PTYPE_L2_ETHER_PPPOE: return "L2_ETHER_PPPOE";
 	case RTE_PTYPE_L2_ETHER_FCOE: return "L2_ETHER_FCOE";
 	case RTE_PTYPE_L2_ETHER_MPLS: return "L2_ETHER_MPLS";
+	case RTE_PTYPE_L2_ETHER_ECPRI: return "L2_ETHER_ECPRI";
 	default: return "L2_UNKNOWN";
 	}
 }
@@ -71,6 +72,7 @@ const char *rte_get_ptype_tunnel_name(uint32_t ptype)
 	case RTE_PTYPE_TUNNEL_VXLAN_GPE: return "TUNNEL_VXLAN_GPE";
 	case RTE_PTYPE_TUNNEL_MPLS_IN_UDP: return "TUNNEL_MPLS_IN_UDP";
 	case RTE_PTYPE_TUNNEL_MPLS_IN_GRE: return "TUNNEL_MPLS_IN_GRE";
+	case RTE_PTYPE_TUNNEL_ECPRI: return "TUNNEL_ECPRI";
 	default: return "TUNNEL_UNKNOWN";
 	}
 }
lib/librte_mbuf/rte_mbuf_ptype.h +22 -0
index 17a2dd3576..5fdf369ac0 100644
@@ -144,6 +144,13 @@ extern "C" {
  * <'ether type'=[0x8847|0x8848]>
  */
 #define RTE_PTYPE_L2_ETHER_MPLS             0x0000000a
+/**
+ * eCPRI (extend Common Public Radio Interface) packet type.
+ *
+ * Packet format:
+ * <'ether type'=[0xAEFE]>
+ */
+#define RTE_PTYPE_L2_ETHER_ECPRI            0x0000000b
 /**
  * Mask of layer 2 packet types.
  * It is used for outer packet for tunneling cases.
@@ -491,6 +498,19 @@ extern "C" {
  * | 'destination port'=6635>
  */
 #define RTE_PTYPE_TUNNEL_MPLS_IN_UDP      0x0000d000
+/**
+ * ECPRI packet type.
+ *
+ * Packet format:
+ * <'ether type'=0x0800
+ * | 'version'=4, 'protocol'=17,
+ * | 'destination port'=5123>
+ * or,
+ * <'ether type'=0x86DD
+ * | 'version'=6, 'protocol'=17,
+ * | 'destination port'=5123>
+ */
+#define RTE_PTYPE_TUNNEL_ECPRI              0x0000e000
 /**
  * Mask of tunneling packet types.
  */
@@ -688,6 +708,8 @@ extern "C" {
 		RTE_PTYPE_INNER_L3_MASK |				\
 		RTE_PTYPE_INNER_L4_MASK))
 
+/* Check if it is a ECPRI packet */
+#define  RTE_ETH_IS_ECPRI_HDR(ptype) ((ptype) & RTE_PTYPE_TUNNEL_ECPRI)
 /**
  * Get the name of the l2 packet type
  *
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 1/1 mbuf: support eCPRI hardware packet type

Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.

---
V2 change:
- refine commit log

 app/test-pmd/util.c              | 25 ++++++++++++++++---------
 lib/librte_mbuf/rte_mbuf_ptype.c |  2 ++
 lib/librte_mbuf/rte_mbuf_ptype.h | 22 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 9 deletions(-)
app/test-pmd/util.c +16 -9
index a9e431a8b2..494ebbf909 100644
@@ -258,16 +258,23 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 				udp_hdr = rte_pktmbuf_mtod_offset(mb,
 				struct rte_udp_hdr *,
 				l2_len + l3_len);
-				l4_len = sizeof(struct rte_udp_hdr);
-				vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
-				struct rte_vxlan_hdr *,
-				l2_len + l3_len + l4_len);
 				udp_port = RTE_BE_TO_CPU_16(udp_hdr->dst_port);
-				vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni);
-				MKDUMPSTR(print_buf, buf_size, cur_len,
-					  " - VXLAN packet: packet type =%d, "
-					  "Destination UDP port =%d, VNI = %d",
-					  packet_type, udp_port, vx_vni >> 8);
+				l4_len = sizeof(struct rte_udp_hdr);
+				if (RTE_ETH_IS_ECPRI_HDR(packet_type)) {
+					MKDUMPSTR(print_buf, buf_size, cur_len,
+						  " - eCPRI packet: packet type =%d, "
+						  "Destination UDP port =%d",
+						  packet_type, udp_port);
+				} else {
+					vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
+					struct rte_vxlan_hdr *,
+					l2_len + l3_len + l4_len);
+					vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni);
+					MKDUMPSTR(print_buf, buf_size, cur_len,
+						  " - VXLAN packet: packet type =%d, "
+						  "Destination UDP port =%d, VNI = %d",
+						  packet_type, udp_port, vx_vni >> 8);
+				}
 			}
 		}
 		MKDUMPSTR(print_buf, buf_size, cur_len,
lib/librte_mbuf/rte_mbuf_ptype.c +2 -0
index d6f906b06c..2bf97c89c6 100644
@@ -21,6 +21,7 @@ const char *rte_get_ptype_l2_name(uint32_t ptype)
 	case RTE_PTYPE_L2_ETHER_PPPOE: return "L2_ETHER_PPPOE";
 	case RTE_PTYPE_L2_ETHER_FCOE: return "L2_ETHER_FCOE";
 	case RTE_PTYPE_L2_ETHER_MPLS: return "L2_ETHER_MPLS";
+	case RTE_PTYPE_L2_ETHER_ECPRI: return "L2_ETHER_ECPRI";
 	default: return "L2_UNKNOWN";
 	}
 }
@@ -71,6 +72,7 @@ const char *rte_get_ptype_tunnel_name(uint32_t ptype)
 	case RTE_PTYPE_TUNNEL_VXLAN_GPE: return "TUNNEL_VXLAN_GPE";
 	case RTE_PTYPE_TUNNEL_MPLS_IN_UDP: return "TUNNEL_MPLS_IN_UDP";
 	case RTE_PTYPE_TUNNEL_MPLS_IN_GRE: return "TUNNEL_MPLS_IN_GRE";
+	case RTE_PTYPE_TUNNEL_ECPRI: return "TUNNEL_ECPRI";
 	default: return "TUNNEL_UNKNOWN";
 	}
 }
lib/librte_mbuf/rte_mbuf_ptype.h +22 -0
index 17a2dd3576..5fdf369ac0 100644
@@ -144,6 +144,13 @@ extern "C" {
  * <'ether type'=[0x8847|0x8848]>
  */
 #define RTE_PTYPE_L2_ETHER_MPLS             0x0000000a
+/**
+ * eCPRI (extend Common Public Radio Interface) packet type.
+ *
+ * Packet format:
+ * <'ether type'=[0xAEFE]>
+ */
+#define RTE_PTYPE_L2_ETHER_ECPRI            0x0000000b
 /**
  * Mask of layer 2 packet types.
  * It is used for outer packet for tunneling cases.
@@ -491,6 +498,19 @@ extern "C" {
  * | 'destination port'=6635>
  */
 #define RTE_PTYPE_TUNNEL_MPLS_IN_UDP      0x0000d000
+/**
+ * ECPRI packet type.
+ *
+ * Packet format:
+ * <'ether type'=0x0800
+ * | 'version'=4, 'protocol'=17,
+ * | 'destination port'=5123>
+ * or,
+ * <'ether type'=0x86DD
+ * | 'version'=6, 'protocol'=17,
+ * | 'destination port'=5123>
+ */
+#define RTE_PTYPE_TUNNEL_ECPRI              0x0000e000
 /**
  * Mask of tunneling packet types.
  */
@@ -688,6 +708,8 @@ extern "C" {
 		RTE_PTYPE_INNER_L3_MASK |				\
 		RTE_PTYPE_INNER_L4_MASK))
 
+/* Check if it is a ECPRI packet */
+#define  RTE_ETH_IS_ECPRI_HDR(ptype) ((ptype) & RTE_PTYPE_TUNNEL_ECPRI)
 /**
  * Get the name of the l2 packet type
  *
Signature · 1 line
2.25.1
#2 lore raw

Re: [dpdk-dev] [PATCH v2] mbuf: support eCPRI hardware packet type

Hi Lingyu,

Quoted 4 lines · Lingyu Liu

Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.

The number of available packet types for tunnels is quite low (already mentionned in this thread [1]).

[1] https://patches.dpdk.org/project/dpdk/patch/[email protected]

Can you give some details about how it will be used? For instance, which driver will set it, which kind of application will use it.

Thanks,
Olivier

Quoted 116 lines

---
V2 change:
- refine commit log

 app/test-pmd/util.c              | 25 ++++++++++++++++---------
 lib/librte_mbuf/rte_mbuf_ptype.c |  2 ++
 lib/librte_mbuf/rte_mbuf_ptype.h | 22 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 9 deletions(-)
app/test-pmd/util.c +16 -9
index a9e431a8b2..494ebbf909 100644
@@ -258,16 +258,23 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 				udp_hdr = rte_pktmbuf_mtod_offset(mb,
 				struct rte_udp_hdr *,
 				l2_len + l3_len);
-				l4_len = sizeof(struct rte_udp_hdr);
-				vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
-				struct rte_vxlan_hdr *,
-				l2_len + l3_len + l4_len);
 				udp_port = RTE_BE_TO_CPU_16(udp_hdr->dst_port);
-				vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni);
-				MKDUMPSTR(print_buf, buf_size, cur_len,
-					  " - VXLAN packet: packet type =%d, "
-					  "Destination UDP port =%d, VNI = %d",
-					  packet_type, udp_port, vx_vni >> 8);
+				l4_len = sizeof(struct rte_udp_hdr);
+				if (RTE_ETH_IS_ECPRI_HDR(packet_type)) {
+					MKDUMPSTR(print_buf, buf_size, cur_len,
+						  " - eCPRI packet: packet type =%d, "
+						  "Destination UDP port =%d",
+						  packet_type, udp_port);
+				} else {
+					vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
+					struct rte_vxlan_hdr *,
+					l2_len + l3_len + l4_len);
+					vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni);
+					MKDUMPSTR(print_buf, buf_size, cur_len,
+						  " - VXLAN packet: packet type =%d, "
+						  "Destination UDP port =%d, VNI = %d",
+						  packet_type, udp_port, vx_vni >> 8);
+				}
 			}
 		}
 		MKDUMPSTR(print_buf, buf_size, cur_len,
lib/librte_mbuf/rte_mbuf_ptype.c +2 -0
index d6f906b06c..2bf97c89c6 100644
@@ -21,6 +21,7 @@ const char *rte_get_ptype_l2_name(uint32_t ptype)
 	case RTE_PTYPE_L2_ETHER_PPPOE: return "L2_ETHER_PPPOE";
 	case RTE_PTYPE_L2_ETHER_FCOE: return "L2_ETHER_FCOE";
 	case RTE_PTYPE_L2_ETHER_MPLS: return "L2_ETHER_MPLS";
+	case RTE_PTYPE_L2_ETHER_ECPRI: return "L2_ETHER_ECPRI";
 	default: return "L2_UNKNOWN";
 	}
 }
@@ -71,6 +72,7 @@ const char *rte_get_ptype_tunnel_name(uint32_t ptype)
 	case RTE_PTYPE_TUNNEL_VXLAN_GPE: return "TUNNEL_VXLAN_GPE";
 	case RTE_PTYPE_TUNNEL_MPLS_IN_UDP: return "TUNNEL_MPLS_IN_UDP";
 	case RTE_PTYPE_TUNNEL_MPLS_IN_GRE: return "TUNNEL_MPLS_IN_GRE";
+	case RTE_PTYPE_TUNNEL_ECPRI: return "TUNNEL_ECPRI";
 	default: return "TUNNEL_UNKNOWN";
 	}
 }
lib/librte_mbuf/rte_mbuf_ptype.h +22 -0
index 17a2dd3576..5fdf369ac0 100644
@@ -144,6 +144,13 @@ extern "C" {
  * <'ether type'=[0x8847|0x8848]>
  */
 #define RTE_PTYPE_L2_ETHER_MPLS             0x0000000a
+/**
+ * eCPRI (extend Common Public Radio Interface) packet type.
+ *
+ * Packet format:
+ * <'ether type'=[0xAEFE]>
+ */
+#define RTE_PTYPE_L2_ETHER_ECPRI            0x0000000b
 /**
  * Mask of layer 2 packet types.
  * It is used for outer packet for tunneling cases.
@@ -491,6 +498,19 @@ extern "C" {
  * | 'destination port'=6635>
  */
 #define RTE_PTYPE_TUNNEL_MPLS_IN_UDP      0x0000d000
+/**
+ * ECPRI packet type.
+ *
+ * Packet format:
+ * <'ether type'=0x0800
+ * | 'version'=4, 'protocol'=17,
+ * | 'destination port'=5123>
+ * or,
+ * <'ether type'=0x86DD
+ * | 'version'=6, 'protocol'=17,
+ * | 'destination port'=5123>
+ */
+#define RTE_PTYPE_TUNNEL_ECPRI              0x0000e000
 /**
  * Mask of tunneling packet types.
  */
@@ -688,6 +708,8 @@ extern "C" {
 		RTE_PTYPE_INNER_L3_MASK |				\
 		RTE_PTYPE_INNER_L4_MASK))
 
+/* Check if it is a ECPRI packet */
+#define  RTE_ETH_IS_ECPRI_HDR(ptype) ((ptype) & RTE_PTYPE_TUNNEL_ECPRI)
 /**
  * Get the name of the l2 packet type
  *
Signature · 1 line
2.25.1
#3 lore raw

Re: [dpdk-dev] [PATCH v2] mbuf: support eCPRI hardware packet type

Hi Olivier,

This new packet type will be used by iavf driver to map ECPRI hardware packet. This is the patch which will use this new hardware packet type.
http://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Best Regards,

Lingyu Liu

Quoted 162 lines

-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Monday, April 19, 2021 10:25 PM
To: Liu, Lingyu <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; [email protected]; [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v2] mbuf: support eCPRI hardware packet type

Hi Lingyu,

Quoted 4 lines · Lingyu Liu

Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.

The number of available packet types for tunnels is quite low (already mentionned in this thread [1]).

[1] https://patches.dpdk.org/project/dpdk/patch/20210408081720.23314-3-
[email protected]

Can you give some details about how it will be used? For instance, which driver will set it, which kind of application will use it.

Thanks,
Olivier

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t

Quoted 14 lines

---
V2 change:
- refine commit log

 app/test-pmd/util.c              | 25 ++++++++++++++++---------
 lib/librte_mbuf/rte_mbuf_ptype.c |  2 ++
lib/librte_mbuf/rte_mbuf_ptype.h | 22 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 9 deletions(-)
app/test-pmd/util.c index renamed from app/test-pmd/util.c +0 -0

a9e431a8b2..494ebbf909 100644

app/test-pmd/util.c +0 -0
@@ -258,16 +258,23 @@ dump_pkt_burst(uint16_t port_id, uint16_t

queue, struct rte_mbuf *pkts[],

Quoted 4 lines
app/test-pmd/util.c +0 -1
 				udp_hdr = rte_pktmbuf_mtod_offset(mb,
 				struct rte_udp_hdr *,
 				l2_len + l3_len);
-				l4_len = sizeof(struct rte_udp_hdr);

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],

Quoted 10 lines
app/test-pmd/util.c +0 -7
-				vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
-				struct rte_vxlan_hdr *,
-				l2_len + l3_len + l4_len);
 				udp_port = RTE_BE_TO_CPU_16(udp_hdr-
 dst_port);
-				vx_vni = rte_be_to_cpu_32(vxlan_hdr-
 vx_vni);
-				MKDUMPSTR(print_buf, buf_size, cur_len,
-					  " - VXLAN packet: packet type =%d, "
-					  "Destination UDP port =%d, VNI

= %d",

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],

Quoted 4 lines
app/test-pmd/util.c +3 -1
-					  packet_type, udp_port, vx_vni >> 8);
+				l4_len = sizeof(struct rte_udp_hdr);
+				if (RTE_ETH_IS_ECPRI_HDR(packet_type)) {
+					MKDUMPSTR(print_buf, buf_size,

cur_len,

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 267

Quoted 1 line
app/test-pmd/util.c +1 -0
+						  " - eCPRI packet: packet type

=%d, "

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],

Quoted 4 lines
app/test-pmd/util.c +4 -0
+						  "Destination UDP port =%d",
+						  packet_type, udp_port);
+				} else {
+					vxlan_hdr =

rte_pktmbuf_mtod_offset(mb,

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],

Quoted 3 lines
app/test-pmd/util.c +3 -0
+					struct rte_vxlan_hdr *,
+					l2_len + l3_len + l4_len);
+					vx_vni =

rte_be_to_cpu_32(vxlan_hdr->vx_vni);

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 275

Quoted 1 line
app/test-pmd/util.c +1 -0
+					MKDUMPSTR(print_buf, buf_size,

cur_len,

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 276

Quoted 1 line
app/test-pmd/util.c +1 -0
+						  " - VXLAN packet: packet

type =%d, "

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 277

Quoted 1 line
app/test-pmd/util.c +1 -0
+						  "Destination UDP port =%d,

VNI = %d",

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 278

Quoted 1 line
app/test-pmd/util.c +1 -0
+						  packet_type, udp_port,

vx_vni >> 8);

lib/librte_mbuf/rte_mbuf_ptype.c const char *rte_get_ptype_tunnel_name(uint32_t

Quoted 17 lines
app/test-pmd/util.c +1 -0
+				}
 			}
app/test-pmd/util.c +0 -0
 		}
 		MKDUMPSTR(print_buf, buf_size, cur_len, diff --git

a/lib/librte_mbuf/rte_mbuf_ptype.c b/lib/librte_mbuf/rte_mbuf_ptype.c index d6f906b06c..2bf97c89c6 100644

lib/librte_mbuf/rte_mbuf_ptype.c +1 -0
@@ -21,6 +21,7 @@ const char *rte_get_ptype_l2_name(uint32_t ptype)
 	case RTE_PTYPE_L2_ETHER_PPPOE: return "L2_ETHER_PPPOE";
 	case RTE_PTYPE_L2_ETHER_FCOE: return "L2_ETHER_FCOE";
 	case RTE_PTYPE_L2_ETHER_MPLS: return "L2_ETHER_MPLS";
+	case RTE_PTYPE_L2_ETHER_ECPRI: return "L2_ETHER_ECPRI";
 	default: return "L2_UNKNOWN";
 	}
 }
@@ -71,6 +72,7 @@ const char *rte_get_ptype_tunnel_name(uint32_t

ptype)

lib/librte_mbuf/rte_mbuf_ptype.c const char *rte_get_ptype_tunnel_name(uint32_t · line 73

Quoted 2 lines
lib/librte_mbuf/rte_mbuf_ptype.c +0 -0
 	case RTE_PTYPE_TUNNEL_VXLAN_GPE: return "TUNNEL_VXLAN_GPE";
 	case RTE_PTYPE_TUNNEL_MPLS_IN_UDP: return

"TUNNEL_MPLS_IN_UDP";

lib/librte_mbuf/rte_mbuf_ptype.c const char *rte_get_ptype_tunnel_name(uint32_t · line 74

Quoted 1 line
lib/librte_mbuf/rte_mbuf_ptype.c +0 -0
 	case RTE_PTYPE_TUNNEL_MPLS_IN_GRE: return

"TUNNEL_MPLS_IN_GRE";

Quoted 56 lines
lib/librte_mbuf/rte_mbuf_ptype.c +1 -0
+	case RTE_PTYPE_TUNNEL_ECPRI: return "TUNNEL_ECPRI";
 	default: return "TUNNEL_UNKNOWN";
 	}
 }
lib/librte_mbuf/rte_mbuf_ptype.h +23 -1
index 17a2dd3576..5fdf369ac0 100644
@@ -144,6 +144,13 @@ extern "C" {
  * <'ether type'=[0x8847|0x8848]>
  */
 #define RTE_PTYPE_L2_ETHER_MPLS             0x0000000a
+/**
+ * eCPRI (extend Common Public Radio Interface) packet type.
+ *
+ * Packet format:
+ * <'ether type'=[0xAEFE]>
+ */
+#define RTE_PTYPE_L2_ETHER_ECPRI            0x0000000b
 /**
  * Mask of layer 2 packet types.
  * It is used for outer packet for tunneling cases.
@@ -491,6 +498,19 @@ extern "C" {
  * | 'destination port'=6635>
  */
 #define RTE_PTYPE_TUNNEL_MPLS_IN_UDP      0x0000d000
+/**
+ * ECPRI packet type.
+ *
+ * Packet format:
+ * <'ether type'=0x0800
+ * | 'version'=4, 'protocol'=17,
+ * | 'destination port'=5123>
+ * or,
+ * <'ether type'=0x86DD
+ * | 'version'=6, 'protocol'=17,
+ * | 'destination port'=5123>
+ */
+#define RTE_PTYPE_TUNNEL_ECPRI              0x0000e000
 /**
  * Mask of tunneling packet types.
  */
@@ -688,6 +708,8 @@ extern "C" {
 		RTE_PTYPE_INNER_L3_MASK |				\
 		RTE_PTYPE_INNER_L4_MASK))
 
+/* Check if it is a ECPRI packet */
+#define  RTE_ETH_IS_ECPRI_HDR(ptype) ((ptype) &
+RTE_PTYPE_TUNNEL_ECPRI)
 /**
  * Get the name of the l2 packet type
  *
--

2.25.1

#4 lore raw

Re: [dpdk-dev] [PATCH v2] mbuf: support eCPRI hardware packet type

20/04/2021 04:17, Liu, Lingyu:

Quoted 5 lines

Hi Olivier,

This new packet type will be used by iavf driver to map ECPRI hardware packet. This is the patch which will use this new hardware packet type.
http://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

I think it does not reply Olivier's question about how it will be used. Why is it important to report this packet type in mbuf?

PS: please do not top-post

Quoted 21 lines
Quoted 21 lines

From: Olivier Matz <[email protected]>

Hi Lingyu,

Quoted 4 lines · Lingyu Liu

Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.

The number of available packet types for tunnels is quite low (already mentionned in this thread [1]).

[1] https://patches.dpdk.org/project/dpdk/patch/20210408081720.23314-3-
[email protected]

Can you give some details about how it will be used? For instance, which driver will set it, which kind of application will use it.

Thanks,
Olivier

#5 lore raw

Re: [dpdk-dev] [PATCH v2] mbuf: support eCPRI hardware packet type

Quoted 9 lines · Thomas Monjalon

20/04/2021 04:17, Liu, Lingyu:

Quoted 5 lines

Hi Olivier,

This new packet type will be used by iavf driver to map ECPRI hardware packet. This is the patch which will use this new hardware packet type.
http://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

I think it does not reply Olivier's question about how it will be used. Why is it important to report this packet type in mbuf?

+1

Quoted 26 lines

PS: please do not top-post

Quoted 21 lines
Quoted 21 lines

From: Olivier Matz <[email protected]>

Hi Lingyu,

Quoted 4 lines · Lingyu Liu

Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.

The number of available packet types for tunnels is quite low (already mentionned in this thread [1]).

[1] https://patches.dpdk.org/project/dpdk/patch/20210408081720.23314-3-
[email protected]

Can you give some details about how it will be used? For instance, which driver will set it, which kind of application will use it.

Thanks,
Olivier

#6 lore raw

Re: [dpdk-dev] [PATCH v2] mbuf: support eCPRI hardware packet type

In reply to Thomas Monjalon
Quoted 7 lines

20/04/2021 04:17, Liu, Lingyu:

Quoted 3 lines

Hi Olivier,

This new packet type will be used by iavf driver to map ECPRI hardware

packet.

Quoted 2 lines

This is the patch which will use this new hardware packet type.
http://patchwork.dpdk.org/project/dpdk/patch/20210420083817.10741-3-

Quoted 8 lines

li

Quoted 1 line

[email protected]/

I think it does not reply Olivier's question about how it will be used. Why is it important to report this packet type in mbuf?

PS: please do not top-post

In current implementation(w/o this patch), when receiving a eCPRI packet, testpmd prints like this:
"port 2/queue 0: received 1 packets
src=00:00:00:00:00:00 - dst=00:11:22:33:44:77 - type=0x0800 - length=60 - nb_segs=1 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_UDP - sw ptype: L2_ETHER L3_IPV4 L4_UDP - l2_len=14 - l3_len=20 - l4_len=8 - Receive queue=0x0
ol_flags: PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN"
We can't know the hw ptype.

After adding this patch, when receiving an eCPRI packet, testpmd can print like this:
" port 1/queue 0: received 1 packets
  src=00:00:00:00:00:00 - dst=00:11:22:33:44:11 - type=0x0800 - length=60 - nb_segs=1 - hw ptype: L2_ETHER L3_IPV4_EXT_UNKNOWN L4_UDP TUNNEL_ECPRI  - sw ptype: L2_ETHER L3_IPV4 L4_UDP  - l2_len=14 - l3_len=20 - l4_len=8 - ECPRI packet: packet type =58001, Destination UDP port =20771 - Receive queue=0x0
  ol_flags: PKT_RX_L4_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD PKT_RX_OUTER_L4_CKSUM_UNKNOWN
"
Then apps can recognize the packet type using hw ptype. This supports more complete packet types and protocols.

Quoted 25 lines
Quoted 23 lines
Quoted 23 lines

From: Olivier Matz <[email protected]>

Hi Lingyu,

Quoted 4 lines · Lingyu Liu

Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.

The number of available packet types for tunnels is quite low (already mentionned in this thread [1]).

[1]
https://patches.dpdk.org/project/dpdk/patch/20210408081720.23314-3-
[email protected]

Can you give some details about how it will be used? For instance, which driver will set it, which kind of application will use it.

Thanks,
Olivier

#7 lore raw

Re: [dpdk-dev] [PATCH v2] mbuf: support eCPRI hardware packet type

In reply to Liu, Lingyu

Hi Lingyu,

Quoted 185 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Liu, Lingyu
Sent: Tuesday, April 20, 2021 10:17 AM
To: Olivier Matz <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; NBU-Contact- Thomas Monjalon <[email protected]>; [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2] mbuf: support eCPRI hardware packet type

External email: Use caution opening links or attachments

Hi Olivier,

This new packet type will be used by iavf driver to map ECPRI hardware packet.
This is the patch which will use this new hardware packet type.
http://patchwork.dpdk.org/project/dpdk/patch/20210420083817.10741-3-
[email protected]/

Best Regards,

Lingyu Liu

Quoted 11 lines

-----Original Message-----
From: Olivier Matz <[email protected]>
Sent: Monday, April 19, 2021 10:25 PM
To: Liu, Lingyu <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; [email protected]; [email protected]; Hemant Agrawal <[email protected]>
Subject: Re: [PATCH v2] mbuf: support eCPRI hardware packet type

Hi Lingyu,

Quoted 7 lines
Quoted 4 lines · Lingyu Liu

Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.

The number of available packet types for tunnels is quite low

(already

Quoted 4 lines

mentionned in this thread [1]).

[1]
https://patches.dpdk.org/project/dpdk/patch/20210408081720.23314-

3-

Quoted 17 lines

[email protected]

Can you give some details about how it will be used? For instance, which driver will set it, which kind of application will use it.

Thanks,
Olivier

Quoted 9 lines

---
V2 change:
- refine commit log

 app/test-pmd/util.c              | 25 ++++++++++++++++---------
 lib/librte_mbuf/rte_mbuf_ptype.c |  2 ++
lib/librte_mbuf/rte_mbuf_ptype.h | 22 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 9 deletions(-)
Quoted 11 lines

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t

Quoted 5 lines
app/test-pmd/util.c index renamed from app/test-pmd/util.c +0 -0

a9e431a8b2..494ebbf909 100644

app/test-pmd/util.c +0 -0
@@ -258,16 +258,23 @@ dump_pkt_burst(uint16_t port_id, uint16_t

queue, struct rte_mbuf *pkts[],

Quoted 5 lines
app/test-pmd/util.c +0 -2
                            udp_hdr = rte_pktmbuf_mtod_offset(mb,
                            struct rte_udp_hdr *,
                            l2_len + l3_len);
-                           l4_len = sizeof(struct rte_udp_hdr);
-                           vxlan_hdr =

rte_pktmbuf_mtod_offset(mb,

Quoted 7 lines

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 269

Quoted 7 lines
app/test-pmd/util.c +0 -4
-                           struct rte_vxlan_hdr *,
-                           l2_len + l3_len + l4_len);
                            udp_port = RTE_BE_TO_CPU_16(udp_hdr-
 dst_port);
-                           vx_vni = rte_be_to_cpu_32(vxlan_hdr-
 vx_vni);
-                           MKDUMPSTR(print_buf, buf_size,

cur_len,

Quoted 1 line

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 270

Quoted 1 line
app/test-pmd/util.c +0 -1
-                                     " - VXLAN packet: packet

type =%d, "

Quoted 1 line

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 271

Quoted 1 line
app/test-pmd/util.c +0 -1
-                                     "Destination UDP port =%d,

VNI

Quoted 2 lines

= %d",

Quoted 1 line
app/test-pmd/util.c +0 -1
-                                     packet_type, udp_port,

vx_vni >> 8);

Quoted 2 lines

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 265

Quoted 2 lines
app/test-pmd/util.c +2 -0
+                           l4_len = sizeof(struct rte_udp_hdr);
+                           if

(RTE_ETH_IS_ECPRI_HDR(packet_type)) {

Quoted 1 line

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 266

Quoted 1 line
app/test-pmd/util.c +1 -0
+                                   MKDUMPSTR(print_buf,

buf_size,

Quoted 5 lines

cur_len,

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 268

Quoted 2 lines
app/test-pmd/util.c +2 -0
+                                             " - eCPRI packet:
+ packet type

=%d, "

Quoted 1 line
app/test-pmd/util.c +1 -0
+                                             "Destination UDP

port =%d",

Quoted 1 line

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 270

Quoted 1 line
app/test-pmd/util.c +1 -0
+                                             packet_type,

udp_port);

Quoted 8 lines

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 272

Quoted 2 lines
app/test-pmd/util.c +2 -0
+                           } else {
+                                   vxlan_hdr =

rte_pktmbuf_mtod_offset(mb,

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],

Quoted 3 lines
app/test-pmd/util.c +3 -0
+                                   struct rte_vxlan_hdr *,
+                                   l2_len + l3_len + l4_len);
+                                   vx_vni =

rte_be_to_cpu_32(vxlan_hdr->vx_vni);

Quoted 1 line
app/test-pmd/util.c +1 -0
+                                   MKDUMPSTR(print_buf,

buf_size,

Quoted 5 lines

cur_len,

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 278

Quoted 2 lines
app/test-pmd/util.c +2 -0
+                                             " - VXLAN packet:
+ packet

type =%d, "

Quoted 1 line
app/test-pmd/util.c +1 -0
+                                             "Destination UDP

port

Quoted 3 lines

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t · line 280

Quoted 1 line
app/test-pmd/util.c +1 -0
+ =%d,

VNI = %d",

Quoted 1 line

+ packet_type,

udp_port,

Quoted 11 lines

vx_vni >> 8);

lib/librte_mbuf/rte_mbuf_ptype.c const char *rte_get_ptype_l2_name(uint32_t

Quoted 10 lines

+ }

                    }
            }
            MKDUMPSTR(print_buf, buf_size, cur_len, diff --git

a/lib/librte_mbuf/rte_mbuf_ptype.c
b/lib/librte_mbuf/rte_mbuf_ptype.c
index d6f906b06c..2bf97c89c6 100644

lib/librte_mbuf/rte_mbuf_ptype.c +0 -0
@@ -21,6 +21,7 @@ const char *rte_get_ptype_l2_name(uint32_t

ptype)

Quoted 46 lines

lib/librte_mbuf/rte_mbuf_ptype.c const char *rte_get_ptype_tunnel_name(uint32_t

Quoted 8 lines
lib/librte_mbuf/rte_mbuf_ptype.c +1 -0
    case RTE_PTYPE_L2_ETHER_PPPOE: return "L2_ETHER_PPPOE";
    case RTE_PTYPE_L2_ETHER_FCOE: return "L2_ETHER_FCOE";
    case RTE_PTYPE_L2_ETHER_MPLS: return "L2_ETHER_MPLS";
+   case RTE_PTYPE_L2_ETHER_ECPRI: return "L2_ETHER_ECPRI";
    default: return "L2_UNKNOWN";
    }
 }
@@ -71,6 +72,7 @@ const char *rte_get_ptype_tunnel_name(uint32_t

ptype)

lib/librte_mbuf/rte_mbuf_ptype.c const char *rte_get_ptype_tunnel_name(uint32_t · line 73

Quoted 2 lines
lib/librte_mbuf/rte_mbuf_ptype.c +0 -0
    case RTE_PTYPE_TUNNEL_VXLAN_GPE: return "TUNNEL_VXLAN_GPE";
    case RTE_PTYPE_TUNNEL_MPLS_IN_UDP: return

"TUNNEL_MPLS_IN_UDP";

lib/librte_mbuf/rte_mbuf_ptype.c const char *rte_get_ptype_tunnel_name(uint32_t · line 74

Quoted 1 line
lib/librte_mbuf/rte_mbuf_ptype.c +0 -0
    case RTE_PTYPE_TUNNEL_MPLS_IN_GRE: return

"TUNNEL_MPLS_IN_GRE";

Quoted 32 lines
lib/librte_mbuf/rte_mbuf_ptype.c +1 -0
+   case RTE_PTYPE_TUNNEL_ECPRI: return "TUNNEL_ECPRI";
    default: return "TUNNEL_UNKNOWN";
    }
 }
lib/librte_mbuf/rte_mbuf_ptype.h +12 -0
index 17a2dd3576..5fdf369ac0 100644
@@ -144,6 +144,13 @@ extern "C" {
  * <'ether type'=[0x8847|0x8848]>
  */
 #define RTE_PTYPE_L2_ETHER_MPLS             0x0000000a
+/**
+ * eCPRI (extend Common Public Radio Interface) packet type.
+ *
+ * Packet format:
+ * <'ether type'=[0xAEFE]>
+ */
+#define RTE_PTYPE_L2_ETHER_ECPRI            0x0000000b
 /**
  * Mask of layer 2 packet types.
  * It is used for outer packet for tunneling cases.
@@ -491,6 +498,19 @@ extern "C" {
  * | 'destination port'=6635>
  */
 #define RTE_PTYPE_TUNNEL_MPLS_IN_UDP      0x0000d000
+/**
+ * ECPRI packet type.
+ *
+ * Packet format:
+ * <'ether type'=0x0800
Quoted 8 lines
Quoted 8 lines

lib/librte_mbuf/rte_mbuf_ptype.h extern "C" { · line 513

Quoted 8 lines
lib/librte_mbuf/rte_mbuf_ptype.h +8 -0
+ * | 'version'=4, 'protocol'=17,
+ * | 'destination port'=5123>
+ * or,
+ * <'ether type'=0x86DD
+ * | 'version'=6, 'protocol'=17,
+ * | 'destination port'=5123>
+ */
+#define RTE_PTYPE_TUNNEL_ECPRI              0x0000e000

Could you help to point out in which specification or other documentation that the destination port is specified?
I couldn't find it.
eCPRI over UDP is supported in O-RAN standards, marked as "optional" in the specs. Are the destination ports are specified during initialization but not a fixed value with 5123?

Quoted 11 lines
Quoted 5 lines

lib/librte_mbuf/rte_mbuf_ptype.h extern "C" { · line 708

Quoted 5 lines
lib/librte_mbuf/rte_mbuf_ptype.h +0 -0
 /**
  * Mask of tunneling packet types.
  */
@@ -688,6 +708,8 @@ extern "C" {
            RTE_PTYPE_INNER_L3_MASK |

\

Quoted 5 lines

lib/librte_mbuf/rte_mbuf_ptype.h extern "C" { · line 713

Quoted 5 lines
lib/librte_mbuf/rte_mbuf_ptype.h +3 -0
            RTE_PTYPE_INNER_L4_MASK))
 
+/* Check if it is a ECPRI packet */ #define
+RTE_ETH_IS_ECPRI_HDR(ptype) ((ptype) &
+RTE_PTYPE_TUNNEL_ECPRI)

It is a bit wired. To my understanding, eCPRI is not a tunnel type like VxLAN / GTP-U, etc. Did I miss something? Why it is considered a tunnel?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
lib/librte_mbuf/rte_mbuf_ptype.h +0 -1
 /**
  * Get the name of the l2 packet type
  *
--

2.25.1

BR. Bing

author
#8 lore raw

v3 cover mbuf:add eCPRI hardware packet type mapping

In reply to Lingyu Liu

Create eCPRI hardward packet in mbuf and add mapping in iavf.

Lingyu Liu (2):
mbuf: support eCPRI hardware packet type
net/iavf: update PTYPE mapping for eCPRI
---
V3 change:
- create patch set and add the second patch

 app/test-pmd/util.c              | 25 +++++++++------
 drivers/net/iavf/iavf_rxtx.c     | 52 ++++++++++++++++++++------------
 lib/librte_mbuf/rte_mbuf_ptype.c |  2 ++
 lib/librte_mbuf/rte_mbuf_ptype.h | 22 ++++++++++++++
 4 files changed, 72 insertions(+), 29 deletions(-)
Signature · 1 line
2.25.1
author
#9 lore raw

PATCH v3 1/2 mbuf: support eCPRI hardware packet type

Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.

---
 app/test-pmd/util.c              | 25 ++++++++++++++++---------
 lib/librte_mbuf/rte_mbuf_ptype.c |  2 ++
 lib/librte_mbuf/rte_mbuf_ptype.h | 22 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 9 deletions(-)
app/test-pmd/util.c +16 -9
index a9e431a8b2..494ebbf909 100644
@@ -258,16 +258,23 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 				udp_hdr = rte_pktmbuf_mtod_offset(mb,
 				struct rte_udp_hdr *,
 				l2_len + l3_len);
-				l4_len = sizeof(struct rte_udp_hdr);
-				vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
-				struct rte_vxlan_hdr *,
-				l2_len + l3_len + l4_len);
 				udp_port = RTE_BE_TO_CPU_16(udp_hdr->dst_port);
-				vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni);
-				MKDUMPSTR(print_buf, buf_size, cur_len,
-					  " - VXLAN packet: packet type =%d, "
-					  "Destination UDP port =%d, VNI = %d",
-					  packet_type, udp_port, vx_vni >> 8);
+				l4_len = sizeof(struct rte_udp_hdr);
+				if (RTE_ETH_IS_ECPRI_HDR(packet_type)) {
+					MKDUMPSTR(print_buf, buf_size, cur_len,
+						  " - eCPRI packet: packet type =%d, "
+						  "Destination UDP port =%d",
+						  packet_type, udp_port);
+				} else {
+					vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
+					struct rte_vxlan_hdr *,
+					l2_len + l3_len + l4_len);
+					vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni);
+					MKDUMPSTR(print_buf, buf_size, cur_len,
+						  " - VXLAN packet: packet type =%d, "
+						  "Destination UDP port =%d, VNI = %d",
+						  packet_type, udp_port, vx_vni >> 8);
+				}
 			}
 		}
 		MKDUMPSTR(print_buf, buf_size, cur_len,
lib/librte_mbuf/rte_mbuf_ptype.c +2 -0
index d6f906b06c..2bf97c89c6 100644
@@ -21,6 +21,7 @@ const char *rte_get_ptype_l2_name(uint32_t ptype)
 	case RTE_PTYPE_L2_ETHER_PPPOE: return "L2_ETHER_PPPOE";
 	case RTE_PTYPE_L2_ETHER_FCOE: return "L2_ETHER_FCOE";
 	case RTE_PTYPE_L2_ETHER_MPLS: return "L2_ETHER_MPLS";
+	case RTE_PTYPE_L2_ETHER_ECPRI: return "L2_ETHER_ECPRI";
 	default: return "L2_UNKNOWN";
 	}
 }
@@ -71,6 +72,7 @@ const char *rte_get_ptype_tunnel_name(uint32_t ptype)
 	case RTE_PTYPE_TUNNEL_VXLAN_GPE: return "TUNNEL_VXLAN_GPE";
 	case RTE_PTYPE_TUNNEL_MPLS_IN_UDP: return "TUNNEL_MPLS_IN_UDP";
 	case RTE_PTYPE_TUNNEL_MPLS_IN_GRE: return "TUNNEL_MPLS_IN_GRE";
+	case RTE_PTYPE_TUNNEL_ECPRI: return "TUNNEL_ECPRI";
 	default: return "TUNNEL_UNKNOWN";
 	}
 }
lib/librte_mbuf/rte_mbuf_ptype.h +22 -0
index 17a2dd3576..5fdf369ac0 100644
@@ -144,6 +144,13 @@ extern "C" {
  * <'ether type'=[0x8847|0x8848]>
  */
 #define RTE_PTYPE_L2_ETHER_MPLS             0x0000000a
+/**
+ * eCPRI (extend Common Public Radio Interface) packet type.
+ *
+ * Packet format:
+ * <'ether type'=[0xAEFE]>
+ */
+#define RTE_PTYPE_L2_ETHER_ECPRI            0x0000000b
 /**
  * Mask of layer 2 packet types.
  * It is used for outer packet for tunneling cases.
@@ -491,6 +498,19 @@ extern "C" {
  * | 'destination port'=6635>
  */
 #define RTE_PTYPE_TUNNEL_MPLS_IN_UDP      0x0000d000
+/**
+ * ECPRI packet type.
+ *
+ * Packet format:
+ * <'ether type'=0x0800
+ * | 'version'=4, 'protocol'=17,
+ * | 'destination port'=5123>
+ * or,
+ * <'ether type'=0x86DD
+ * | 'version'=6, 'protocol'=17,
+ * | 'destination port'=5123>
+ */
+#define RTE_PTYPE_TUNNEL_ECPRI              0x0000e000
 /**
  * Mask of tunneling packet types.
  */
@@ -688,6 +708,8 @@ extern "C" {
 		RTE_PTYPE_INNER_L3_MASK |				\
 		RTE_PTYPE_INNER_L4_MASK))
 
+/* Check if it is a ECPRI packet */
+#define  RTE_ETH_IS_ECPRI_HDR(ptype) ((ptype) & RTE_PTYPE_TUNNEL_ECPRI)
 /**
  * Get the name of the l2 packet type
  *
Signature · 1 line
2.25.1
#10 lore raw

Re: [dpdk-dev] [PATCH V3 1/2] mbuf: support eCPRI hardware packet type

Quoted 34 lines · Lingyu Liu

Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.

---
 app/test-pmd/util.c              | 25 ++++++++++++++++---------
 lib/librte_mbuf/rte_mbuf_ptype.c |  2 ++
 lib/librte_mbuf/rte_mbuf_ptype.h | 22 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 9 deletions(-)
app/test-pmd/util.c +6 -9
index a9e431a8b2..494ebbf909 100644
@@ -258,16 +258,23 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 				udp_hdr = rte_pktmbuf_mtod_offset(mb,
 				struct rte_udp_hdr *,
 				l2_len + l3_len);
-				l4_len = sizeof(struct rte_udp_hdr);
-				vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
-				struct rte_vxlan_hdr *,
-				l2_len + l3_len + l4_len);
 				udp_port = RTE_BE_TO_CPU_16(udp_hdr->dst_port);
-				vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni);
-				MKDUMPSTR(print_buf, buf_size, cur_len,
-					  " - VXLAN packet: packet type =%d, "
-					  "Destination UDP port =%d, VNI = %d",
-					  packet_type, udp_port, vx_vni >> 8);
+				l4_len = sizeof(struct rte_udp_hdr);
+				if (RTE_ETH_IS_ECPRI_HDR(packet_type)) {
+					MKDUMPSTR(print_buf, buf_size, cur_len,
+						  " - eCPRI packet: packet type =%d, "
+						  "Destination UDP port =%d",
+						  packet_type, udp_port);

app/test-pmd/util.c dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], · line 277

Quoted 10 lines
app/test-pmd/util.c +10 -0
+				} else {
+					vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
+					struct rte_vxlan_hdr *,
+					l2_len + l3_len + l4_len);
+					vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni);
+					MKDUMPSTR(print_buf, buf_size, cur_len,
+						  " - VXLAN packet: packet type =%d, "
+						  "Destination UDP port =%d, VNI = %d",
+						  packet_type, udp_port, vx_vni >> 8);
+				}

It definitely requires a pre-patch to avoid assumption that any UDP tunnel is a VXLAN.

Quoted 3 lines
app/test-pmd/util.c +0 -0
 			}
 		}
 		MKDUMPSTR(print_buf, buf_size, cur_len,

[snip]

Quoted 4 lines
lib/librte_mbuf/rte_mbuf_ptype.h +0 -0
index 17a2dd3576..5fdf369ac0 100644

[snip]

lib/librte_mbuf/rte_mbuf_ptype.h extern "C" { · line 712

Quoted 6 lines
lib/librte_mbuf/rte_mbuf_ptype.h +2 -0
@@ -688,6 +708,8 @@ extern "C" {
 		RTE_PTYPE_INNER_L3_MASK |				\
 		RTE_PTYPE_INNER_L4_MASK))
 
+/* Check if it is a ECPRI packet */
+#define  RTE_ETH_IS_ECPRI_HDR(ptype) ((ptype) & RTE_PTYPE_TUNNEL_ECPRI)

It looks wrong. You should apply tunnel mask
RTE_PTYPE_TUNNEL_MASK and compare result with
RTE_PTYPE_TUNNEL_ECPRI.

author
#11 lore raw

PATCH v3 2/2 net/iavf: update PTYPE mapping for eCPRI

In reply to Lingyu Liu

1.Map IPV4/IPV6 UDP eCPRI to L4_UDP_TUNNEL_ECPRI ptype. 2.Add L2_ETHER_ECPRI ptype and map ETHER eCPRI to L2_ETHER_ECPRI ptype.

---
 drivers/net/iavf/iavf_rxtx.c | 52 ++++++++++++++++++++++--------------
 1 file changed, 32 insertions(+), 20 deletions(-)
drivers/net/iavf/iavf_rxtx.c +32 -20
index 3f3cf6306c..30a8497c45 100644
@@ -3349,49 +3349,61 @@ iavf_get_default_ptype_table(void)
 			RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN |
 			RTE_PTYPE_INNER_L4_ICMP,
 
+		/* Ether --> ECPRI */
+		[362] = RTE_PTYPE_L2_ETHER_ECPRI,
+		[363] = RTE_PTYPE_L2_ETHER_ECPRI,
+		[364] = RTE_PTYPE_L2_ETHER_ECPRI,
+		[365] = RTE_PTYPE_L2_ETHER_ECPRI,
+		[366] = RTE_PTYPE_L2_ETHER_ECPRI,
+		[367] = RTE_PTYPE_L2_ETHER_ECPRI,
+		[368] = RTE_PTYPE_L2_ETHER_ECPRI,
+		[369] = RTE_PTYPE_L2_ETHER_ECPRI,
+		[370] = RTE_PTYPE_L2_ETHER_ECPRI,
+		[371] = RTE_PTYPE_L2_ETHER_ECPRI,
+
 		/* IPv4 --> UDP ECPRI */
 		[372] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[373] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[374] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[375] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[376] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[377] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[378] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[379] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[380] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[381] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 
 		/* IPV6 --> UDP ECPRI */
 		[382] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[383] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[384] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[385] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[386] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[387] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[388] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[389] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[390] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		[391] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN |
-			RTE_PTYPE_L4_UDP,
+			RTE_PTYPE_TUNNEL_ECPRI | RTE_PTYPE_L4_UDP,
 		/* All others reserved */
 	};
 
Signature · 1 line
2.25.1