[dpdk-dev] [PATCH V3 1/2] mbuf: support eCPRI hardware packet type
Andrew Rybchenko
andrew.rybchenko at oktetlabs.ru
Tue Apr 20 11:57:43 CEST 2021
On 4/20/21 11:38 AM, Lingyu Liu wrote:
> Add L2_ETHER_ECPRI and L4_UDP_TUNNEL_ECPRI in RTE_PTYPE.
>
> Signed-off-by: Lingyu Liu <lingyu.liu at intel.com>
> Acked-by: Hemant Agrawal <hemant.agrawal at nxp.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);
> + }
It definitely requires a pre-patch to avoid assumption
that any UDP tunnel is a VXLAN.
> }
> }
> MKDUMPSTR(print_buf, buf_size, cur_len,
[snip]
> 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
[snip]
> @@ -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.
More information about the dev
mailing list