[dpdk-stable] [PATCH v2] net/i40e: fix packet type parser issue
Zhang, Qi Z
qi.z.zhang at intel.com
Sun Jan 14 05:02:08 CET 2018
> -----Original Message-----
> From: Xing, Beilei
> Sent: Friday, January 12, 2018 4:42 PM
> To: Zhang, Qi Z <qi.z.zhang at intel.com>
> Cc: dev at dpdk.org; stable at dpdk.org
> Subject: [PATCH v2] net/i40e: fix packet type parser issue
>
> 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 at dpdk.org
>
> Signed-off-by: Beilei Xing <beilei.xing at intel.com>
> ---
>
> v2 changes:
> - Add parser for IPV4FRAG and IPV6FRAG.
>
> drivers/net/i40e/i40e_ethdev.c | 44
> ++++++++++++++++++++++++++---------------
> drivers/net/i40e/rte_pmd_i40e.c | 6 ++++--
> 2 files changed, 32 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index d80671a..69704e3 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -11283,43 +11283,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, "IPV4", 4) &&
> + !in_tunnel)
> + ptype_mapping[i].sw_ptype |=
> + RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
> + 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)
Since you are doing some reordering here, it's better to move IPV4 && in_tunnel case above OIPV4, to match IPV4 && !in_tunnel case.
Regards
Qi
> 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
> 55ae2fe..af33a7c 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
More information about the stable
mailing list