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 6212442C9D; Tue, 13 Jun 2023 04:26:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 36FD640ED6; Tue, 13 Jun 2023 04:26:00 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 3A06940C35 for ; Tue, 13 Jun 2023 04:25:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686623158; x=1718159158; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=XZMKtryCcdBtMUdLriBOmH6bSUms6pz+iNo0DU6MMl4=; b=ZvmVwSVgZhx5M6GvXDQ2KmMfiOAHs8vPnLJt2xN7GoIng2sAmP3ZeD42 aMt+bMK/1wIDR6ocjzouwi0M3ap+L3y9zYlg1dEZGuoqizm1hAcMdrcf4 biZMOYcjUJDyHi9/YWh71+umhOInuLyy756WE/LKIH+J5c3cpTtI2izGS lTuPtQ1ZzGwWApL5pHV9b/dsjc5i1ZkRgBMGb4p7do++bIlCPvl6CBJnz Faa7uQoZaXlPvawzJbB0lxlO6kNyEWPheVjkgH4rRuEzkwfmO6WhZg6OA nOeV1pm5uU1I7/ImCHz/zUH1O3ztLvlJay46ktbdNhORPG/MoQiB9yFC0 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="342899872" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="342899872" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 19:25:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="855911877" X-IronPort-AV: E=Sophos;i="6.00,238,1681196400"; d="scan'208";a="855911877" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga001.fm.intel.com with ESMTP; 12 Jun 2023 19:25:56 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 12 Jun 2023 19:25:56 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.2507.23; Mon, 12 Jun 2023 19:25:55 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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.2507.23 via Frontend Transport; Mon, 12 Jun 2023 19:25:55 -0700 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.170) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Mon, 12 Jun 2023 19:25:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GUS3e2Oiyr9RR2bMBMKQtYNCNvrPfpr+xDGIGvI4xn3/XyMOUzPhu6SCdMF2akBvQf26BD20dU6zAuRL8i8KCvaYuA9o/j3jfch9Rp7mlXEh38kYFjElGPH6mRYM0jzdndBaYsGArfY545jTPBPWFETyuRsLKo0UZzDsQ3pMiq0D3O9KEhk2RwPl21VKB7me7e7YJ9sH8mUmn/WHGsi86FBn1NmZAizapFLfLCRgx5+DmRr253JevEU9kYOegxdBfXT446KxFoamS+FkMid9FxHtBwV49JUjuohtL1HAgSPjWTmg5Lqj+vmYxHEprstyxEjWtsooGeGI+kCMbxAgEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WmCBRmeX+J1+HAxJCmkTqX8ZXsqzRTb3h+C8RncrgYY=; b=Yv3Jt9wXznGifcwr/Q3nYLAgTOAC9mN5Qe6N/G99elJC6XqBh1sezJy3eMCQKwr6mVgSX+vnTWAprTvw2oxtM5yLa7A/LEH/UwFSIltsOnYw7IXYwfOw2zmeVL+Xq0Ztr52ZAFCb1vW1vH9OxiHPrtht5pL5SgXI97532gZMInvHEGSCWHZPIQ7FDaAivCzgJ3n/4hXuNNJsZeXyVdgua0f14UlJgjGu71XqUbb8dC8TbEYUZR94QenQYjRfUkD3JfM6lF5SxnBVdkNMg72AbBD59sQfsRmAPXit+htTvUqMsVU4+tEhQh5IaUV13W/vRISZL+cRzvnqGDrrrl99vA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from CY5PR11MB6487.namprd11.prod.outlook.com (2603:10b6:930:31::17) by DM6PR11MB4643.namprd11.prod.outlook.com (2603:10b6:5:2a6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.46; Tue, 13 Jun 2023 02:25:53 +0000 Received: from CY5PR11MB6487.namprd11.prod.outlook.com ([fe80::bbdd:44b6:dd11:5070]) by CY5PR11MB6487.namprd11.prod.outlook.com ([fe80::bbdd:44b6:dd11:5070%4]) with mapi id 15.20.6455.045; Tue, 13 Jun 2023 02:25:53 +0000 From: "Hu, Jiayu" To: Kumara Parameshwaran CC: "dev@dpdk.org" Subject: RE: [PATCH v7] gro : ipv6 changes to support GRO for TCP/ipv6 Thread-Topic: [PATCH v7] gro : ipv6 changes to support GRO for TCP/ipv6 Thread-Index: AQHZnSF6YvQguC4Lekiz9WfEl9p3h6+H+OSQ Date: Tue, 13 Jun 2023 02:25:52 +0000 Message-ID: References: <20221020181425.48006-1-kumaraparmesh92@gmail.com> <20230612113110.72345-1-kumaraparamesh92@gmail.com> In-Reply-To: <20230612113110.72345-1-kumaraparamesh92@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CY5PR11MB6487:EE_|DM6PR11MB4643:EE_ x-ms-office365-filtering-correlation-id: 7aed8426-e6ba-4e6e-4c42-08db6bb582ba x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bWsNJi2lFrFgDgoZltFkVyVDfq9FUzDsu8jsJ4FADgXDXOUKyGNwgm5vLNIWNCdyrr+MR3O9RVks5QYZvWESE4cTocJyPgdUqRcWPtMBUoQlJc5I8s08MUzoVLC4h7AqHwatzF1Zp8tXN0Nz2Ozu49rZHwxR0vc1YcyPtn/1AZQBTIQEKGMT8mcWkfLu4dOZsY5wCRcjowlq4DWvaYf2dv4mxcA5bA4mZFqlvu4dL2bc1ln6ayMxpGeh8JJDJKJfQgW+ApuIsTVwLw+s2FIBB0W12LCaCt7FjUWVkxv6+mJ+JKgJvkIMiw7Iv2i9TXICUspZLvvyt1RnTWaHuOxxyNY1mXKlBvJjZN1lMojT7p+pUDTkJ4oLh8wWkbz3855oM77itgivQ89NxcrXJCJ7fCqck1zpSnApm17aHp1lrt3JKijc9bO94QGrIvRwW2n5/1crxFD1PT9+Icm5/MaNsHzErQ8TIPgq3FDMPWSgGjdOCay2shl9IjOwoQZ29HX7w2LburgkjLEgbnzDFaVG5OwgNj/sIp5WGWk/jEh+OFaLlC85QxUcEyjb9KQdt9MMD97Nh0YbLD/NczJGIonoiKvHRl8+vkJbsJPEULLsTAr+iw4z3QibXpgan94zWMuK x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY5PR11MB6487.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(396003)(39860400002)(366004)(346002)(136003)(376002)(451199021)(8936002)(8676002)(52536014)(5660300002)(66556008)(4326008)(6916009)(76116006)(66946007)(64756008)(66446008)(66476007)(316002)(2906002)(41300700001)(30864003)(71200400001)(478600001)(7696005)(122000001)(55016003)(6506007)(26005)(9686003)(83380400001)(186003)(33656002)(53546011)(82960400001)(86362001)(38100700002)(38070700005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?WyKwXK0MBfivFki+DlchZQ2aJH2zc0HE6P55uooU0okZPBXrsL7NoekHzSS6?= =?us-ascii?Q?LLWFW31jlfDlyncnThEhJ9KJSRF+KH60E4w5a3dHX493ebjYUTwPjs3oICG3?= =?us-ascii?Q?TmgqTPC28WAfC7jiL+YQ8mc9UXhNf6rfQDUTqTvbIV353gZj+jLqz6Wi6Dna?= =?us-ascii?Q?9zuZBd5wxJFf5DbxFh7d69THNVWQ1AJBLYZhWF6OWRo04emDAgzoRu1392f+?= =?us-ascii?Q?ujYdfyPiFAE39fcvSJzos/i5MuY5R7hh9cdDs935SW1Fi/sbxXC7BedbPq7H?= =?us-ascii?Q?4dZ+ZbbyuQ2oLF+IW6TSPBUTIPcNo8lbcocCzGR8CoQMZgjCTA0d47rZYRzT?= =?us-ascii?Q?GD2AJ44/3GKuPOPFhZzJ9W1PDh7tSVWAP5PkokuF9EI/Gd3QohF1oOUhLAnP?= =?us-ascii?Q?yzjV7I0HaSNvc5pmOIC0bBTYFU/UZ/Ck7G/Ilu21o3vNSceNgOQXmy8MpCod?= =?us-ascii?Q?gM3J3dIv6JIsYMV2niPBi5buKpWHjjSCYVqOmeGUYm8t2u/MPTrcAq/yrauS?= =?us-ascii?Q?bBn8s+LAlXEsQYf4KXB3oQPYHVqERZimxbVmGEhz/aLkiQOFTkfqpXIRdZwK?= =?us-ascii?Q?AQ09Lw9HdcLNnFNRmtaBMBbAC1q5FiUrhDooOANZBRdXDfAnhSPD8tmRFKEB?= =?us-ascii?Q?GI5NB59RWxNo9JV0elWrALPjxkf90Mv/Dco4u7mGvLhTR0bPobrOmH+XL5IU?= =?us-ascii?Q?CQEoju1kisdne7WBoqkOuxpqr1g9SIdn4fiatxPRMXJx0w3HFU3xz+4ed+TN?= =?us-ascii?Q?p53FsByZCFTrIrEMbKn4GVxEbdA+asQN4X/6SXFTWBpCSO+Vzydr2+xFV6zJ?= =?us-ascii?Q?6aTCuYATRIOi45vR+IpYREeURSajynd57ww7imUfXHeIkSIp0MxbUaftDP2v?= =?us-ascii?Q?DYpcNV31JL4pVxJ2aF3msbQUhhmFrxZEpvBpqmCLZsq3ljKM+bN0bsLhnHtP?= =?us-ascii?Q?OwG1J3jn/BTdDSRswue0gQ5OLFUVeQGYOQ9zeaok6jf19dvUE98NvGGPG+RC?= =?us-ascii?Q?BtbWuR9lIPLsBw8xARaqhbXGPCshAHGtwu+f5Z/LeXL0e/mPFmNFQzdRYg7e?= =?us-ascii?Q?rPxsRcb0W/klsuiEC0uEZGprGZisoXROxnWvdMwHwY1iLzhzV1NJ929FgJSs?= =?us-ascii?Q?GMDjX0+bLDvxxHpIZNoxIY/fpuFy8gvq8t3yx2rnrz70OqG9uUobkWyxafiI?= =?us-ascii?Q?tfcfNt8/dqRuHMw461BCCNEv/d4eDhTYjt3PEIeS0lnJ8kVQKfdMQurwp2S6?= =?us-ascii?Q?BGo+d50JIwLJgeuLzldjDtSD4fU+BcMbtp9w8r2HUlgo1S/xKobI2vG9EhsL?= =?us-ascii?Q?T8Zb7J9LwTiJ8YiyPJG7wge3LLEXFtLC1y9EiXdjR/UQa9LnQPgNBjjDDpUL?= =?us-ascii?Q?7FYt5nfUWjt/7igkoqEsfgTHZMgZNKy8Adv7Kehd/1SIf+FgNpyaURRH0i+N?= =?us-ascii?Q?V1zXb/iRMol1NwUHX4jx9jJsgzx81/poseWLu32iLkjvBQfglhNjTy9VzOKK?= =?us-ascii?Q?cfrINI4Azwn+5Mq5201jJObOwObfRiIUO0APCO2u+F3LD4qgAzRmsAyKrF/Z?= =?us-ascii?Q?bKY783v3BmzfQONOL21+lNsYCuITXbzThp8MpFtE?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY5PR11MB6487.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7aed8426-e6ba-4e6e-4c42-08db6bb582ba X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jun 2023 02:25:52.9427 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: JYxBNSgQJ9sZRdeOwRsxGjC4pw1QpVbVBAe7dGPgW6YIcaZGR0+xRTNZzodBFm0rNeuSD9Pbj95EmbVM+O+L5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4643 X-OriginatorOrg: intel.com 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, Overall, the patch looks good to me. But you need to update the doc and the= re=20 are some minor changes needed to be made. Please see replies inline. After all comments are addressed, you can add "Reviewed-by: Jiayu Hu ". Thanks, Jiayu > -----Original Message----- > From: Kumara Parameshwaran > Sent: Monday, June 12, 2023 7:31 PM > To: Hu, Jiayu > Cc: dev@dpdk.org; Kumara Parameshwaran > > Subject: [PATCH v7] gro : ipv6 changes to support GRO for TCP/ipv6 >=20 > The patch adds GRO support for TCP/ipv6 packets. This does not include th= e > support for vxlan, udp ipv6 packets. >=20 > Signed-off-by: Kumara Parameshwaran > --- > v1: > * Changes to support GRO for TCP/ipv6 packets. This does not > include > vxlan changes. > * The GRO is performed only for ipv6 packets that does not contain > extension headers. > * The logic for the TCP coalescing remains the same, in ipv6 header > the source address, destination address, flow label, version fields > are expected to be the same. > * Re-organised the code to reuse certain tcp functions for both ipv4 > and > ipv6 flows. > v2: > * Fix comments in gro_tcp6.h header file. >=20 > v3: > * Adderess review comments to fix code duplication for v4 and v6 >=20 > v4: > * Addresses review comments for v3, do not use callbacks >=20 > v5: > * Address review comments >=20 > v6: > * Fix warning and coding style issues >=20 > v7: > * Fix build compilation issue > lib/gro/gro_tcp4.c | 178 ++++++------------------- > lib/gro/gro_tcp4.h | 170 +---------------------- > lib/gro/gro_tcp6.c | 267 +++++++++++++++++++++++++++++++++++++ > lib/gro/gro_tcp6.h | 161 ++++++++++++++++++++++ > lib/gro/gro_tcp_internal.c | 128 ++++++++++++++++++ > lib/gro/gro_tcp_internal.h | 212 +++++++++++++++++++++++++++++ > lib/gro/gro_vxlan_tcp4.c | 23 ++-- > lib/gro/gro_vxlan_tcp4.h | 3 +- > lib/gro/meson.build | 2 + > lib/gro/rte_gro.c | 83 ++++++++++-- > lib/gro/rte_gro.h | 3 + > 11 files changed, 897 insertions(+), 333 deletions(-) create mode 10064= 4 > lib/gro/gro_tcp6.c create mode 100644 lib/gro/gro_tcp6.h create mode > 100644 lib/gro/gro_tcp_internal.c create mode 100644 > lib/gro/gro_tcp_internal.h >=20 > diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index > 0014096e63..42fee78f30 100644 > --- a/lib/gro/gro_tcp4.c > +++ b/lib/gro/gro_tcp4.c > - > int32_t > gro_tcp4_reassemble(struct rte_mbuf *pkt, > struct gro_tcp4_tbl *tbl, > @@ -202,9 +122,8 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, > uint8_t is_atomic; >=20 > struct tcp4_flow_key key; > - uint32_t cur_idx, prev_idx, item_idx; > + uint32_t item_idx; > uint32_t i, max_flow_num, remaining_flow_num; > - int cmp; > uint8_t find; >=20 > /* > @@ -216,7 +135,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, >=20 > eth_hdr =3D rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); > ipv4_hdr =3D (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len); > - tcp_hdr =3D (struct rte_tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len); > + tcp_hdr =3D rte_pktmbuf_mtod_offset(pkt, struct rte_tcp_hdr *, > +pkt->l2_len + pkt->l3_len); No need to change the method to obtain tcp_hdr. > hdr_len =3D pkt->l2_len + pkt->l3_len + pkt->l4_len; >=20 > /* > @@ -230,7 +149,6 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, > ip_tlen =3D rte_be_to_cpu_16(ipv4_hdr->total_length); > if (pkt->pkt_len > (uint32_t)(ip_tlen + pkt->l2_len)) > rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_tlen - pkt->l2_len); > - No need to delete the blank line. > /* > * Don't process the packet whose payload length is less than or > * equal to 0. > @@ -239,6 +157,13 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, > if (tcp_dl <=3D 0) > return -1; >=20 > + rte_ether_addr_copy(&(eth_hdr->src_addr), > &(key.cmn_key.eth_saddr)); > + rte_ether_addr_copy(&(eth_hdr->dst_addr), > &(key.cmn_key.eth_daddr)); > + key.ip_src_addr =3D ipv4_hdr->src_addr; > + key.ip_dst_addr =3D ipv4_hdr->dst_addr; > + key.cmn_key.src_port =3D tcp_hdr->src_port; > + key.cmn_key.dst_port =3D tcp_hdr->dst_port; > + key.cmn_key.recv_ack =3D tcp_hdr->recv_ack; Add a blank line between key.cmn_key.recv_ack assignment and annotation. > /* > * Save IPv4 ID for the packet whose DF bit is 0. For the packet > * whose DF bit is 1, IPv4 ID is ignored. > @@ -246,15 +171,6 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, > frag_off =3D rte_be_to_cpu_16(ipv4_hdr->fragment_offset); > is_atomic =3D (frag_off & RTE_IPV4_HDR_DF_FLAG) =3D=3D > RTE_IPV4_HDR_DF_FLAG; > ip_id =3D is_atomic ? 0 : rte_be_to_cpu_16(ipv4_hdr->packet_id); > - sent_seq =3D rte_be_to_cpu_32(tcp_hdr->sent_seq); > - > - rte_ether_addr_copy(&(eth_hdr->src_addr), &(key.eth_saddr)); > - rte_ether_addr_copy(&(eth_hdr->dst_addr), &(key.eth_daddr)); > - key.ip_src_addr =3D ipv4_hdr->src_addr; > - key.ip_dst_addr =3D ipv4_hdr->dst_addr; > - key.src_port =3D tcp_hdr->src_port; > - key.dst_port =3D tcp_hdr->dst_port; > - key.recv_ack =3D tcp_hdr->recv_ack; >=20 > /* Search for a matched flow. */ > max_flow_num =3D tbl->max_flow_num; > @@ -270,63 +186,44 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, > } > } >=20 > - /* > - * Fail to find a matched flow. Insert a new flow and store the > - * packet into the flow. > - */ > if (find =3D=3D 0) { > - item_idx =3D insert_new_item(tbl, pkt, start_time, > - INVALID_ARRAY_INDEX, sent_seq, ip_id, > - is_atomic); > + sent_seq =3D rte_be_to_cpu_32(tcp_hdr->sent_seq); > + item_idx =3D insert_new_tcp_item(pkt, tbl->items, &tbl- > >item_num, > + tbl->max_item_num, > start_time, > + INVALID_ARRAY_INDEX, > sent_seq, ip_id, > + is_atomic); > if (item_idx =3D=3D INVALID_ARRAY_INDEX) > return -1; > if (insert_new_flow(tbl, &key, item_idx) =3D=3D > - INVALID_ARRAY_INDEX) { > + INVALID_ARRAY_INDEX) { > /* > * Fail to insert a new flow, so delete the > * stored packet. > - */ > - delete_item(tbl, item_idx, INVALID_ARRAY_INDEX); > + */ > + delete_tcp_item(tbl->items, item_idx, &tbl- > >item_num, > +INVALID_ARRAY_INDEX); > return -1; > } > return 0; > } >=20 > - /* > - * Check all packets in the flow and try to find a neighbor for > - * the input packet. > - */ > - cur_idx =3D tbl->flows[i].start_index; > - prev_idx =3D cur_idx; > - do { > - cmp =3D check_seq_option(&(tbl->items[cur_idx]), tcp_hdr, > - sent_seq, ip_id, pkt->l4_len, tcp_dl, 0, > - is_atomic); > - if (cmp) { > - if (merge_two_tcp4_packets(&(tbl->items[cur_idx]), > - pkt, cmp, sent_seq, ip_id, 0)) > - return 1; > - /* > - * Fail to merge the two packets, as the packet > - * length is greater than the max value. Store > - * the packet into the flow. > - */ > - if (insert_new_item(tbl, pkt, start_time, cur_idx, > - sent_seq, ip_id, is_atomic) =3D=3D > - INVALID_ARRAY_INDEX) > - return -1; > - return 0; > - } > - prev_idx =3D cur_idx; > - cur_idx =3D tbl->items[cur_idx].next_pkt_idx; > - } while (cur_idx !=3D INVALID_ARRAY_INDEX); > + return process_tcp_item(pkt, tcp_hdr, tcp_dl, tbl->items, tbl- > >flows[i].start_index, > + &tbl->item_num, tbl- > >max_item_num, > + ip_id, is_atomic, start_time); > +} >=20 > - /* Fail to find a neighbor, so store the packet into the flow. */ > - if (insert_new_item(tbl, pkt, start_time, prev_idx, sent_seq, > - ip_id, is_atomic) =3D=3D INVALID_ARRAY_INDEX) > - return -1; > +/* > + * update the packet length for the flushed packet. > + */ > +static inline void > +update_header(struct gro_tcp_item *item) { > + struct rte_ipv4_hdr *ipv4_hdr; > + struct rte_mbuf *pkt =3D item->firstseg; >=20 > - return 0; > + ipv4_hdr =3D (struct rte_ipv4_hdr *)(rte_pktmbuf_mtod(pkt, char *) + > + pkt->l2_len); > + ipv4_hdr->total_length =3D rte_cpu_to_be_16(pkt->pkt_len - > + pkt->l2_len); > } >=20 > uint16_t > @@ -353,7 +250,8 @@ gro_tcp4_tbl_timeout_flush(struct gro_tcp4_tbl *tbl, > * Delete the packet and get the next > * packet in the flow. > */ > - j =3D delete_item(tbl, j, INVALID_ARRAY_INDEX); > + j =3D delete_tcp_item(tbl->items, j, > + &tbl->item_num, > INVALID_ARRAY_INDEX); > tbl->flows[i].start_index =3D j; > if (j =3D=3D INVALID_ARRAY_INDEX) > tbl->flow_num--; > diff --git a/lib/gro/gro_tcp4.h b/lib/gro/gro_tcp4.h index > 212f97a042..c0154afa24 100644 > --- a/lib/gro/gro_tcp4.h > +++ b/lib/gro/gro_tcp4.h > @@ -5,32 +5,15 @@ > #ifndef _GRO_TCP4_H_ > #define _GRO_TCP4_H_ >=20 > -#include > +#include Use "#include "gro_tcp_internal.h"". >=20 > -#define INVALID_ARRAY_INDEX 0xffffffffUL #define > GRO_TCP4_TBL_MAX_ITEM_NUM (1024UL * 1024UL) >=20 > diff --git a/lib/gro/gro_tcp6.c b/lib/gro/gro_tcp6.c new file mode 100644 > index 0000000000..0ea73741c1 > --- /dev/null > +++ b/lib/gro/gro_tcp6.c > @@ -0,0 +1,267 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2017 Intel Corporation > + */ The license header is incorrect, and please update. Same and similar issue = happens in the new added files, like gro_tcp_internal.h. > + > diff --git a/lib/gro/gro_tcp6.h b/lib/gro/gro_tcp6.h new file mode 100644 > index 0000000000..cc02b0004a > --- /dev/null > +++ b/lib/gro/gro_tcp6.h > @@ -0,0 +1,161 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2017 Intel Corporation > + */ Ditto. > + > +#ifndef _GRO_TCP6_H_ > +#define _GRO_TCP6_H_ > + > +#include Use "#include "gro_tcp_internal.h"". > + > +#define INVALID_ARRAY_INDEX 0xffffffffUL #define Duplicate definition for INVALID_ARRAY_INDEX in both gro_tcp6.h and gro_tcp_internal.h. > +GRO_TCP6_TBL_MAX_ITEM_NUM (1024UL * 1024UL) > + > +/* Header fields representing a TCP/IPv6 flow */ struct tcp6_flow_key { > + struct cmn_tcp_key cmn_key; > + uint8_t src_addr[16]; > + uint8_t dst_addr[16]; > + rte_be32_t vtc_flow; > +}; > + > diff --git a/lib/gro/gro_tcp_internal.c b/lib/gro/gro_tcp_internal.c new = file > mode 100644 index 0000000000..5a21bca7f8 > --- /dev/null > +++ b/lib/gro/gro_tcp_internal.c > @@ -0,0 +1,128 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2017 Intel Corporation > + */ Update license header. > +#include > +#include > +#include > + > +#include "gro_tcp_internal.h" > + > diff --git a/lib/gro/gro_tcp_internal.h b/lib/gro/gro_tcp_internal.h new = file > mode 100644 index 0000000000..072b7aea13 > --- /dev/null > +++ b/lib/gro/gro_tcp_internal.h > @@ -0,0 +1,212 @@ > +#ifndef _GRO_TCP_H_ > +#define _GRO_TCP_H_ > + Add license header in this file. > +#define INVALID_ARRAY_INDEX 0xffffffffUL > + > +#include > + > +/* > + * The max length of a IPv4 packet, which includes the length of the L3 > + * header, the L4 header and the data payload. > + */ > +#define MAX_IP_PKT_LENGTH UINT16_MAX > + > +/* The maximum TCP header length */ > +#define MAX_TCP_HLEN 60 > +#define INVALID_TCP_HDRLEN(len) \ > + (((len) < sizeof(struct rte_tcp_hdr)) || ((len) > MAX_TCP_HLEN)) > + > +/* > + * Check if two TCP/IPv4 packets are neighbors. > + */ This function is not only for TCP4, so use "Check if two TCP packets are ne= ighbors". > +static inline int > +check_seq_option(struct gro_tcp_item *item, > + struct rte_tcp_hdr *tcph, > + uint32_t sent_seq, > + uint16_t ip_id, > + uint16_t tcp_hl, > + uint16_t tcp_dl, > + uint16_t l2_offset, > + uint8_t is_atomic) > +{ > + struct rte_mbuf *pkt_orig =3D item->firstseg; > + char *iph_orig; > + struct rte_tcp_hdr *tcph_orig; > + uint16_t len, tcp_hl_orig; > + > + iph_orig =3D (char *)(rte_pktmbuf_mtod(pkt_orig, char *) + > + l2_offset + pkt_orig->l2_len); > + tcph_orig =3D (struct rte_tcp_hdr *)(iph_orig + pkt_orig->l3_len); > + tcp_hl_orig =3D pkt_orig->l4_len; > + > + /* Check if TCP option fields equal */ > + len =3D RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(struct rte_tcp_hdr); > + if ((tcp_hl !=3D tcp_hl_orig) || ((len > 0) && > + (memcmp(tcph + 1, tcph_orig + 1, > + len) !=3D 0))) > + return 0; > + > + /* Don't merge packets whose DF bits are different */ > + if (unlikely(item->is_atomic ^ is_atomic)) > + return 0; > + > + /* check if the two packets are neighbors */ > + len =3D pkt_orig->pkt_len - l2_offset - pkt_orig->l2_len - > + pkt_orig->l3_len - tcp_hl_orig; > + if ((sent_seq =3D=3D item->sent_seq + len) && (is_atomic || > + (ip_id =3D=3D item->l3.ip_id + 1))) > + /* append the new packet */ > + return 1; > + else if ((sent_seq + tcp_dl =3D=3D item->sent_seq) && (is_atomic || > + (ip_id + item->nb_merged =3D=3D item->l3.ip_id))) > + /* pre-pend the new packet */ > + return -1; > + > + return 0; > +} > + > +static inline int > +is_common_tcp_key(struct cmn_tcp_key *k1, struct cmn_tcp_key *k2) { Rename it to "is_same_common_tcp_key()"? > + return (!memcmp(k1, k2, sizeof(struct cmn_tcp_key))); } > + > +#endif