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 BEF13A00C3; Thu, 9 Jun 2022 16:19:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A37940689; Thu, 9 Jun 2022 16:19:52 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id D0BC640220; Thu, 9 Jun 2022 16:19:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654784391; x=1686320391; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=5UekxgD2G/20WOZuT4S+pPLZ8aY2jIjpZENmkfvKpdg=; b=Br8SvMbqjzrojWUoMvybWMeVpkiBD8YiBIttGJprG/3gvW5EfmKhHxUu 9Mnrzl2bXz2YDt6wAtUcuQo1yuRg4n2ahOdI/unA9thZYIU/6f2oeI5l4 VIl895wtFlh3lbrn2YCKWsnWPpTSDwDkoI6KjiSTMYWbNYAzg/RC85qaM zRFV8M5OqiSjVXK0VyUz/TLfyz1+D3bcymTI7dmeOUWgCTrj4YJC3TFOA YOUUJcOtLZwDiC+ANjDILcPflsQwCRUYtqqdADifholjui0905EMsLsIn nSronb2kgdVkXMWpwvXOEaq/8F7HwiAuQmW7Qc/1YsrtdYuYlIDTBZO5O A==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="276061381" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="276061381" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 07:19:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="649288914" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga004.fm.intel.com with ESMTP; 09 Jun 2022 07:19:49 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 9 Jun 2022 07:19:49 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 9 Jun 2022 07:19:48 -0700 Received: from fmsmsx612.amr.corp.intel.com ([10.18.126.92]) by fmsmsx612.amr.corp.intel.com ([10.18.126.92]) with mapi id 15.01.2308.027; Thu, 9 Jun 2022 07:19:48 -0700 From: "Hu, Jiayu" To: Thomas Monjalon CC: "dev@dpdk.org" , Kumara Parameshwaran , "stable@dpdk.org" Subject: RE: [PATCH v4] gro: bug fix in identifying fragmented packets Thread-Topic: [PATCH v4] gro: bug fix in identifying fragmented packets Thread-Index: AQHYex4g1KFQES8LpU+XLNQ7VwLTSa1HMOcA///wtcA= Date: Thu, 9 Jun 2022 14:19:48 +0000 Message-ID: <3c3520cb04d6435c8c3ad9a2b2ee8644@intel.com> References: <20220320101232.34438-1-kumaraparamesh92@gmail.com> <20220608095704.45375-1-kumaraparmesh92@gmail.com> <2034426.KlZ2vcFHjT@thomas> In-Reply-To: <2034426.KlZ2vcFHjT@thomas> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.500.17 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 Sure. Will review soon. Thanks, Jiayu > -----Original Message----- > From: Thomas Monjalon > Sent: Thursday, June 9, 2022 4:14 PM > To: Hu, Jiayu > Cc: dev@dpdk.org; Kumara Parameshwaran > ; stable@dpdk.org > Subject: Re: [PATCH v4] gro: bug fix in identifying fragmented packets >=20 > Jiayu, please could you review this patch? >=20 >=20 > 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] =3D { > > ((ptype & RTE_PTYPE_L4_UDP) =3D=3D RTE_PTYPE_L4_UDP) && \ > > (RTE_ETH_IS_TUNNEL_PKT(ptype) =3D=3D 0)) > > > > +#define IS_IPV4_FRAGMENT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \ > > + ((ptype & RTE_PTYPE_L4_FRAG) =3D=3D RTE_PTYPE_L4_FRAG)) > > + > > #define IS_IPV4_VXLAN_TCP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) > && \ > > ((ptype & RTE_PTYPE_L4_UDP) =3D=3D RTE_PTYPE_L4_UDP) && \ > > ((ptype & RTE_PTYPE_TUNNEL_VXLAN) =3D=3D \ @@ -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 =3D > rte_pktmbuf_read(pkts[i], pkts[i]->l2_len, > > + > sizeof(*ip4h), &ip4h_copy); > > + if (ip4h->next_proto_id =3D=3D IPPROTO_UDP && > do_udp4_gro) { > > + ret =3D gro_udp4_reassemble(pkts[i], > > + &udp_tbl, 0); > > + if (ret > 0) > > + nb_after_gro--; > > + else if (ret < 0) > > + unprocess_pkts[unprocess_num++] =3D > pkts[i]; > > + } else if (ip4h->next_proto_id =3D=3D IPPROTO_TCP && > do_tcp4_gro) { > > + ret =3D gro_tcp4_reassemble(pkts[i], > > + &tcp_tbl, 0); > > + if (ret > 0) > > + nb_after_gro--; > > + else if (ret < 0) > > + unprocess_pkts[unprocess_num++] =3D > pkts[i]; > > + } else { > > + unprocess_pkts[unprocess_num++] =3D pkts[i]; > > + } > > + } else if (IS_IPV4_VXLAN_TCP4_PKT(pkts[i]->packet_type) && > > do_vxlan_tcp_gro) { > > ret =3D gro_vxlan_tcp4_reassemble(pkts[i], > > &vxlan_tcp_tbl, 0); > > @@ -349,7 +373,22 @@ rte_gro_reassemble(struct rte_mbuf **pkts, > > current_time =3D rte_rdtsc(); > > > > for (i =3D 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 =3D > rte_pktmbuf_read(pkts[i], pkts[i]->l2_len, > > + > sizeof(*ip4h), &ip4h_copy); > > + if (ip4h->next_proto_id =3D=3D IPPROTO_UDP && > do_udp4_gro) { > > + if (gro_udp4_reassemble(pkts[i], udp_tbl, > > + current_time) < 0) > > + unprocess_pkts[unprocess_num++] =3D > pkts[i]; > > + } else if (ip4h->next_proto_id =3D=3D IPPROTO_TCP && > do_tcp4_gro) { > > + if (gro_tcp4_reassemble(pkts[i], tcp_tbl, > > + current_time) < 0) > > + unprocess_pkts[unprocess_num++] =3D > pkts[i]; > > + } else { > > + unprocess_pkts[unprocess_num++] =3D 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) > > >=20 >=20 >=20 >=20