From 645405eace12c2019ea83a9fbafc56c540b18681 Mon Sep 17 00:00:00 2001 From: Beilei Xing Date: Fri, 19 Jan 2018 15:50:05 +0800 Subject: [PATCH] net/i40e: add parser for IPv4/v6 frag There're new metadata IPV4FRAG and IPV6FRAG in PPP profile, this patch improves ptype parser to support IPV4FRAG and IPV6FRAG. Signed-off-by: Beilei Xing Acked-by: Qi Zhang --- drivers/net/i40e/i40e_ethdev.c | 44 +++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ba9f8a90c1..9dad227d60 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -11329,40 +11329,52 @@ i40e_update_customized_ptype(struct rte_eth_dev *dev, uint8_t *pkg, 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) -- 2.20.1