From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A59F9A0524; Tue, 20 Apr 2021 11:57:45 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89325412B0; Tue, 20 Apr 2021 11:57:45 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 4AF4F411A5 for ; Tue, 20 Apr 2021 11:57:44 +0200 (CEST) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id D89DD7F41F; Tue, 20 Apr 2021 12:57:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru D89DD7F41F DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1618912663; bh=GHoitrt9GjYQ3JOPMMAG8nvYuVPjH9BC30k8C2RYE1w=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=XhInGGrwbxgi7y/SKMVmdd0xzAUwn5EBrlUg750q2fE3Jnm5fy+PvifqHoZ6tmSM2 e+Fz3ZkG2av95zBm4xc06MZVS5mEoqmeDa+ZpSSsUUe5mCBeZFstX30MUosm8YRuVB hLfJmprCwfdxaciJN6tlmEYvlwX0xrKPz7L2hdBk= To: Lingyu Liu , dev@dpdk.org, qi.z.zhang@intel.com, olivier.matz@6wind.com, thomas@monjalon.net, david.marchand@redhat.com Cc: Hemant Agrawal References: <20210417092531.6001-1-lingyu.liu@intel.com> <20210420083817.10741-1-lingyu.liu@intel.com> <20210420083817.10741-2-lingyu.liu@intel.com> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: Date: Tue, 20 Apr 2021 12:57:43 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210420083817.10741-2-lingyu.liu@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH V3 1/2] mbuf: support eCPRI hardware packet type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > Acked-by: Hemant Agrawal > --- > 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.