DPDK usage discussions
 help / color / mirror / Atom feed
* [GRO] check whether ip_id continuity needs to be checked when two TCP packets are merged.
@ 2023-04-15 14:45 jiangheng (G)
  2023-04-20  2:30 ` Hu, Jiayu
  0 siblings, 1 reply; 4+ messages in thread
From: jiangheng (G) @ 2023-04-15 14:45 UTC (permalink / raw)
  To: users, jiayu.hu, dev

Hi jiayu.hu

It cannot be guaranteed that 16bit identification field of ip packets in the same tcp stream will be continuous.
Please help check whether ip_id continuity needs to be checked when two TCP packets are merged?
Seems to modify the following code, gro will aggregate better, and work better:

diff --git a/lib/gro/gro_tcp4.h b/lib/gro/gro_tcp4.h
index 212f97a042..06faead7b5 100644
--- a/lib/gro/gro_tcp4.h
+++ b/lib/gro/gro_tcp4.h
@@ -291,12 +291,10 @@ check_seq_option(struct gro_tcp4_item *item,
        /* check if the two packets are neighbors */
        len = pkt_orig->pkt_len - l2_offset - pkt_orig->l2_len -
                pkt_orig->l3_len - tcp_hl_orig;
-       if ((sent_seq == item->sent_seq + len) && (is_atomic ||
-                               (ip_id == item->ip_id + 1)))
+       if (sent_seq == item->sent_seq + len)
                /* append the new packet */
                return 1;
-       else if ((sent_seq + tcp_dl == item->sent_seq) && (is_atomic ||
-                               (ip_id + item->nb_merged == item->ip_id)))
+       else if (sent_seq + tcp_dl == item->sent_seq)
                /* pre-pend the new packet */
                return -1;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [GRO] check whether ip_id continuity needs to be checked when two TCP packets are merged.
  2023-04-15 14:45 [GRO] check whether ip_id continuity needs to be checked when two TCP packets are merged jiangheng (G)
@ 2023-04-20  2:30 ` Hu, Jiayu
  2023-04-20  2:45   ` Stephen Hemminger
  2024-08-26 15:48   ` Stephen Hemminger
  0 siblings, 2 replies; 4+ messages in thread
From: Hu, Jiayu @ 2023-04-20  2:30 UTC (permalink / raw)
  To: jiangheng (G), users, dev

Hi Cheng,

> -----Original Message-----
> From: jiangheng (G) <jiangheng14@huawei.com>
> Sent: Saturday, April 15, 2023 10:46 PM
> To: users@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; dev@dpdk.org
> Subject: [GRO] check whether ip_id continuity needs to be checked when
> two TCP packets are merged.
> 
> Hi jiayu.hu
> 
> It cannot be guaranteed that 16bit identification field of ip packets in the
> same tcp stream will be continuous.
> Please help check whether ip_id continuity needs to be checked when two
> TCP packets are merged?
> Seems to modify the following code, gro will aggregate better, and work
> better:
> 
> diff --git a/lib/gro/gro_tcp4.h b/lib/gro/gro_tcp4.h index
> 212f97a042..06faead7b5 100644
> --- a/lib/gro/gro_tcp4.h
> +++ b/lib/gro/gro_tcp4.h
> @@ -291,12 +291,10 @@ check_seq_option(struct gro_tcp4_item *item,
>         /* check if the two packets are neighbors */
>         len = pkt_orig->pkt_len - l2_offset - pkt_orig->l2_len -
>                 pkt_orig->l3_len - tcp_hl_orig;
> -       if ((sent_seq == item->sent_seq + len) && (is_atomic ||
> -                               (ip_id == item->ip_id + 1)))
> +       if (sent_seq == item->sent_seq + len)

For atomic packets, the IP ID field is ignored, as it can be set in various ways.
For non-atomic packets, it follows Linux kernel tcp_gro_receive().

Is this change specific to your case? Can you give more details on why it helps?

Thanks,
Jiayu
>                 /* append the new packet */
>                 return 1;
> -       else if ((sent_seq + tcp_dl == item->sent_seq) && (is_atomic ||
> -                               (ip_id + item->nb_merged == item->ip_id)))
> +       else if (sent_seq + tcp_dl == item->sent_seq)
>                 /* pre-pend the new packet */
>                 return -1;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GRO] check whether ip_id continuity needs to be checked when two TCP packets are merged.
  2023-04-20  2:30 ` Hu, Jiayu
@ 2023-04-20  2:45   ` Stephen Hemminger
  2024-08-26 15:48   ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2023-04-20  2:45 UTC (permalink / raw)
  To: Hu, Jiayu; +Cc: jiangheng (G), users, dev

