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 617C7A0557; Thu, 9 Jun 2022 10:14:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EFC4B40689; Thu, 9 Jun 2022 10:14:14 +0200 (CEST) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by mails.dpdk.org (Postfix) with ESMTP id 7474740220; Thu, 9 Jun 2022 10:14:13 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 29D645C0116; Thu, 9 Jun 2022 04:14:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 09 Jun 2022 04:14:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1654762453; x= 1654848853; bh=bB1zEddQMNpHYvw0CT1/Ro0eBBbvPKyof61m6hQQ+sc=; b=b PwotV3QJr8Ic2UYb0X28awbxAHD0JQiWPIYCcNmPolKG5rZ01MgeIPgjtTLzBOgn Ld/VSETynwPako+t5VJq/uELuY4TjwX7u7EHkUcewExukYSrpo55YHYJCQrnGEDf oAZk6QiQ1A2Dw1iUhI8ueNhDSZpiAq/Ttr8sSdYB/3+EASPTDmlPisvbgaaqIhd1 LtdNianbANtlbEZaEP/prfWoZgbsfJ6SDmBn40z44bvIHbMb/p8/VNgf7KNtrGXc B3lTYySvYpQM1pBa9u5TRJvvcfTC11FTC5NGEQTsDPPPTnu1gT/RfdAsRH/8P9ih hPuewSpF2JP2NttsRR01Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1654762453; x= 1654848853; bh=bB1zEddQMNpHYvw0CT1/Ro0eBBbvPKyof61m6hQQ+sc=; b=M Gz3z5NSNke58ls1h+1IO+aiMdLHS/5awROu26vPxt/mib89ecLrnoUH7dqx1WfUj ZeGWVKp6ekzxpIMO/5vv8tNHAjXw2vlYA6e+1aiwlWN92EbeEtFRypFVs9iiYyLK cNx61H9YEao5RbuZG1Gtf68VAnnF1LfukXEv0hnClBLboY1lLDykImT40SIqlRP+ rC6gnnJoff43BoGU+VJ62/LOTKJztZWrUAf0GiV1DGJSXrJ1EkGOtx8ZB/UldVG3 pVx94gVrmby1DH5fMyI97BAr3bLZtoFBBUyL/lZBUREvcrneE3gEW398u5QorIHn Z/DKcXhihK62IH/SfxceA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddtkedguddvkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhho mhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqne cuggftrfgrthhtvghrnheptdejieeifeehtdffgfdvleetueeffeehueejgfeuteeftddt ieekgfekudehtdfgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 9 Jun 2022 04:14:12 -0400 (EDT) From: Thomas Monjalon To: jiayu.hu@intel.com Cc: dev@dpdk.org, Kumara Parameshwaran , stable@dpdk.org Subject: Re: [PATCH v4] gro: bug fix in identifying fragmented packets Date: Thu, 09 Jun 2022 10:14:10 +0200 Message-ID: <2034426.KlZ2vcFHjT@thomas> In-Reply-To: <20220608095704.45375-1-kumaraparmesh92@gmail.com> References: <20220320101232.34438-1-kumaraparamesh92@gmail.com> <20220608095704.45375-1-kumaraparmesh92@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 Jiayu, please could you review this patch? 08/06/2022 11:57, Kumara Parameshwaran: > 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 > > lib/gro/rte_gro.c | 43 +++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 41 insertions(+), 2 deletions(-) > lib/gro/rte_gro.c | 43 +++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 41 insertions(+), 2 deletions(-) > > diff --git a/lib/gro/rte_gro.c b/lib/gro/rte_gro.c > index 6f7dd4d709..83d6e21dbb 100644 > --- a/lib/gro/rte_gro.c > +++ b/lib/gro/rte_gro.c > @@ -38,6 +38,9 @@ static gro_tbl_pkt_count_fn tbl_pkt_count_fn[RTE_GRO_TYPE_MAX_NUM] = { > ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \ > (RTE_ETH_IS_TUNNEL_PKT(ptype) == 0)) > > +#define IS_IPV4_FRAGMENT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \ > + ((ptype & RTE_PTYPE_L4_FRAG) == RTE_PTYPE_L4_FRAG)) > + > #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) == \ > @@ -240,7 +243,28 @@ rte_gro_reassemble_burst(struct rte_mbuf **pkts, > * The timestamp is ignored, since all packets > * will be flushed from the tables. > */ > - if (IS_IPV4_VXLAN_TCP4_PKT(pkts[i]->packet_type) && > + if (IS_IPV4_FRAGMENT(pkts[i]->packet_type)) { > + struct rte_ipv4_hdr ip4h_copy; > + const struct rte_ipv4_hdr *ip4h = rte_pktmbuf_read(pkts[i], pkts[i]->l2_len, > + sizeof(*ip4h), &ip4h_copy); > + if (ip4h->next_proto_id == IPPROTO_UDP && do_udp4_gro) { > + ret = gro_udp4_reassemble(pkts[i], > + &udp_tbl, 0); > + if (ret > 0) > + nb_after_gro--; > + else if (ret < 0) > + unprocess_pkts[unprocess_num++] = pkts[i]; > + } else if (ip4h->next_proto_id == IPPROTO_TCP && do_tcp4_gro) { > + ret = gro_tcp4_reassemble(pkts[i], > + &tcp_tbl, 0); > + if (ret > 0) > + nb_after_gro--; > + else if (ret < 0) > + unprocess_pkts[unprocess_num++] = pkts[i]; > + } else { > + unprocess_pkts[unprocess_num++] = pkts[i]; > + } > + } else if (IS_IPV4_VXLAN_TCP4_PKT(pkts[i]->packet_type) && > do_vxlan_tcp_gro) { > ret = gro_vxlan_tcp4_reassemble(pkts[i], > &vxlan_tcp_tbl, 0); > @@ -349,7 +373,22 @@ rte_gro_reassemble(struct rte_mbuf **pkts, > current_time = rte_rdtsc(); > > for (i = 0; i < nb_pkts; i++) { > - if (IS_IPV4_VXLAN_TCP4_PKT(pkts[i]->packet_type) && > + if (IS_IPV4_FRAGMENT(pkts[i]->packet_type)) { > + struct rte_ipv4_hdr ip4h_copy; > + const struct rte_ipv4_hdr *ip4h = rte_pktmbuf_read(pkts[i], pkts[i]->l2_len, > + sizeof(*ip4h), &ip4h_copy); > + if (ip4h->next_proto_id == IPPROTO_UDP && do_udp4_gro) { > + if (gro_udp4_reassemble(pkts[i], udp_tbl, > + current_time) < 0) > + unprocess_pkts[unprocess_num++] = pkts[i]; > + } else if (ip4h->next_proto_id == IPPROTO_TCP && do_tcp4_gro) { > + if (gro_tcp4_reassemble(pkts[i], tcp_tbl, > + current_time) < 0) > + unprocess_pkts[unprocess_num++] = pkts[i]; > + } else { > + unprocess_pkts[unprocess_num++] = pkts[i]; > + } > + } else if (IS_IPV4_VXLAN_TCP4_PKT(pkts[i]->packet_type) && > do_vxlan_tcp_gro) { > if (gro_vxlan_tcp4_reassemble(pkts[i], vxlan_tcp_tbl, > current_time) < 0) >