DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ilya Matveychikov <matvejchikov@gmail.com>
Cc: dev@dpdk.org, jiayu.hu@intel.com
Subject: Re: [dpdk-dev] A question about GRO neighbor packet matching
Date: Wed, 6 Dec 2017 15:15:32 -0800	[thread overview]
Message-ID: <20171206151532.3abaf2fb@xeon-e3> (raw)
In-Reply-To: <2111ED2C-DB90-4AE3-893E-2406EFE129AD@gmail.com>

On Wed, 6 Dec 2017 22:38:12 +0400
Ilya Matveychikov <matvejchikov@gmail.com> wrote:

> > On Dec 6, 2017, at 10:12 PM, Stephen Hemminger <stephen@networkplumber.org> wrote:
> > 
> > On Wed, 6 Dec 2017 18:02:21 +0400
> > Ilya Matveychikov <matvejchikov@gmail.com> wrote:
> >   
> >> Hello all,
> >> 
> >> 
> >> My question is about neighbor packet matching algorithm for TCP. Is it
> >> correct to expect that IP packets should have continuous ID enumeration
> >> (i.e. iph-next.id = iph-prev.id + 1)?  
> > 
> > 
> > No.
> >   
> >> ~~~
> >> lib/librte_gro/gro_tcp4.c:check_seq_option()
> >> 	...
> >> 	/* check if the two packets are neighbors */
> >> 	tcp_dl0 = pkt0->pkt_len - pkt0->l2_len - pkt0->l3_len - tcp_hl0;
> >> 	if ((sent_seq == (item->sent_seq + tcp_dl0)) &&
> >> 			(ip_id == (item->ip_id + 1)))
> >> 		/* append the new packet */
> >> 		return 1;
> >> 	else if (((sent_seq + tcp_dl) == item->sent_seq) &&
> >> 			((ip_id + item->nb_merged) == item->ip_id))
> >> 		/* pre-pend the new packet */
> >> 		return -1;
> >> 	else
> >> 		return 0;
> >> ~~~
> >> 
> >> As per RFC791:
> >> 
> >>  Identification:  16 bits
> >> 
> >>    An identifying value assigned by the sender to aid in assembling the
> >>    fragments of a datagram.  
> > 
> > The IP header id is meaningless in most TCP sessions.
> > Good TCP implementations use PMTU discovery which sets the Don't Fragment bit.
> > With DF, the IP id is unused (since no fragmentation).
> > Many implementations just send 0 since generating unique IP id requires an
> > atomic operation which is potential bottleneck.  
> 
> So, is my question correct and the code is wrong?
> 

Yes. This code is wrong on several areas.
* The ip_id on TCP flows is irrelevant.
* packet should only be merged if TCP flags are the same.


The author should look at Linux net/ipv4/tcp_offload.c

  reply	other threads:[~2017-12-06 23:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06 14:02 Ilya Matveychikov
2017-12-06 18:12 ` Stephen Hemminger
2017-12-06 18:38   ` Ilya Matveychikov
2017-12-06 23:15     ` Stephen Hemminger [this message]
2017-12-07  0:19       ` Ananyev, Konstantin
2017-12-07  1:01         ` Stephen Hemminger
2017-12-07  7:04           ` Ilya Matveychikov
2017-12-07  8:31           ` Hu, Jiayu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171206151532.3abaf2fb@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=jiayu.hu@intel.com \
    --cc=matvejchikov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).