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 4294942CAC; Wed, 14 Jun 2023 05:43:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1AD9540DDB; Wed, 14 Jun 2023 05:43:20 +0200 (CEST) Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) by mails.dpdk.org (Postfix) with ESMTP id 45A1740A7D for ; Wed, 14 Jun 2023 05:43:18 +0200 (CEST) Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-bcd0226607bso320030276.1 for ; Tue, 13 Jun 2023 20:43:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686714197; x=1689306197; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JtR5gvyUcSk7QcZbldlsG1Yrbbub7Jbrx+GO/MI8YbA=; b=iJgHkj0wtvhEWyW4mh6GCNIeIUFZjuMXwzBWTtuYWHaQ+gnVu9lsMuYIl6gNt+EEsH SBu3TN1vKCZNxai9wTl5Tj78G7vFpA05s32PqtjPiSo8/3W+gPTKyXGwvlj/3H+5IB/k n1nF8L0ov9eu0oDPbIlkWzVscoLwZhHvo73BSKzfVXOp2noduqew2DaQ7hnMitzHbxYy MOoGAu/peO9YSlyhYx+hXDWvM6qLLQMTY7UY3WbS4/MbJvDHYXYXGHJUZG06Wb0fKNSb xOr3wsRSohiihbxyfSb35ES4oZTxiae+FFU4KqkErEOFOPxufo/L7Y33zfY3JsFFIRUR CGUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686714197; x=1689306197; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JtR5gvyUcSk7QcZbldlsG1Yrbbub7Jbrx+GO/MI8YbA=; b=PL3J3NKZ+5i+PN+KNWEle9TnD9wtl0K/EmLKenDqW315BLHxfmmOXWGNd1AHI/nHyx z49Jv+Z99XPaoGmdjWTIqwEAdQisiNZ86EXte1qUYaz2DE8f91gBrTn8UB/MkG8K4QfG SIGfj5yre4AuLqznoUXR11fXy+fnGKwHjyHsQEpHHy8JtteSKMMF4emWNCURuMSnwcRi ITQBUPNqODlKpbnituqlZoQivYXfXo1cwfoHEdRtPGgeFe+w5HfRTfamoepPn68DLOJJ TI1OtFde7oQTqDkpXMdQGydlZG10NqBGipucp/zX8ASN3jcQpsH1viKpRLWURTExKl73 XgUA== X-Gm-Message-State: AC+VfDz1iM+TN/POvXM83QqdWPAIzKzRf9bV689IqcGZ7H7zbeQHmSa4 VTjlVZ5uK8Kbk3H81uoiSVyENrgQg7K7ap46eDB997y8 X-Google-Smtp-Source: ACHHUZ4OOHLxM4eO772NTJWKuQVfQWHji9aHHvVCwFIE57T/ah8PvDIaFg+GjtUGLXGYT34a/9zPmJcFQ9WMUhKyeII= X-Received: by 2002:a25:cfd7:0:b0:ba7:a55f:9091 with SMTP id f206-20020a25cfd7000000b00ba7a55f9091mr561234ybg.6.1686714197301; Tue, 13 Jun 2023 20:43:17 -0700 (PDT) MIME-Version: 1.0 References: <20221020181425.48006-1-kumaraparmesh92@gmail.com> <20230612113110.72345-1-kumaraparamesh92@gmail.com> In-Reply-To: From: kumaraparameshwaran rathinavel Date: Wed, 14 Jun 2023 09:13:05 +0530 Message-ID: Subject: Re: [PATCH v7] gro : ipv6 changes to support GRO for TCP/ipv6 To: "Hu, Jiayu" Cc: "dev@dpdk.org" Content-Type: multipart/alternative; boundary="000000000000915d6b05fe0ec03a" 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 --000000000000915d6b05fe0ec03a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 13, 2023 at 7:56=E2=80=AFAM Hu, Jiayu wrot= e: > Hi Kumara, > > Overall, the patch looks good to me. But you need to update the doc and > there > are some minor changes needed to be made. Please see replies inline. > >> Thanks Jiayu. I see some linking errors for windows. It was a for >> inesert_new_tcp_item which is now in *.c file. Earlier this was >> inert_new_item in *.h file. The error is that the insert_new_tcp_item >> function is undefined. Was there a reason why it was in a header file >> earlier ? Just wanted to check with you if you had encountered this befo= re. >> Will try it on a windows setup as well. >> > > After all comments are addressed, you can add "Reviewed-by: Jiayu Hu < > jiayu.hu@intel.com>". > > 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 > > > > The patch adds GRO support for TCP/ipv6 packets. This does not include > the > > support for vxlan, udp ipv6 packets. > > > > 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 contai= n > > extension headers. > > * The logic for the TCP coalescing remains the same, in ipv6 head= er > > 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. > > > > v3: > > * Adderess review comments to fix code duplication for v4 and v6 > > > > v4: > > * Addresses review comments for v3, do not use callbacks > > > > v5: > > * Address review comments > > > > v6: > > * Fix warning and coding style issues > > > > 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 > 100644 > > 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 > > > > 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; > > > > 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; > > > > /* > > @@ -216,7 +135,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, > > > > eth_hdr =3D rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *); > > ipv4_hdr =3D (struct rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_le= n); > > - 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; > > > > /* > > @@ -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; > > > > + 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; > > > > /* Search for a matched flow. */ > > max_flow_num =3D tbl->max_flow_num; > > @@ -270,63 +186,44 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, > > } > > } > > > > - /* > > - * 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; > > } > > > > - /* > > - * 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); > > +} > > > > - /* 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_IN= DEX) > > - 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; > > > > - 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); > > } > > > > 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_ > > > > -#include > > +#include > > Use "#include "gro_tcp_internal.h"". > > > > > -#define INVALID_ARRAY_INDEX 0xffffffffUL #define > > GRO_TCP4_TBL_MAX_ITEM_NUM (1024UL * 1024UL) > > > > diff --git a/lib/gro/gro_tcp6.c b/lib/gro/gro_tcp6.c new file mode 1006= 44 > > 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 issu= e > 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 1006= 44 > > 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 ne= w > 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 ne= w > 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 L= 3 > > + * 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 > neighbors". > > > +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 > --000000000000915d6b05fe0ec03a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Jun 13, 2023 at 7:56=E2=80=AF= AM Hu, Jiayu <jiayu.hu@intel.com> wrote:
Hi= Kumara,

Overall, the patch looks good to me. But you need to update the doc and the= re
are some minor changes needed to be made. Please see replies inline.
Thanks Jiayu. I see some lin= king errors for windows. It was a for inesert_new_tcp_item which is now in = *.c file. Earlier this was inert_new_item in *.h file. The error is that th= e insert_new_tcp_item function is undefined. Was there a reason why it was = in a header file earlier ? Just wanted to check with you if you had encount= ered this before. Will try it on a windows setup as well.
=

After al= l comments are addressed, you can add "Reviewed-by: Jiayu Hu <
jiayu.hu@intel.com&g= t;".

Thanks,
Jiayu

> -----Original Message-----
> From: Kumara Parameshwaran <kumaraparamesh92@gmail.com>
> Sent: Monday, June 12, 2023 7:31 PM
> To: Hu, Jiayu <jiayu.hu@intel.com>
> Cc: dev@dpdk.org= ; Kumara Parameshwaran
> <ku= maraparamesh92@gmail.com>
> Subject: [PATCH v7] gro : ipv6 changes to support GRO for TCP/ipv6
>
> The patch adds GRO support for TCP/ipv6 packets. This does not include= the
> support for vxlan, udp ipv6 packets.
>
> Signed-off-by: Kumara Parameshwaran <kumaraparamesh92@gmail.com>
> ---
> v1:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* Changes to support GRO for TCP/ipv6 packet= s. This does not
> include
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0vxlan changes.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* The GRO is performed only for ipv6 packets= that does not contain
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 extension headers.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* The logic for the TCP coalescing remains t= he same, in ipv6 header
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0the source address, destination addre= ss, flow label, version fields
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0are expected to be the same.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* Re-organised the code to reuse certain tcp= functions for both ipv4
> and
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ipv6 flows.
> v2:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* Fix comments in gro_tcp6.h header file. >
> v3:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* Adderess review comments to fix code dupli= cation for v4 and v6
>
> v4:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* Addresses review comments for v3, do not u= se callbacks
>
> v5:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* Address review comments
>
> v6:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* Fix warning and coding style issues
>
> v7:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* Fix build compilation issue
>=C2=A0 lib/gro/gro_tcp4.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 178 ++++++= -------------------
>=C2=A0 lib/gro/gro_tcp4.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 170 +-----= -----------------
>=C2=A0 lib/gro/gro_tcp6.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 267 ++++++= +++++++++++++++++++++++++++++++
>=C2=A0 lib/gro/gro_tcp6.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 161 ++++++= ++++++++++++++++
>=C2=A0 lib/gro/gro_tcp_internal.c | 128 ++++++++++++++++++
> lib/gro/gro_tcp_internal.h | 212 +++++++++++++++++++++++++++++
>=C2=A0 lib/gro/gro_vxlan_tcp4.c=C2=A0 =C2=A0|=C2=A0 23 ++--
>=C2=A0 lib/gro/gro_vxlan_tcp4.h=C2=A0 =C2=A0|=C2=A0 =C2=A03 +-
>=C2=A0 lib/gro/meson.build=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A02 +=
>=C2=A0 lib/gro/rte_gro.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 83 += +++++++++--
>=C2=A0 lib/gro/rte_gro.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2= =A03 +
>=C2=A0 11 files changed, 897 insertions(+), 333 deletions(-)=C2=A0 crea= te mode 100644
> lib/gro/gro_tcp6.c=C2=A0 create mode 100644 lib/gro/gro_tcp6.h=C2=A0 c= reate mode
> 100644 lib/gro/gro_tcp_internal.c=C2=A0 create mode 100644
> lib/gro/gro_tcp_internal.h
>
> 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
> -
>=C2=A0 int32_t
>=C2=A0 gro_tcp4_reassemble(struct rte_mbuf *pkt,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct gro_tcp4_= tbl *tbl,
> @@ -202,9 +122,8 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0uint8_t is_atomic;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0struct tcp4_flow_key key;
> -=C2=A0 =C2=A0 =C2=A0uint32_t cur_idx, prev_idx, item_idx;
> +=C2=A0 =C2=A0 =C2=A0uint32_t item_idx;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0uint32_t i, max_flow_num, remaining_flow_num= ;
> -=C2=A0 =C2=A0 =C2=A0int cmp;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0uint8_t find;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/*
> @@ -216,7 +135,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0eth_hdr =3D rte_pktmbuf_mtod(pkt, struct rte= _ether_hdr *);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0ipv4_hdr =3D (struct rte_ipv4_hdr *)((char *= )eth_hdr + pkt->l2_len);
> -=C2=A0 =C2=A0 =C2=A0tcp_hdr =3D (struct rte_tcp_hdr *)((char *)ipv4_h= dr + pkt->l3_len);
> +=C2=A0 =C2=A0 =C2=A0tcp_hdr =3D rte_pktmbuf_mtod_offset(pkt, struct r= te_tcp_hdr *,
> +pkt->l2_len + pkt->l3_len);

No need to change the method to obtain tcp_hdr.

>=C2=A0 =C2=A0 =C2=A0 =C2=A0hdr_len =3D pkt->l2_len + pkt->l3_len = + pkt->l4_len;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/*
> @@ -230,7 +149,6 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0ip_tlen =3D rte_be_to_cpu_16(ipv4_hdr->to= tal_length);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (pkt->pkt_len > (uint32_t)(ip_tlen = + pkt->l2_len))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rte_pktmbuf_trim= (pkt, pkt->pkt_len - ip_tlen - pkt->l2_len);
> -
No need to delete the blank line.

>=C2=A0 =C2=A0 =C2=A0 =C2=A0/*
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 * Don't process the packet whose payloa= d length is less than or
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 * equal to 0.
> @@ -239,6 +157,13 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (tcp_dl <=3D 0)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
>
> +=C2=A0 =C2=A0 =C2=A0rte_ether_addr_copy(&(eth_hdr->src_addr),<= br> > &(key.cmn_key.eth_saddr));
> +=C2=A0 =C2=A0 =C2=A0rte_ether_addr_copy(&(eth_hdr->dst_addr),<= br> > &(key.cmn_key.eth_daddr));
> +=C2=A0 =C2=A0 =C2=A0key.ip_src_addr =3D ipv4_hdr->src_addr;
> +=C2=A0 =C2=A0 =C2=A0key.ip_dst_addr =3D ipv4_hdr->dst_addr;
> +=C2=A0 =C2=A0 =C2=A0key.cmn_key.src_port =3D tcp_hdr->src_port; > +=C2=A0 =C2=A0 =C2=A0key.cmn_key.dst_port =3D tcp_hdr->dst_port; > +=C2=A0 =C2=A0 =C2=A0key.cmn_key.recv_ack =3D tcp_hdr->recv_ack;
Add a blank line between key.cmn_key.recv_ack assignment and annotation.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/*
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 * Save IPv4 ID for the packet whose DF bit = is 0. For the packet
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 * whose DF bit is 1, IPv4 ID is ignored. > @@ -246,15 +171,6 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0frag_off =3D rte_be_to_cpu_16(ipv4_hdr->f= ragment_offset);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0is_atomic =3D (frag_off & RTE_IPV4_HDR_D= F_FLAG) =3D=3D
> RTE_IPV4_HDR_DF_FLAG;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0ip_id =3D is_atomic ? 0 : rte_be_to_cpu_16(i= pv4_hdr->packet_id);
> -=C2=A0 =C2=A0 =C2=A0sent_seq =3D rte_be_to_cpu_32(tcp_hdr->sent_se= q);
> -
> -=C2=A0 =C2=A0 =C2=A0rte_ether_addr_copy(&(eth_hdr->src_addr), = &(key.eth_saddr));
> -=C2=A0 =C2=A0 =C2=A0rte_ether_addr_copy(&(eth_hdr->dst_addr), = &(key.eth_daddr));
> -=C2=A0 =C2=A0 =C2=A0key.ip_src_addr =3D ipv4_hdr->src_addr;
> -=C2=A0 =C2=A0 =C2=A0key.ip_dst_addr =3D ipv4_hdr->dst_addr;
> -=C2=A0 =C2=A0 =C2=A0key.src_port =3D tcp_hdr->src_port;
> -=C2=A0 =C2=A0 =C2=A0key.dst_port =3D tcp_hdr->dst_port;
> -=C2=A0 =C2=A0 =C2=A0key.recv_ack =3D tcp_hdr->recv_ack;
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Search for a matched flow. */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0max_flow_num =3D tbl->max_flow_num;
> @@ -270,63 +186,44 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
> -=C2=A0 =C2=A0 =C2=A0/*
> -=C2=A0 =C2=A0 =C2=A0 * Fail to find a matched flow. Insert a new flow= and store the
> -=C2=A0 =C2=A0 =C2=A0 * packet into the flow.
> -=C2=A0 =C2=A0 =C2=A0 */
>=C2=A0 =C2=A0 =C2=A0 =C2=A0if (find =3D=3D 0) {
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0item_idx =3D insert_n= ew_item(tbl, pkt, start_time,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0INVALID_ARRAY_INDEX, sent_seq, ip_id, > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is_atomic);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sent_seq =3D rte_be_t= o_cpu_32(tcp_hdr->sent_seq);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0item_idx =3D insert_n= ew_tcp_item(pkt, tbl->items, &tbl-
> >item_num,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0tbl->max_item_num,
> start_time,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0INVALID_ARRAY_INDEX,
> sent_seq, ip_id,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0is_atomic);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (item_idx =3D= =3D INVALID_ARRAY_INDEX)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0return -1;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (insert_new_f= low(tbl, &key, item_idx) =3D=3D
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0INVALID_ARRAY_INDEX) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0INVALID_ARRAY_INDEX) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0/*
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 * Fail to insert a new flow, so delete the
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 * stored packet.
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 */
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0delete_item(tbl, item_idx, INVALID_ARRAY_INDEX);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0*/
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0delete_tcp_item(tbl->items, item_idx, &tbl-
> >item_num,
> +INVALID_ARRAY_INDEX);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0return -1;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
> -=C2=A0 =C2=A0 =C2=A0/*
> -=C2=A0 =C2=A0 =C2=A0 * Check all packets in the flow and try to find = a neighbor for
> -=C2=A0 =C2=A0 =C2=A0 * the input packet.
> -=C2=A0 =C2=A0 =C2=A0 */
> -=C2=A0 =C2=A0 =C2=A0cur_idx =3D tbl->flows[i].start_index;
> -=C2=A0 =C2=A0 =C2=A0prev_idx =3D cur_idx;
> -=C2=A0 =C2=A0 =C2=A0do {
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cmp =3D check_seq_opt= ion(&(tbl->items[cur_idx]), tcp_hdr,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sent_seq, ip_id, pkt->l4_len, tcp_dl,= 0,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0is_atomic);
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (cmp) {
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0if (merge_two_tcp4_packets(&(tbl->items[cur_idx]),
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0pkt, cmp, sent_seq, ip_id, 0))
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1;
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0/*
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 * Fail to merge the two packets, as the packet
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 * length is greater than the max value. Store
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 * the packet into the flow.
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 */
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0if (insert_new_item(tbl, pkt, start_time, cur_idx,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0sent_seq, ip_id, is_atomic) =3D=3D
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0INVALID_ARRA= Y_INDEX)
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0return 0;
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0prev_idx =3D cur_idx;=
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cur_idx =3D tbl->i= tems[cur_idx].next_pkt_idx;
> -=C2=A0 =C2=A0 =C2=A0} while (cur_idx !=3D INVALID_ARRAY_INDEX);
> +=C2=A0 =C2=A0 =C2=A0return process_tcp_item(pkt, tcp_hdr, tcp_dl, tbl= ->items, tbl-
> >flows[i].start_index,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0&tbl->item_num, tbl-
> >max_item_num,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0ip_id, is_atomic, start_time);
> +}
>
> -=C2=A0 =C2=A0 =C2=A0/* Fail to find a neighbor, so store the packet i= nto the flow. */
> -=C2=A0 =C2=A0 =C2=A0if (insert_new_item(tbl, pkt, start_time, prev_id= x, sent_seq,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ip_id, is_atomic) =3D=3D INVALID_ARRAY_I= NDEX)
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
> +/*
> + * update the packet length for the flushed packet.
> + */
> +static inline void
> +update_header(struct gro_tcp_item *item) {
> +=C2=A0 =C2=A0 =C2=A0struct rte_ipv4_hdr *ipv4_hdr;
> +=C2=A0 =C2=A0 =C2=A0struct rte_mbuf *pkt =3D item->firstseg;
>
> -=C2=A0 =C2=A0 =C2=A0return 0;
> +=C2=A0 =C2=A0 =C2=A0ipv4_hdr =3D (struct rte_ipv4_hdr *)(rte_pktmbuf_= mtod(pkt, char *) +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0pkt->l2_len);
> +=C2=A0 =C2=A0 =C2=A0ipv4_hdr->total_length =3D rte_cpu_to_be_16(pk= t->pkt_len -
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0pkt->l2_len);
>=C2=A0 }
>
>=C2=A0 uint16_t
> @@ -353,7 +250,8 @@ gro_tcp4_tbl_timeout_flush(struct gro_tcp4_tbl *tb= l,
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Delete the packet and get the n= ext
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 * packet in the flow.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 */
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0j =3D delete_item(tbl, j, INVALID_ARRAY_= INDEX);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0j =3D delete_tcp_item(tbl->items, j,<= br> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&tbl->item_num,
> INVALID_ARRAY_INDEX);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0tbl->flows[i].start_index =3D j= ;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (j =3D=3D INVALID_ARRAY_INDEX)<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0tbl-&g= t;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 @@
>=C2=A0 #ifndef _GRO_TCP4_H_
>=C2=A0 #define _GRO_TCP4_H_
>
> -#include <rte_tcp.h>
> +#include <gro_tcp_internal.h>

Use "#include "gro_tcp_internal.h"".

>
> -#define INVALID_ARRAY_INDEX 0xffffffffUL=C2=A0 #define
> GRO_TCP4_TBL_MAX_ITEM_NUM (1024UL * 1024UL)
>
> diff --git a/lib/gro/gro_tcp6.c b/lib/gro/gro_tcp6.c new file mode 100= 644
> 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 100= 644
> 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 <gro_tcp_internal.h>

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= {
> +=C2=A0 =C2=A0 =C2=A0struct cmn_tcp_key cmn_key;
> +=C2=A0 =C2=A0 =C2=A0uint8_t=C2=A0 src_addr[16];
> +=C2=A0 =C2=A0 =C2=A0uint8_t=C2=A0 dst_addr[16];
> +=C2=A0 =C2=A0 =C2=A0rte_be32_t vtc_flow;
> +};
> +
> diff --git a/lib/gro/gro_tcp_internal.c b/lib/gro/gro_tcp_internal.c n= ew 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 <rte_malloc.h>
> +#include <rte_mbuf.h>
> +#include <rte_ethdev.h>
> +
> +#include "gro_tcp_internal.h"
> +
> diff --git a/lib/gro/gro_tcp_internal.h b/lib/gro/gro_tcp_internal.h n= ew 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 <rte_tcp.h>
> +
> +/*
> + * 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) \
> +=C2=A0 =C2=A0 =C2=A0(((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 a= re neighbors".

> +static inline int
> +check_seq_option(struct gro_tcp_item *item,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct rte_tcp_hdr *t= cph,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uint32_t sent_seq, > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uint16_t ip_id,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uint16_t tcp_hl,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uint16_t tcp_dl,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uint16_t l2_offset, > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0uint8_t is_atomic) > +{
> +=C2=A0 =C2=A0 =C2=A0struct rte_mbuf *pkt_orig =3D item->firstseg;<= br> > +=C2=A0 =C2=A0 =C2=A0char *iph_orig;
> +=C2=A0 =C2=A0 =C2=A0struct rte_tcp_hdr *tcph_orig;
> +=C2=A0 =C2=A0 =C2=A0uint16_t len, tcp_hl_orig;
> +
> +=C2=A0 =C2=A0 =C2=A0iph_orig =3D (char *)(rte_pktmbuf_mtod(pkt_orig, = char *) +
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0l2_offset + pkt_orig->l2_len);
> +=C2=A0 =C2=A0 =C2=A0tcph_orig =3D (struct rte_tcp_hdr *)(iph_orig + p= kt_orig->l3_len);
> +=C2=A0 =C2=A0 =C2=A0tcp_hl_orig =3D pkt_orig->l4_len;
> +
> +=C2=A0 =C2=A0 =C2=A0/* Check if TCP option fields equal */
> +=C2=A0 =C2=A0 =C2=A0len =3D RTE_MAX(tcp_hl, tcp_hl_orig) - sizeof(str= uct rte_tcp_hdr);
> +=C2=A0 =C2=A0 =C2=A0if ((tcp_hl !=3D tcp_hl_orig) || ((len > 0) &a= mp;&
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(memcmp(tcph + 1, tcph_orig + 1,
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0len) !=3D 0)= ))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
> +
> +=C2=A0 =C2=A0 =C2=A0/* Don't merge packets whose DF bits are diff= erent */
> +=C2=A0 =C2=A0 =C2=A0if (unlikely(item->is_atomic ^ is_atomic))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
> +
> +=C2=A0 =C2=A0 =C2=A0/* check if the two packets are neighbors */
> +=C2=A0 =C2=A0 =C2=A0len =3D pkt_orig->pkt_len - l2_offset - pkt_or= ig->l2_len -
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pkt_orig->l3_len -= tcp_hl_orig;
> +=C2=A0 =C2=A0 =C2=A0if ((sent_seq =3D=3D item->sent_seq + len) &am= p;& (is_atomic ||
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(ip_id =3D=3D item->l3.ip_id + 1))) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* append the new pac= ket */
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 1;
> +=C2=A0 =C2=A0 =C2=A0else if ((sent_seq + tcp_dl =3D=3D item->sent_= seq) && (is_atomic ||
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(ip_id + item->nb_merged =3D=3D item-= >l3.ip_id)))
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* pre-pend the new p= acket */
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
> +
> +=C2=A0 =C2=A0 =C2=A0return 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()"?

> +=C2=A0 =C2=A0 =C2=A0return (!memcmp(k1, k2, sizeof(struct cmn_tcp_key= ))); }
> +
> +#endif
--000000000000915d6b05fe0ec03a--