From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B8902A0552; Mon, 27 Jun 2022 12:31:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C0D4400D7; Mon, 27 Jun 2022 12:31:24 +0200 (CEST) Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by mails.dpdk.org (Postfix) with ESMTP id C1E4C400D5; Mon, 27 Jun 2022 12:31:23 +0200 (CEST) Received: by mail-pg1-f177.google.com with SMTP id q140so8712937pgq.6; Mon, 27 Jun 2022 03:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fI95+haoGBM0u90+Xb6mDlCpPZLtJtJ47MePcLtLnu8=; b=AfpKzQ55vigBIqD2AqHEnL6UNXCBy9pUbMokDPOmpVVOec5YAwPgsyopZaLNvZ88cL 5ZPgFkSNK9chGktQZJ9qrltlEk6jK36Ff6WIF9FObBstNhtB6d8mQXBZjSiYjfEZVyhP l5VDCRmJzAuBQaqvLOcwo9vK5FzMMhJl+QQ87FAV3+XHENHnXRZJzHGbZ+6lc43KOey1 XgKL0krJp3rXT9I+o4DipIkFfjcFfnEz21HQTrhQaNysMxsm9Hnr9D/m1WFrO06O478O GwVehErlnWX1d2M3/nv5l3bLmpv+9wwH7ttIzvABs1InyDZxhCpcZq++iPUHzoolt++b nIfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fI95+haoGBM0u90+Xb6mDlCpPZLtJtJ47MePcLtLnu8=; b=2CBFea40EHP8dsNRWntan7V+tFLtQMUlB3NdoxWE3ZugCA8noV5SZ6tuXiX62DHp0x PoLfzgS4oaggQJcg0l+U1SSbRS0637ILWgVmKtvYmGwRhnxheQFQmmXC/MRTgytpxx55 kwOMwEgtPcRyLqrwMOILj9cSf+HnxU9xPUS94aq7I9mWehyvxzrlTur/vjdGTpQ3kqPa nYALsin2pGV/46UWH+PmF0fIc83keGVSVF5yNFyxUpk1zzVt/Kqqklf5Bp7T6FCqXC9j FpelJgrOy5CGjhcaXhUtft4GoEYZxYbIE+ybXGR9d7yOcE0kfQy9fh2vldW8gD5CO+dN on0w== X-Gm-Message-State: AJIora+TcRCBRvQFfBl4Zue6j7CoxAZlfwJzDqAyD214Lqf4F9J38pn8 1Ycpv16N0uVEaftiigKxP/iClZ7lNc4= X-Google-Smtp-Source: AGRyM1tVgrg9s3PhEhu4AIjvtE0/v7F8hWhvGflet9B0hv0r4wdZmbvI9egaAS1g+Pr+zW4/Sdv1vw== X-Received: by 2002:a63:d853:0:b0:40d:6ea0:74d6 with SMTP id k19-20020a63d853000000b0040d6ea074d6mr11991443pgj.26.1656325882926; Mon, 27 Jun 2022 03:31:22 -0700 (PDT) Received: from kparameshwa-a02.vmware.com.com ([49.206.10.9]) by smtp.gmail.com with ESMTPSA id a10-20020a170902ee8a00b0015e8d4eb2d8sm6807395pld.290.2022.06.27.03.31.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 27 Jun 2022 03:31:22 -0700 (PDT) From: Kumara Parameshwaran X-Google-Original-From: Kumara Parameshwaran To: jiayu.hu@intel.com Cc: dev@dpdk.org, Kumara Parameshwaran , stable@dpdk.org Subject: [PATCH v5] gro: bug fix in identifying fragmented packets Date: Mon, 27 Jun 2022 16:01:14 +0530 Message-Id: <20220627103114.94924-1-kumaraparmesh92@gmail.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220320101232.34438-1-kumaraparamesh92@gmail.com> References: <20220320101232.34438-1-kumaraparamesh92@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Kumara Parameshwaran A packet with RTE_PTYPE_L4_FRAG(0x300) contains both RTE_PTYPE_L4_TCP (0x100) & RTE_PTYPE_L4_UDP (0x200). A fragmented packet as defined in rte_mbuf_ptype.h cannot be recognized as other L4 types and hence the GRO layer should not use IS_IPV4_TCP_PKT or IS_IPV4_UDP_PKT for RTE_PTYPE_L4_FRAG. Hence, if the packet type is RTE_PTYPE_L4_FRAG the ip header should be parsed to recognize the appropriate IP type and invoke the respective gro handler. Fixes: 1ca5e6740852 ("gro: support UDP/IPv4") Cc: stable@dpdk.org Signed-off-by: Kumara Parameshwaran --- v1: * Introduce IS_IPV4_FRAGMENT macro to check if fragmented packet and if true extract the IP header to identify the protocol type and invoke the appropriate gro handler. This is done for both rte_gro_reassemble and rte_gro_reassemble_burst APIs. v2,v3,v4: * Fix extra whitespace and column limit warnings v5 * Use RTE_PTYPE_L4_FRAG to identify the fragmented packets in IS_IPV4_TCP_PKT and IS_IPV4_VXLAN_TCP4_PKT lib/gro/rte_gro.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/gro/rte_gro.c b/lib/gro/rte_gro.c index 6f7dd4d709..e35399fd42 100644 --- a/lib/gro/rte_gro.c +++ b/lib/gro/rte_gro.c @@ -32,6 +32,7 @@ static gro_tbl_pkt_count_fn tbl_pkt_count_fn[RTE_GRO_TYPE_MAX_NUM] = { #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_FRAG) != RTE_PTYPE_L4_FRAG) && \ (RTE_ETH_IS_TUNNEL_PKT(ptype) == 0)) #define IS_IPV4_UDP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \ @@ -40,6 +41,7 @@ static gro_tbl_pkt_count_fn tbl_pkt_count_fn[RTE_GRO_TYPE_MAX_NUM] = { #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_L4_FRAG) != RTE_PTYPE_L4_FRAG) && \ ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \ RTE_PTYPE_TUNNEL_VXLAN) && \ ((ptype & RTE_PTYPE_INNER_L4_TCP) == \ -- 2.25.1