mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
sockstat: provide more BBLog information
When using -b, provide in addition to the BBLog state also the number of entries stored at the endpoint, the corresponding upper limit and the next sequence number to be assigned. Reviewed by: rrs MFC after: 1 week MFC to: stable/15 MFC to: stable/14 Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D59131
This commit is contained in:
1 parent
a5ff4125cf
commit
209668726c
4 files changed
+69
-6
No files matched your search
@@ -4295,6 +4295,9 @@ tcp_inptoxtp(const struct inpcb *inp, struct xtcpcb *xt)
|
||||
bcopy(CC_ALGO(tp)->name, xt->xt_cc, TCP_CA_NAME_MAX);
|
||||
#ifdef TCP_BLACKBOX
|
||||
(void)tcp_log_get_id(tp, xt->xt_logid);
|
||||
xt->t_lognum = tp->t_lognum;
|
||||
xt->t_loglimit = tp->t_loglimit;
|
||||
xt->t_logsn = tp->t_logsn;
|
||||
#endif
|
||||
|
||||
xt->xt_len = sizeof(struct xtcpcb);
|
||||
|
||||
@@ -1233,7 +1233,10 @@ struct xtcpcb {
|
||||
uint32_t t_dsack_pack; /* (n) */
|
||||
uint16_t xt_encaps_port; /* (s) */
|
||||
int16_t spare16;
|
||||
int32_t spare32[22];
|
||||
int32_t t_lognum; /* (s) */
|
||||
int32_t t_loglimit; /* (s) */
|
||||
uint32_t t_logsn; /* (s) */
|
||||
int32_t spare32[19];
|
||||
} __aligned(8);
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
+47
-3
@@ -198,6 +198,9 @@ struct sock {
|
||||
int state;
|
||||
int fibnum;
|
||||
int bblog_state;
|
||||
int bblog_num;
|
||||
int bblog_limit;
|
||||
unsigned int bblog_sn;
|
||||
const struct proto *proto;
|
||||
const char *protoname;
|
||||
char stack[TCP_FUNCTION_NAME_LEN_MAX];
|
||||
@@ -749,6 +752,9 @@ gather_inet(struct proto *proto)
|
||||
if (proto == &protos[TCP]) {
|
||||
sock->state = xtp->t_state;
|
||||
sock->bblog_state = xtp->t_logstate;
|
||||
sock->bblog_num = xtp->t_lognum;
|
||||
sock->bblog_limit = xtp->t_loglimit;
|
||||
sock->bblog_sn = xtp->t_logsn;
|
||||
memcpy(sock->stack, xtp->xt_stack,
|
||||
TCP_FUNCTION_NAME_LEN_MAX);
|
||||
memcpy(sock->cc, xtp->xt_cc, TCP_CA_NAME_MAX);
|
||||
@@ -1195,6 +1201,9 @@ struct col_widths {
|
||||
int path_state;
|
||||
int conn_state;
|
||||
int bblog_state;
|
||||
int bblog_num;
|
||||
int bblog_limit;
|
||||
int bblog_sn;
|
||||
int stack;
|
||||
int cc;
|
||||
};
|
||||
@@ -1315,6 +1324,12 @@ calculate_sock_column_widths(struct col_widths *cw, struct sock *s)
|
||||
if (opt_b && s->proto == &protos[TCP]) {
|
||||
len = strlen(bblog_state(s->bblog_state));
|
||||
cw->bblog_state = MAX(cw->bblog_state, len);
|
||||
len = snprintf(NULL, 0, "%d", s->bblog_num);
|
||||
cw->bblog_num = MAX(cw->bblog_num, len);
|
||||
len = snprintf(NULL, 0, "%d", s->bblog_limit);
|
||||
cw->bblog_limit = MAX(cw->bblog_limit, len);
|
||||
len = snprintf(NULL, 0, "%u", s->bblog_sn);
|
||||
cw->bblog_sn = MAX(cw->bblog_sn, len);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
@@ -1533,13 +1548,32 @@ display_sock(struct sock *s, struct col_widths *cw, char *buf, size_t bufsize)
|
||||
cw->conn_state, "??");
|
||||
}
|
||||
if (opt_b) {
|
||||
if (s->proto == &protos[TCP])
|
||||
if (s->proto == &protos[TCP]) {
|
||||
xo_emit(" {:bblog-state/%-*s}",
|
||||
cw->bblog_state,
|
||||
bblog_state(s->bblog_state));
|
||||
else if (!is_xo_style_encoding)
|
||||
snprintf(buf, bufsize, "%d",
|
||||
s->bblog_num);
|
||||
xo_emit(" {:bblog-number/%*s}",
|
||||
cw->bblog_num, buf);
|
||||
snprintf(buf, bufsize, "%d",
|
||||
s->bblog_limit);
|
||||
xo_emit(" {:bblog-limit/%*s}",
|
||||
cw->bblog_limit, buf);
|
||||
snprintf(buf, bufsize, "%u",
|
||||
s->bblog_sn);
|
||||
xo_emit(" {:bblog-serial-number/%*s}",
|
||||
cw->bblog_sn, buf);
|
||||
} else if (!is_xo_style_encoding) {
|
||||
xo_emit(" {:bblog-state/%-*s}",
|
||||
cw->bblog_state, "??");
|
||||
xo_emit(" {:bblog-number/%*s}",
|
||||
cw->bblog_num, "??");
|
||||
xo_emit(" {:bblog-limit/%*s}",
|
||||
cw->bblog_limit, "??");
|
||||
xo_emit(" {:bblog-serial-number/%*s}",
|
||||
cw->bblog_sn, "??");
|
||||
}
|
||||
}
|
||||
if (opt_S) {
|
||||
if (s->proto == &protos[TCP])
|
||||
@@ -1599,6 +1633,9 @@ display(void)
|
||||
*__HDR_PATH_STATE="PATH STATE",
|
||||
*__HDR_CONN_STATE="CONN STATE",
|
||||
*__HDR_BBLOG_STATE="BBLOG STATE",
|
||||
*__HDR_BBLOG_NUM="BBLOG NUM",
|
||||
*__HDR_BBLOG_LIMIT="BBLOG LIM",
|
||||
*__HDR_BBLOG_SN="BBLOG SN",
|
||||
*__HDR_STACK="STACK",
|
||||
*__HDR_CC="CC";
|
||||
|
||||
@@ -1631,6 +1668,9 @@ display(void)
|
||||
.path_state = strlen(__HDR_PATH_STATE),
|
||||
.conn_state = strlen(__HDR_CONN_STATE),
|
||||
.bblog_state = strlen(__HDR_BBLOG_STATE),
|
||||
.bblog_num = strlen(__HDR_BBLOG_NUM),
|
||||
.bblog_limit = strlen(__HDR_BBLOG_LIMIT),
|
||||
.bblog_sn = strlen(__HDR_BBLOG_SN),
|
||||
.stack = strlen(__HDR_STACK),
|
||||
.cc = strlen(__HDR_CC),
|
||||
};
|
||||
@@ -1665,8 +1705,12 @@ display(void)
|
||||
__HDR_PATH_STATE);
|
||||
xo_emit(" {T:/%-*s}", cw.conn_state, __HDR_CONN_STATE);
|
||||
}
|
||||
if (opt_b)
|
||||
if (opt_b) {
|
||||
xo_emit(" {T:/%-*s}", cw.bblog_state, __HDR_BBLOG_STATE);
|
||||
xo_emit(" {T:/%*s}", cw.bblog_num, __HDR_BBLOG_NUM);
|
||||
xo_emit(" {T:/%*s}", cw.bblog_limit, __HDR_BBLOG_LIMIT);
|
||||
xo_emit(" {T:/%*s}", cw.bblog_sn, __HDR_BBLOG_SN);
|
||||
}
|
||||
if (opt_S)
|
||||
xo_emit(" {T:/%-*s}", cw.stack, __HDR_STACK);
|
||||
if (opt_C)
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd June 8, 2026
|
||||
.Dd August 26, 2026
|
||||
.Dt SOCKSTAT 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -67,7 +67,7 @@ Show
|
||||
Show the address of a protocol control block (PCB) associated with a socket;
|
||||
used for debugging.
|
||||
.It Fl b
|
||||
Show the BBLog state of the socket.
|
||||
Show BBLog related information for the socket.
|
||||
This is currently only implemented for TCP.
|
||||
.It Fl C
|
||||
Display the congestion control module, if applicable.
|
||||
@@ -228,6 +228,19 @@ is specified (only for SCTP or TCP).
|
||||
The BBLog state if
|
||||
.Fl b
|
||||
is specified (only for TCP).
|
||||
.It Li BBLOG NUM
|
||||
The number of BBLog entries currently being stored at the endpoint if
|
||||
.Fl b
|
||||
is specified (only for TCP).
|
||||
.It Li BBLOG LIM
|
||||
The maximum number of BBLog entries which can be stored at the endpoint
|
||||
if
|
||||
.Fl b
|
||||
is specified (only for TCP).
|
||||
.It Li BBLOG SN
|
||||
The next BBLog sequence number to be assigned if
|
||||
.Fl b
|
||||
is specified (only for TCP).
|
||||
.It Li STACK
|
||||
The protocol stack if
|
||||
.Fl S
|
||||
|
||||
Reference in new issue
Block a user