* [dpdk-dev] [RFC v1] mbuf: support eCPRI hardware packet type
@ 2021-04-07 14:18 Liulingyu
2021-04-07 15:09 ` [dpdk-dev] [RFC v2] " Liulingyu
0 siblings, 1 reply; 3+ messages in thread
From: Liulingyu @ 2021-04-07 14:18 UTC (permalink / raw)
To: dev, qi.z.zhang, beilei.xing; +Cc: Liulingyu
Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.
Signed-off-by: Liulingyu <lingyu.liu@intel.com>
---
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(-)
diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index a9e431a8b2..494ebbf909 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -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,
diff --git a/lib/librte_mbuf/rte_mbuf_ptype.c b/lib/librte_mbuf/rte_mbuf_ptype.c
index d6f906b06c..2bf97c89c6 100644
--- a/lib/librte_mbuf/rte_mbuf_ptype.c
+++ b/lib/librte_mbuf/rte_mbuf_ptype.c
@@ -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";
}
}
diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h b/lib/librte_mbuf/rte_mbuf_ptype.h
index 17a2dd3576..3a647feffe 100644
--- a/lib/librte_mbuf/rte_mbuf_ptype.h
+++ b/lib/librte_mbuf/rte_mbuf_ptype.h
@@ -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'=0xAEFE
+ * | 'version'=4, 'protocol'=17,
+ * | 'destination port'=5123>
+ * or,
+ * <'ether type'=0xAEFE>
+ * | '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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-dev] [RFC v2] mbuf: support eCPRI hardware packet type
2021-04-07 14:18 [dpdk-dev] [RFC v1] mbuf: support eCPRI hardware packet type Liulingyu
@ 2021-04-07 15:09 ` Liulingyu
2021-04-07 15:24 ` Hemant Agrawal
0 siblings, 1 reply; 3+ messages in thread
From: Liulingyu @ 2021-04-07 15:09 UTC (permalink / raw)
To: dev; +Cc: Liulingyu
Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.
Signed-off-by: Liulingyu <lingyu.liu@intel.com>
---
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(-)
diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index a9e431a8b2..494ebbf909 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -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,
diff --git a/lib/librte_mbuf/rte_mbuf_ptype.c b/lib/librte_mbuf/rte_mbuf_ptype.c
index d6f906b06c..2bf97c89c6 100644
--- a/lib/librte_mbuf/rte_mbuf_ptype.c
+++ b/lib/librte_mbuf/rte_mbuf_ptype.c
@@ -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";
}
}
diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h b/lib/librte_mbuf/rte_mbuf_ptype.h
index 17a2dd3576..5fdf369ac0 100644
--- a/lib/librte_mbuf/rte_mbuf_ptype.h
+++ b/lib/librte_mbuf/rte_mbuf_ptype.h
@@ -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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [RFC v2] mbuf: support eCPRI hardware packet type
2021-04-07 15:09 ` [dpdk-dev] [RFC v2] " Liulingyu
@ 2021-04-07 15:24 ` Hemant Agrawal
0 siblings, 0 replies; 3+ messages in thread
From: Hemant Agrawal @ 2021-04-07 15:24 UTC (permalink / raw)
To: dev
looks ok to me.
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
On 4/7/2021 8:39 PM, Liulingyu wrote:
> Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.
>
> Signed-off-by: Liulingyu <lingyu.liu@intel.com>
> ---
> 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(-)
>
> diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
> index a9e431a8b2..494ebbf909 100644
> --- a/app/test-pmd/util.c
> +++ b/app/test-pmd/util.c
> @@ -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,
> diff --git a/lib/librte_mbuf/rte_mbuf_ptype.c b/lib/librte_mbuf/rte_mbuf_ptype.c
> index d6f906b06c..2bf97c89c6 100644
> --- a/lib/librte_mbuf/rte_mbuf_ptype.c
> +++ b/lib/librte_mbuf/rte_mbuf_ptype.c
> @@ -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";
> }
> }
> diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h b/lib/librte_mbuf/rte_mbuf_ptype.h
> index 17a2dd3576..5fdf369ac0 100644
> --- a/lib/librte_mbuf/rte_mbuf_ptype.h
> +++ b/lib/librte_mbuf/rte_mbuf_ptype.h
> @@ -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
> *
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-07 15:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 14:18 [dpdk-dev] [RFC v1] mbuf: support eCPRI hardware packet type Liulingyu
2021-04-07 15:09 ` [dpdk-dev] [RFC v2] " Liulingyu
2021-04-07 15:24 ` Hemant Agrawal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).