gro: fix packet type detection with IPv6 tunnel

For VxLAN packets, GRO will mistakenly reassemble them
if inner L3 is IPv6, inner L4 is TCP or UDP, and outer L3
is IPv4 because the value of IS_IPV4_VXLAN_TCP4/UDP4_PKT
is true for them.

This fix makes sure IS_IPV4_TCP_PKT, IS_IPV4_UDP_PKT,
IS_IPV4_VXLAN_TCP4_PKT and IS_IPV4_VXLAN_UDP4_PKT can make
decision precisely.

Fixes: e2d8110636 ("gro: support VXLAN UDP/IPv4")
Fixes: 1ca5e67408 ("gro: support UDP/IPv4")
Fixes: 9e0b9d2ec0 ("gro: support VxLAN GRO")
Fixes: 0d2cbe59b7 ("lib/gro: support TCP/IPv4")
Cc: stable@dpdk.org

Signed-off-by: Yi Yang <yangyi01@inspur.com>
Acked-by: Jiayu Hu <jiayu.hu@intel.com>
This commit is contained in:
Yi Yang 2020-11-05 10:54:44 +08:00 committed by Thomas Monjalon
parent eb63ec0e56
commit b605df71be

View File

@ -32,32 +32,38 @@ static gro_tbl_pkt_count_fn tbl_pkt_count_fn[RTE_GRO_TYPE_MAX_NUM] = {
NULL};
#define IS_IPV4_TCP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP))
((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP) && \
(RTE_ETH_IS_TUNNEL_PKT(ptype) == 0))
#define IS_IPV4_UDP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP))
((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
(RTE_ETH_IS_TUNNEL_PKT(ptype) == 0))
#define IS_IPV4_VXLAN_TCP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
RTE_PTYPE_TUNNEL_VXLAN) && \
((ptype & RTE_PTYPE_INNER_L4_TCP) == \
RTE_PTYPE_INNER_L4_TCP) && \
(((ptype & RTE_PTYPE_INNER_L3_MASK) & \
(RTE_PTYPE_INNER_L3_IPV4 | \
RTE_PTYPE_INNER_L3_IPV4_EXT | \
RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
((ptype & RTE_PTYPE_INNER_L4_TCP) == \
RTE_PTYPE_INNER_L4_TCP) && \
(((ptype & RTE_PTYPE_INNER_L3_MASK) == \
RTE_PTYPE_INNER_L3_IPV4) || \
((ptype & RTE_PTYPE_INNER_L3_MASK) == \
RTE_PTYPE_INNER_L3_IPV4_EXT) || \
((ptype & RTE_PTYPE_INNER_L3_MASK) == \
RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
#define IS_IPV4_VXLAN_UDP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
RTE_PTYPE_TUNNEL_VXLAN) && \
((ptype & RTE_PTYPE_INNER_L4_UDP) == \
RTE_PTYPE_INNER_L4_UDP) && \
(((ptype & RTE_PTYPE_INNER_L3_MASK) & \
(RTE_PTYPE_INNER_L3_IPV4 | \
RTE_PTYPE_INNER_L3_IPV4_EXT | \
RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
((ptype & RTE_PTYPE_INNER_L4_UDP) == \
RTE_PTYPE_INNER_L4_UDP) && \
(((ptype & RTE_PTYPE_INNER_L3_MASK) == \
RTE_PTYPE_INNER_L3_IPV4) || \
((ptype & RTE_PTYPE_INNER_L3_MASK) == \
RTE_PTYPE_INNER_L3_IPV4_EXT) || \
((ptype & RTE_PTYPE_INNER_L3_MASK) == \
RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
/*
* GRO context structure. It keeps the table structures, which are