From patchwork Tue Apr 20 08:38:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Lingyu" X-Patchwork-Id: 91803 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4975CA0524; Tue, 20 Apr 2021 04:03:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 331D64157E; Tue, 20 Apr 2021 04:03:42 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 555014157E for ; Tue, 20 Apr 2021 04:03:40 +0200 (CEST) IronPort-SDR: Ulsthgh9zuoKiyPJY48n5AkIfkEB2jVFbmDy/JS73oTfLDcfCjL93YyUHX9aM2PtkFEbFO5p6A eUC+UjdfdqMg== X-IronPort-AV: E=McAfee;i="6200,9189,9959"; a="216012617" X-IronPort-AV: E=Sophos;i="5.82,235,1613462400"; d="scan'208";a="216012617" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 19:03:38 -0700 IronPort-SDR: uHGdWkbNqKoYIeC+9HeHixe9iYx9ZXtLBLz7+HgGGD/9c3qcAq0MsIpAg94ORW+mDzDU7l+awN O/nm9OFifKxQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,235,1613462400"; d="scan'208";a="602317173" Received: from dpdk-liulingy-1.sh.intel.com ([10.67.118.243]) by orsmga005.jf.intel.com with ESMTP; 19 Apr 2021 19:03:35 -0700 From: Lingyu Liu To: dev@dpdk.org, qi.z.zhang@intel.com, olivier.matz@6wind.com, thomas@monjalon.net, david.marchand@redhat.com Cc: Lingyu Liu , Hemant Agrawal Date: Tue, 20 Apr 2021 08:38:16 +0000 Message-Id: <20210420083817.10741-2-lingyu.liu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210420083817.10741-1-lingyu.liu@intel.com> References: <20210417092531.6001-1-lingyu.liu@intel.com> <20210420083817.10741-1-lingyu.liu@intel.com> MIME-Version: 1.0 Subject: [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" 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); + } } } 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 * From patchwork Tue Apr 20 08:38:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Lingyu" X-Patchwork-Id: 91804 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4C01CA0524; Tue, 20 Apr 2021 04:03:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6EA4F41587; Tue, 20 Apr 2021 04:03:45 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 9BD0241586 for ; Tue, 20 Apr 2021 04:03:43 +0200 (CEST) IronPort-SDR: 0rWubXyy2456ZHYvkYaWZAZnSAbI9Tc2vLImK1V2W/Z4eA6q/ayIRsYeaEfbpCBKfqQeegUlKV 6eKNDfJO9yuQ== X-IronPort-AV: E=McAfee;i="6200,9189,9959"; a="216012638" X-IronPort-AV: E=Sophos;i="5.82,235,1613462400"; d="scan'208";a="216012638" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2021 19:03:43 -0700 IronPort-SDR: GMFqyVJaGxMwzI9zkZYqI4VaSHWc516920E1OQp5d3XAukquAstR6UCX4zNAoL9Jp0NTcmQNwD 2/85NbR5Ojow== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,235,1613462400"; d="scan'208";a="602317193" Received: from dpdk-liulingy-1.sh.intel.com ([10.67.118.243]) by orsmga005.jf.intel.com with ESMTP; 19 Apr 2021 19:03:40 -0700 From: Lingyu Liu To: dev@dpdk.org, qi.z.zhang@intel.com, olivier.matz@6wind.com, thomas@monjalon.net, david.marchand@redhat.com Cc: Lingyu Liu Date: Tue, 20 Apr 2021 08:38:17 +0000 Message-Id: <20210420083817.10741-3-lingyu.liu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210420083817.10741-1-lingyu.liu@intel.com> References: <20210417092531.6001-1-lingyu.liu@intel.com> <20210420083817.10741-1-lingyu.liu@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH V3 2/2] net/iavf: update PTYPE mapping for eCPRI 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" 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. Signed-off-by: Lingyu Liu --- drivers/net/iavf/iavf_rxtx.c | 52 ++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c index 3f3cf6306c..30a8497c45 100644 --- a/drivers/net/iavf/iavf_rxtx.c +++ b/drivers/net/iavf/iavf_rxtx.c @@ -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 */ };