From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 5465B7260; Mon, 15 Jan 2018 14:50:19 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2018 05:50:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,363,1511856000"; d="scan'208";a="10914006" Received: from unknown (HELO dpdk9.sh.intel.com) ([10.67.118.52]) by fmsmga002.fm.intel.com with ESMTP; 15 Jan 2018 05:50:17 -0800 From: Beilei Xing To: qi.z.zhang@intel.com Cc: dev@dpdk.org, stable@dpdk.org Date: Mon, 15 Jan 2018 21:51:23 +0800 Message-Id: <1516024283-60714-1-git-send-email-beilei.xing@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1515746494-86927-1-git-send-email-beilei.xing@intel.com> References: <1515746494-86927-1-git-send-email-beilei.xing@intel.com> Subject: [dpdk-dev] [PATCH v3] net/i40e: fix packet type parser issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jan 2018 13:50:19 -0000 Ptype mapping table will fail to update when loading PPP profile, fix the issue via modifying metadata and adding check. This patch also adds parser for IPV4FRAG and IPV6FRAG. Fixes: ab2e350c4f4b ("net/i40e: improve packet type parser") Cc: stable@dpdk.org Signed-off-by: Beilei Xing --- v3 changes: - Reorder IPv4 case. v2 changes: - Add parser for IPV4FRAG and IPV6FRAG. drivers/net/i40e/i40e_ethdev.c | 46 ++++++++++++++++++++++++++--------------- drivers/net/i40e/rte_pmd_i40e.c | 6 ++++-- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 7796e9e..0503645 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -11323,43 +11323,55 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg, continue; memset(name, 0, sizeof(name)); strcpy(name, proto[n].name); - if (!strncmp(name, "PPPOE", 5)) + if (!strncmp(name, "PPPoE", 5)) ptype_mapping[i].sw_ptype |= RTE_PTYPE_L2_ETHER_PPPOE; - else if (!strncmp(name, "OIPV4", 5)) { + else if (!strncmp(name, "IPV4FRAG", 8) && + !in_tunnel) { ptype_mapping[i].sw_ptype |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - in_tunnel = true; - } else if (!strncmp(name, "IPV4", 4) && - !in_tunnel) ptype_mapping[i].sw_ptype |= - RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; - else if (!strncmp(name, "IPV4FRAG", 8) && - in_tunnel) { + RTE_PTYPE_L4_FRAG; + } else if (!strncmp(name, "IPV4FRAG", 8) && + in_tunnel) { ptype_mapping[i].sw_ptype |= RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN; ptype_mapping[i].sw_ptype |= RTE_PTYPE_INNER_L4_FRAG; + } else if (!strncmp(name, "OIPV4", 5)) { + ptype_mapping[i].sw_ptype |= + RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; + in_tunnel = true; } else if (!strncmp(name, "IPV4", 4) && - in_tunnel) + !in_tunnel) + ptype_mapping[i].sw_ptype |= + RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; + else if (!strncmp(name, "IPV4", 4) && + in_tunnel) ptype_mapping[i].sw_ptype |= RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN; - else if (!strncmp(name, "OIPV6", 5)) { + else if (!strncmp(name, "IPV6FRAG", 8) && + !in_tunnel) { ptype_mapping[i].sw_ptype |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; - in_tunnel = true; - } else if (!strncmp(name, "IPV6", 4) && - !in_tunnel) ptype_mapping[i].sw_ptype |= - RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; - else if (!strncmp(name, "IPV6FRAG", 8) && - in_tunnel) { + RTE_PTYPE_L4_FRAG; + } else if (!strncmp(name, "IPV6FRAG", 8) && + in_tunnel) { ptype_mapping[i].sw_ptype |= RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN; ptype_mapping[i].sw_ptype |= RTE_PTYPE_INNER_L4_FRAG; + } else if (!strncmp(name, "OIPV6", 5)) { + ptype_mapping[i].sw_ptype |= + RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; + in_tunnel = true; } else if (!strncmp(name, "IPV6", 4) && - in_tunnel) + !in_tunnel) + ptype_mapping[i].sw_ptype |= + RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; + else if (!strncmp(name, "IPV6", 4) && + in_tunnel) ptype_mapping[i].sw_ptype |= RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN; else if (!strncmp(name, "UDP", 3) && !in_tunnel) diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index 2cb22d4..5436db4 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -2053,7 +2053,8 @@ static int check_invalid_pkt_type(uint32_t pkt_type) l2 != RTE_PTYPE_L2_ETHER_LLDP && l2 != RTE_PTYPE_L2_ETHER_NSH && l2 != RTE_PTYPE_L2_ETHER_VLAN && - l2 != RTE_PTYPE_L2_ETHER_QINQ) + l2 != RTE_PTYPE_L2_ETHER_QINQ && + l2 != RTE_PTYPE_L2_ETHER_PPPOE) return -1; if (l3 && @@ -2082,7 +2083,8 @@ static int check_invalid_pkt_type(uint32_t pkt_type) tnl != RTE_PTYPE_TUNNEL_GENEVE && tnl != RTE_PTYPE_TUNNEL_GRENAT && tnl != RTE_PTYPE_TUNNEL_GTPC && - tnl != RTE_PTYPE_TUNNEL_GTPU) + tnl != RTE_PTYPE_TUNNEL_GTPU && + tnl != RTE_PTYPE_TUNNEL_L2TP) return -1; if (il2 && -- 2.5.5