On Thu, 20 Apr 2023 02:30:41 +0000
"Hu, Jiayu" <jiayu.hu@intel.com> wrote:

> Hi Cheng,
> 
> > -----Original Message-----
> > From: jiangheng (G) <jiangheng14@huawei.com>
> > Sent: Saturday, April 15, 2023 10:46 PM
> > To: users@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; dev@dpdk.org
> > Subject: [GRO] check whether ip_id continuity needs to be checked when
> > two TCP packets are merged.
> > 
> > Hi jiayu.hu
> > 
> > It cannot be guaranteed that 16bit identification field of ip packets in the
> > same tcp stream will be continuous.
> > Please help check whether ip_id continuity needs to be checked when two
> > TCP packets are merged?
> > Seems to modify the following code, gro will aggregate better, and work
> > better:
> > 
> > diff --git a/lib/gro/gro_tcp4.h b/lib/gro/gro_tcp4.h index
> > 212f97a042..06faead7b5 100644
> > --- a/lib/gro/gro_tcp4.h
> > +++ b/lib/gro/gro_tcp4.h
> > @@ -291,12 +291,10 @@ check_seq_option(struct gro_tcp4_item *item,
> >         /* check if the two packets are neighbors */
> >         len = pkt_orig->pkt_len - l2_offset - pkt_orig->l2_len -
> >                 pkt_orig->l3_len - tcp_hl_orig;
> > -       if ((sent_seq == item->sent_seq + len) && (is_atomic ||
> > -                               (ip_id == item->ip_id + 1)))
> > +       if (sent_seq == item->sent_seq + len)  
> 
> For atomic packets, the IP ID field is ignored, as it can be set in various ways.
> For non-atomic packets, it follows Linux kernel tcp_gro_receive().
> 
> Is this change specific to your case? Can you give more details on why it helps?

Many OS's don't change IP ID if DF bit is set.
See RFC 6864 for details
   >> The IPv4 ID field MUST NOT be used for purposes other than
      fragmentation and reassembly.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GRO] check whether ip_id continuity needs to be checked when two TCP packets are merged.
  2023-04-20  2:30 ` Hu, Jiayu
  2023-04-20  2:45   ` Stephen Hemminger
@ 2024-08-26 15:48   ` Stephen Hemminger
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2024-08-26 15:48 UTC (permalink / raw)
  To: Hu, Jiayu; +Cc: jiangheng (G), users, dev

On Thu, 20 Apr 2023 02:30:41 +0000
"Hu, Jiayu" <jiayu.hu@intel.com> wrote:

> Hi Cheng,
> 
> > -----Original Message-----
> > From: jiangheng (G) <jiangheng14@huawei.com>
> > Sent: Saturday, April 15, 2023 10:46 PM
> > To: users@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; dev@dpdk.org
> > Subject: [GRO] check whether ip_id continuity needs to be checked when
> > two TCP packets are merged.
> > 
> > Hi jiayu.hu
> > 
> > It cannot be guaranteed that 16bit identification field of ip packets in the
> > same tcp stream will be continuous.
> > Please help check whether ip_id continuity needs to be checked when two
> > TCP packets are merged?
> > Seems to modify the following code, gro will aggregate better, and work
> > better:
> > 
> > diff --git a/lib/gro/gro_tcp4.h b/lib/gro/gro_tcp4.h index
> > 212f97a042..06faead7b5 100644
> > --- a/lib/gro/gro_tcp4.h
> > +++ b/lib/gro/gro_tcp4.h
> > @@ -291,12 +291,10 @@ check_seq_option(struct gro_tcp4_item *item,
> >         /* check if the two packets are neighbors */
> >         len = pkt_orig->pkt_len - l2_offset - pkt_orig->l2_len -
> >                 pkt_orig->l3_len - tcp_hl_orig;
> > -       if ((sent_seq == item->sent_seq + len) && (is_atomic ||
> > -                               (ip_id == item->ip_id + 1)))
> > +       if (sent_seq == item->sent_seq + len)  
> 
> For atomic packets, the IP ID field is ignored, as it can be set in various ways.
> For non-atomic packets, it follows Linux kernel tcp_gro_receive().
> 
> Is this change specific to your case? Can you give more details on why it helps?
> 
> Thanks,
> Jiayu

Agreed, DPDK GRO should follow Linux to avoid bugs.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-26 15:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-15 14:45 [GRO] check whether ip_id continuity needs to be checked when two TCP packets are merged jiangheng (G)
2023-04-20  2:30 ` Hu, Jiayu
2023-04-20  2:45   ` Stephen Hemminger
2024-08-26 15:48   ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).