git: dc485b968dde - main - tcp_info: Add and export more FreeBSD-specific fields
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 22 Aug 2023 18:38:44 UTC
The branch main has been updated by marius:
URL: https://cgit.FreeBSD.org/src/commit/?id=dc485b968ddeb070d23354f55164a8c336acf081
commit dc485b968ddeb070d23354f55164a8c336acf081
Author: Marius Strobl <marius@FreeBSD.org>
AuthorDate: 2023-08-22 18:12:59 +0000
Commit: Marius Strobl <marius@FreeBSD.org>
CommitDate: 2023-08-22 18:34:01 +0000
tcp_info: Add and export more FreeBSD-specific fields
This change adds struct tcp_info fields corresponding to the following
struct tcpcb ones:
- snd_una
- snd_max
- rcv_numsacks
- rcv_adv
- dupacks
Note that while both tcp_fill_info() and fill_tcp_info_from_tcb() are
extended accordingly, no counterpart of rcv_numsacks is available in
the cxgbe(4) TOE PCB, though.
Sponsored by: NetApp, Inc. (originally)
---
sys/dev/cxgbe/tom/t4_tom.c | 4 ++++
sys/netinet/tcp.h | 8 +++++++-
sys/netinet/tcp_usrreq.c | 5 +++++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c
index c5a7e9290666..e5b173964451 100644
--- a/sys/dev/cxgbe/tom/t4_tom.c
+++ b/sys/dev/cxgbe/tom/t4_tom.c
@@ -730,9 +730,13 @@ fill_tcp_info_from_tcb(struct adapter *sc, uint64_t *tcb, struct tcp_info *ti)
ti->tcpi_snd_ssthresh = GET_TCB_FIELD(tcb, SND_SSTHRESH);
ti->tcpi_snd_cwnd = GET_TCB_FIELD(tcb, SND_CWND);
ti->tcpi_rcv_nxt = GET_TCB_FIELD(tcb, RCV_NXT);
+ ti->tcpi_rcv_adv = GET_TCB_FIELD(tcb, RCV_ADV);
+ ti->tcpi_dupacks = GET_TCB_FIELD(tcb, T_DUPACKS);
v = GET_TCB_FIELD(tcb, TX_MAX);
ti->tcpi_snd_nxt = v - GET_TCB_FIELD(tcb, SND_NXT_RAW);
+ ti->tcpi_snd_una = v - GET_TCB_FIELD(tcb, SND_UNA_RAW);
+ ti->tcpi_snd_max = v - GET_TCB_FIELD(tcb, SND_MAX_RAW);
/* Receive window being advertised by us. */
ti->tcpi_rcv_wscale = GET_TCB_FIELD(tcb, SND_SCALE); /* Yes, SND. */
diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h
index 209be3c9345a..2b898d062b0d 100644
--- a/sys/netinet/tcp.h
+++ b/sys/netinet/tcp.h
@@ -427,8 +427,14 @@ struct tcp_info {
u_int32_t tcpi_total_tlp; /* tail loss probes sent */
u_int64_t tcpi_total_tlp_bytes; /* tail loss probe bytes sent */
+ u_int32_t tcpi_snd_una; /* Unacked seqno sent */
+ u_int32_t tcpi_snd_max; /* Highest seqno sent */
+ u_int32_t tcpi_rcv_numsacks; /* Distinct SACK blks present */
+ u_int32_t tcpi_rcv_adv; /* Peer advertised window */
+ u_int32_t tcpi_dupacks; /* Consecutive dup ACKs recvd */
+
/* Padding to grow without breaking ABI. */
- u_int32_t __tcpi_pad[19]; /* Padding. */
+ u_int32_t __tcpi_pad[14]; /* Padding. */
};
/*
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index a6101bc422f7..8b0b3c296c62 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1591,6 +1591,11 @@ tcp_fill_info(const struct tcpcb *tp, struct tcp_info *ti)
ti->tcpi_snd_rexmitpack = tp->t_sndrexmitpack;
ti->tcpi_rcv_ooopack = tp->t_rcvoopack;
ti->tcpi_snd_zerowin = tp->t_sndzerowin;
+ ti->tcpi_snd_una = tp->snd_una;
+ ti->tcpi_snd_max = tp->snd_max;
+ ti->tcpi_rcv_numsacks = tp->rcv_numsacks;
+ ti->tcpi_rcv_adv = tp->rcv_adv;
+ ti->tcpi_dupacks = tp->t_dupacks;
#ifdef TCP_OFFLOAD
if (tp->t_flags & TF_TOE) {
ti->tcpi_options |= TCPI_OPT_TOE;