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 9F349A0542; Sun, 12 Jun 2022 07:20:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3FE6D40150; Sun, 12 Jun 2022 07:20:33 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 6249B400EF; Sun, 12 Jun 2022 07:20:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655011231; x=1686547231; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=QXsRDnv2e6Qyv+eERh84ks3q8/p015gQT7UQe014Jt4=; b=XZ6FFVruzgD70rVDkjGBxZh/YN1Un5STe3dzhRh99GCd6RxQ+nMmKawa jZKCgRchD8Ub2PanhDbBEShQrm0PyDGh4N/P8cNYlun51h6A3q6NDlxOm Rum6yRBKwKVvN0R7V6vZixzQVtXsd9oMYB13mGvR5e+fU2vHY9SxHyjjd 8qaO0+R58eYxsxKPqiGZ8ktRVPhwiDvzCRTmx1uex1yU5Q4/awbxLp75M drsN1u2kAcV/krqG8o95M6vdNmN3X3TVY3VQK74dIARzK7TOcG0JLSVVm sRRe7PD0VsmxcWza9FOo917WOyTgLYzJRennEJLhWAM0+BVBOSsKLQjid g==; X-IronPort-AV: E=McAfee;i="6400,9594,10375"; a="275523533" X-IronPort-AV: E=Sophos;i="5.91,294,1647327600"; d="scan'208";a="275523533" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2022 22:20:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,294,1647327600"; d="scan'208";a="639037928" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga008.fm.intel.com with ESMTP; 11 Jun 2022 22:20:30 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Sat, 11 Jun 2022 22:20:29 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Sat, 11 Jun 2022 22:20:29 -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; Sat, 11 Jun 2022 22:20:29 -0700 From: "Hu, Jiayu" To: Kumara Parameshwaran CC: "dev@dpdk.org" , "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+XLNQ7VwLTSa1LQAqw Date: Sun, 12 Jun 2022 05:20:29 +0000 Message-ID: <15ebcc9606c14f75a92a7498a3f78589@intel.com> References: <20220320101232.34438-1-kumaraparamesh92@gmail.com> <20220608095704.45375-1-kumaraparmesh92@gmail.com> In-Reply-To: <20220608095704.45375-1-kumaraparmesh92@gmail.com> 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 Hi Kumara, > -----Original Message----- > From: Kumara Parameshwaran > Sent: Wednesday, June 8, 2022 5:57 PM > To: Hu, Jiayu > Cc: dev@dpdk.org; Kumara Parameshwaran > ; stable@dpdk.org > Subject: [PATCH v4] gro: bug fix in identifying fragmented packets >=20 > From: Kumara Parameshwaran >=20 > 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 A simpler way is to add a "((ptype & RTE_PTYPE_L4_FRAG) !=3D RTE_PTYPE_L4_F= RAG))" in IS_IPV4_VXLAN_TCP4_PKT and IS_IPV4_TCP_PKT to avoid processing IP fragme= nts in TCP based GRO functions. For example: #define IS_IPV4_TCP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \ ((ptype & RTE_PTYPE_L4_TCP) =3D=3D RTE_PTYPE_L4_TCP) && \ ((ptype & RTE_PTYPE_L4_FRAG) !=3D RTE_PTYPE_L4_FRAG) && \ (RTE_ETH_IS_TUNNEL_PKT(ptype) =3D=3D 0)) Thanks, Jiayu > header should be parsed to recognize the appropriate IP type and invoke t= he > respective gro handler. >=20 > Fixes: 1ca5e6740852 ("gro: support UDP/IPv4") > Cc: stable@dpdk.org >=20 > 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 >=20 > 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(-) >=20 > 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)) >=20 > +#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(); >=20 > 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) > -- > 2.25.1