From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B8D3EA04B1; Thu, 5 Nov 2020 03:54:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E3BBB592C; Thu, 5 Nov 2020 03:54:51 +0100 (CET) Received: from mail-m972.mail.163.com (mail-m972.mail.163.com [123.126.97.2]) by dpdk.org (Postfix) with ESMTP id EF92A2C7A for ; Thu, 5 Nov 2020 03:54:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=fdz/0 TFO8rdrGusMP2MNGD06+VvcDmxm5RsBAg/4Yi4=; b=PruD98jtkiz3Y+EGnhPzI WQ73Sh/rOFwIexFiOueVQNrusIekIYrJ5+mkS9pwoJm3a/Vf4yuDSThInuwAzkUq P+g5tiVHwyYSuZdkpRdNopR68hNmBxl7cYy9cyf0XX1gFxAnHLdoWwIyzt6dE93w sSyePkFingq6qIu2y5uSsU= Received: from yangyi0100.home.langchao.com (unknown [111.207.123.58]) by smtp2 (Coremail) with SMTP id GtxpCgC3xT10aaNfn5EfAQ--.241S2; Thu, 05 Nov 2020 10:54:46 +0800 (CST) From: yang_y_yi@163.com To: dev@dpdk.org Cc: jiayu.hu@intel.com, konstantin.ananyev@intel.com, thomas@monjalon.net, yangyi01@inspur.com, yang_y_yi@163.com Date: Thu, 5 Nov 2020 10:54:44 +0800 Message-Id: <20201105025444.140140-1-yang_y_yi@163.com> X-Mailer: git-send-email 2.19.2.windows.1 In-Reply-To: <20201104042236.125888-1-yang_y_yi@163.com> References: <20201104042236.125888-1-yang_y_yi@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GtxpCgC3xT10aaNfn5EfAQ--.241S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxWry7Kw13Wr15KFyrAFy3XFb_yoW5CryUpF WfJFsxG3WDGr4Iyrn8X3WxCryxKr18XF4fCws3urZ0qayYqr1jqFZFka4rWrn5GayYqayv y34xWFn7Gw43Aw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UOyCXUUUUU= X-Originating-IP: [111.207.123.58] X-CM-SenderInfo: 51dqwsp1b1xqqrwthudrp/1tbiEBbTi18YDz-9mQAAsN Subject: [dpdk-dev] [PATCH v2] gro: fix an error when packet is IPv6 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Yi Yang 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: e2d811063673 ("gro: support VXLAN UDP/IPv4") Fixes: 1ca5e6740852 ("gro: support UDP/IPv4") Fixes: 9e0b9d2ec0f4 ("gro: support VxLAN GRO") Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4") Signed-off-by: Yi Yang --- lib/librte_gro/rte_gro.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/librte_gro/rte_gro.c b/lib/librte_gro/rte_gro.c index e56bd20..8ca4da6 100644 --- a/lib/librte_gro/rte_gro.c +++ b/lib/librte_gro/rte_gro.c @@ -32,32 +32,38 @@ 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 -- 1.8.3.1