All of lore.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r@public.gmane.org
To: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [Bug 178241] New: tcp.7 says SIOCOUTQ counts unsent bytes, but in actually counts unacknowledged bytes
Date: Tue, 18 Oct 2016 08:13:07 +0000	[thread overview]
Message-ID: <bug-178241-11311@https.bugzilla.kernel.org/> (raw)

https://bugzilla.kernel.org/show_bug.cgi?id=178241

            Bug ID: 178241
           Summary: tcp.7 says SIOCOUTQ counts unsent bytes, but in
                    actually counts unacknowledged bytes
           Product: Documentation
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: man-pages
          Assignee: documentation_man-pages-ztI5WcYan/vQLgFONoPN62D2FQJk+8+b@public.gmane.org
          Reporter: njs-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org
        Regression: No

tcp.7 says:

       SIOCOUTQ
              Returns the amount of unsent data in the socket send queue. [...]

I believe that this is incorrect, and that it actually returns the amount of
*unacknowledged* data in the socket send queue (i.e., unsent data + data that
has been sent, but for which we're still waiting for an ACK).

This can be confirmed by looking at the source, which does:

575                         answ = tp->write_seq - tp->snd_una;

http://lxr.free-electrons.com/source/net/ipv4/tcp.c#L568

here tp->snd_una is the boundary between acknowledged and unacknowledged data.
If it were reporting unsent data, it would need to use tp->snd_nxt instead.
(The diagram in RFC 793 may help visualize this:
https://tools.ietf.org/html/rfc793#page-20)

I discovered this while trying to figure out how TCP_NOTSENT_LOWAT works.
TCP_NOTSENT_LOWAT makes it so that a socket only becomes writeable if the
unsent data is under a certain threshold, yet SIOCOUTQ was reporting that I had
more unsent data than that, and yet the socket was still writeable... which
makes sense if SIOCOUTQ is not actually reporting the amount of unsent data
:-).

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

                 reply	other threads:[~2016-10-18  8:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=bug-178241-11311@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon-590eeb7gvniway/ihj7yzeb+6bgklq7r@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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.