public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sebastian Huber <sh@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Make use of the stats(3) framework in the TCP stack.
Date: Mon, 11 Jul 2022 11:51:08 +0000 (GMT)	[thread overview]
Message-ID: <20220711115108.DAAAE3854162@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=0c4d87ca5f9aaf2b3af4f435bc7d342dc7a6705f

commit 0c4d87ca5f9aaf2b3af4f435bc7d342dc7a6705f
Author: Edward Tomasz Napierala <trasz@FreeBSD.org>
Date:   Mon Dec 2 20:58:04 2019 +0000

    Make use of the stats(3) framework in the TCP stack.
    
    This makes it possible to retrieve per-connection statistical
    information such as the receive window size, RTT, or goodput,
    using a newly added TCP_STATS getsockopt(3) option, and extract
    them using the stats_voistat_fetch(3) API.
    
    See the net/tcprtt port for an example consumer of this API.
    
    Compared to the existing TCP_INFO system, the main differences
    are that this mechanism is easy to extend without breaking ABI,
    and provides statistical information instead of raw "snapshots"
    of values at a given point in time.  stats(3) is more generic
    and can be used in both userland and the kernel.
    
    Reviewed by:    thj
    Tested by:      thj
    Obtained from:  Netflix
    Relnotes:       yes
    Sponsored by:   Klara Inc, Netflix
    Differential Revision:  https://reviews.freebsd.org/D20655

Diff:
---
 newlib/libc/sys/rtems/include/netinet/tcp.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/newlib/libc/sys/rtems/include/netinet/tcp.h b/newlib/libc/sys/rtems/include/netinet/tcp.h
index 125cacb28..4e06c9792 100644
--- a/newlib/libc/sys/rtems/include/netinet/tcp.h
+++ b/newlib/libc/sys/rtems/include/netinet/tcp.h
@@ -168,6 +168,7 @@ struct tcphdr {
 #define TCP_NOOPT	8	/* don't use TCP options */
 #define TCP_MD5SIG	16	/* use MD5 digests (RFC2385) */
 #define	TCP_INFO	32	/* retrieve tcp_info structure */
+#define	TCP_STATS	33	/* retrieve stats blob structure */
 #define	TCP_LOG		34	/* configure event logging for connection */
 #define	TCP_LOGBUF	35	/* retrieve event log for connection */
 #define	TCP_LOGID	36	/* configure log ID to correlate connections */
@@ -364,4 +365,18 @@ struct tcp_function_set {
  */
 #define	TLS_SET_RECORD_TYPE	1
 
+/*
+ * TCP specific variables of interest for tp->t_stats stats(9) accounting.
+ */
+#define	VOI_TCP_TXPB		0 /* Transmit payload bytes */
+#define	VOI_TCP_RETXPB		1 /* Retransmit payload bytes */
+#define	VOI_TCP_FRWIN		2 /* Foreign receive window */
+#define	VOI_TCP_LCWIN		3 /* Local congesiton window */
+#define	VOI_TCP_RTT		4 /* Round trip time */
+#define	VOI_TCP_CSIG		5 /* Congestion signal */
+#define	VOI_TCP_GPUT		6 /* Goodput */
+#define	VOI_TCP_CALCFRWINDIFF	7 /* Congestion avoidance LCWIN - FRWIN */
+#define	VOI_TCP_GPUT_ND		8 /* Goodput normalised delta */
+#define	VOI_TCP_ACKLEN		9 /* Average ACKed bytes per ACK */
+
 #endif /* !_NETINET_TCP_H_ */


                 reply	other threads:[~2022-07-11 11:51 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=20220711115108.DAAAE3854162@sourceware.org \
    --to=sh@sourceware.org \
    --cc=newlib-cvs@sourceware.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).