All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bill Fink <billfink@mindspring.com>
To: " Ilpo Järvinen " <ilpo.jarvinen@helsinki.fi>
Cc: Evgeniy Polyakov <zbr@ioremap.net>,
	bert hubert <bert.hubert@netherlabs.nl>,
	"H. Willstrand" <h.willstrand@gmail.com>,
	Netdev <netdev@vger.kernel.org>
Subject: Re: sendfile()? Re: SO_LINGER dead: I get an immediate RST on 2.6.24?
Date: Tue, 13 Jan 2009 00:31:08 -0500	[thread overview]
Message-ID: <20090113003108.72860b5c.billfink@mindspring.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0901121111420.24748@wrl-59.cs.helsinki.fi>

On Mon, 12 Jan 2009, Ilpo Järvinen wrote:

> On Sun, 11 Jan 2009, Bill Fink wrote:
> 
> > On Mon, 12 Jan 2009, Evgeniy Polyakov wrote:
> > 
> > > On Mon, Jan 12, 2009 at 12:08:24AM +0100, bert hubert (bert.hubert@netherlabs.nl) wrote:
> > > > I fully understand. Sometimes I have to talk to stupid devices though. What
> > > > I do find is the TCP_INFO ioctl, which offers this field in struct tcp_info:
> > > > 
> > > >         __u32   tcpi_unacked;
> > > > 
> > > > Which comes from:
> > > > 
> > > > struct tcp_sock {
> > > > ...
> > > >         u32     packets_out;    /* Packets which are "in flight"        */
> > > > ...
> > > > }
> > > > 
> > > > If this becomes 0, perhaps this might tell me everything I sent was acked?
> > > 
> > > 0 means that there are noin-flight packets, which is effectively number
> > > of unacked packets. So if your application waits for this field to
> > > become zero, it will wait for all sent packets to be acked.
> > 
> > I use this type of strategy in nuttcp, and it seems to work fine.
> > I have a loop with a small delay and a check of tcpi_unacked, and
> > break out of the loop if tcpi_unacked becomes 0 or a defined timeout
> > period has passed.
> 
> Checking tcpi_unacked alone won't be reliable. The peer might be slow 
> enough to advertize zero window for a short period of time and during 
> that period you would have packets_out zero...

I'll keep this in mind for the future, although it doesn't seem to
be a significant issue in practice.  I use this scheme to try and
account for the tcpi_total_retrans for the data stream, so if this
corner case was hit, it would mean an under reporting of the total
TCP retransmissions for the nuttcp test.

If I understand you correctly, to hit this corner case, just after
the final TCP write, there would have to be no packets in flight
together with a zero TCP window.  To make it more bullet-proof, I
guess after seeing a zero tcpi_unacked, an additional small delay
should be performed, and then rechecking for a zero tcpi_unacked.
I don't see anything else obvious (to me anyway) in the tcp_info
that would be particularly helpful in handling this.

						-Thanks

						-Bill

  reply	other threads:[~2009-01-13  5:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-11 21:23 SO_LINGER dead: I get an immediate RST on 2.6.24? bert hubert
2009-01-11 22:08 ` H. Willstrand
2009-01-11 22:45   ` sendfile()? " bert hubert
2009-01-11 22:54     ` Evgeniy Polyakov
2009-01-11 23:08       ` bert hubert
2009-01-11 23:18         ` Evgeniy Polyakov
2009-01-12  4:50           ` Bill Fink
2009-01-12  9:18             ` Ilpo Järvinen
2009-01-13  5:31               ` Bill Fink [this message]
2009-02-13 17:02                 ` Jeremy Jackson
2009-02-20 18:10                   ` Bill Fink
  -- strict thread matches above, loose matches on Subject: below --
2009-01-13  6:32 Herbert Xu
2009-01-13  6:56 ` Bill Fink
2009-01-13  7:01   ` Herbert Xu
2009-01-14  7:43     ` Bill Fink
2009-01-14  8:29       ` Herbert Xu
2009-01-14  9:05         ` Bill Fink
2009-01-14 11:30           ` Herbert Xu
2009-01-15  6:33             ` Bill Fink
2009-01-13  7:06   ` Rick Jones
2009-01-14  8:05     ` Bill Fink
2009-01-14  8:08       ` Rick Jones
2009-01-14  8:32         ` Bill Fink

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=20090113003108.72860b5c.billfink@mindspring.com \
    --to=billfink@mindspring.com \
    --cc=bert.hubert@netherlabs.nl \
    --cc=h.willstrand@gmail.com \
    --cc=ilpo.jarvinen@helsinki.fi \
    --cc=netdev@vger.kernel.org \
    --cc=zbr@ioremap.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.