From nobody Sun Jul 2 13:32:40 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qv93D5D99z4lSKW; Sun, 2 Jul 2023 13:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qv93D4n1Gz3r1Z; Sun, 2 Jul 2023 13:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688304760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xiCj9sdHlOMbGJeuN8ON4OyQt4m34zB1o40+KJ24ZQU=; b=ETiFtlwM6SJ4pZ/cnkzzUGp0z7B4G5/A5OMW8YRFzbXSYKWu4bW4idg3dHYOegoPUYGAwZ O1PyMkT/JuRnzTETZYnDyfHTNNw58ZPsEwZMDRSVQWB+zlta0FmG6SIUmxN/cYzFn3flBm IEh/GZBDjh5kVYE9cvmdy1OzvDsrjw+iNAG/znGAtnxSf6fp+xIEdehPpEiq40xIe1Vv0O Mv/NYMoURXBPSdERpXfMGtzM6xYWJFV9p0uFW7ICroDZ9J91Sfrf9uSgRD4d8gYegrt/jX Tf5sBo3ptLRAlBOl9uuIBr6lVAA+ayEKt9egqL55TLEKhV6hxEOdIYuQ+bdXHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688304760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xiCj9sdHlOMbGJeuN8ON4OyQt4m34zB1o40+KJ24ZQU=; b=Jzjt6uJmy0d2oxRpodnYu0nogqIau9eJGPE8gdREoNP3aID0hz+fOzeQClYi0eo8+6BcPO R3xypOIZ8FzWuti3zMwuiZ9qGViYQtSJdvMt08IvwaL4kNlxHPc3xSJp5KTJjJd+AqVUJn MIKVgDMnR+khKTtLpGuFNNeaxvdxuN1m+SHLVrOAJadGeQ+sZw5p9vhPHJvCxQSE9xCEgK 76R2yktbkl7e9O+Y9n1eEGTnD4tBGnGWhyeIrzdEgUEKnrnP2AHaruFcavlCG4AVkIxMhv Y5zu5apXB+o7ScHVpJsBWzoBrGqTnshGoxFDghWeWja7IuRMhl4rUurz91bR8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688304760; a=rsa-sha256; cv=none; b=VRfwwtOIUg9oVA6dD9beyE+MRotVst2O9VoM0866YB4zD1Fba6R1fIX5SjHbC4tZiZl6eA mMUbliSU5FCNetEv4tR7UveH0RpynF5HYkhRgUcAciQZf0+90Sw7DNU21G2hdmItU5bMTw k6OgZGYItViBXVQMMB4To7stO9tJaQ2CdZMcslHfDmBTRC8HY51IRkVNPrMtFMarm7WUXF NMQ8hMmwffTJhd3sbeWwNfX+W3ntnGU/Oa8UIY+Ya0mQT7TAl5ye8Z+zzfJsgbBZYHs/1j QFMZ3+HnhaaHHbz/KjgRAlh7Wa/j/9PnuKnmnmsvO/DKTWx+HEKL83tRUysczQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Qv93D3sGqz19LB; Sun, 2 Jul 2023 13:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 362DWedW071272; Sun, 2 Jul 2023 13:32:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 362DWe38071271; Sun, 2 Jul 2023 13:32:40 GMT (envelope-from git) Date: Sun, 2 Jul 2023 13:32:40 GMT Message-Id: <202307021332.362DWe38071271@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 2176c9ab71c8 - main - dtrace: improve siftr probe List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2176c9ab71c85efd90a6c7af4a9e04fe8e3d49ca Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=2176c9ab71c85efd90a6c7af4a9e04fe8e3d49ca commit 2176c9ab71c85efd90a6c7af4a9e04fe8e3d49ca Author: Michael Tuexen AuthorDate: 2023-07-02 01:08:51 +0000 Commit: Michael Tuexen CommitDate: 2023-07-02 01:08:51 +0000 dtrace: improve siftr probe Improve consistency of the field names with tcpsinfo_t: * Use mss instead of max_seg_size. * Use lport and rport instead of tcp_localport and tcp_foreignport. Use t_flags instead of flags to improve consistency with t_flags2. Add laddr and raddr, since the addresses were missing when compared to the output of siftr. Reviewed by: cc Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D40834 --- cddl/lib/libdtrace/siftr.d | 27 +++++++++++++++++++-------- share/man/man4/dtrace_tcp.4 | 26 +++++++++++++++----------- sys/netinet/siftr.c | 29 ++++++++++++++++------------- 3 files changed, 50 insertions(+), 32 deletions(-) diff --git a/cddl/lib/libdtrace/siftr.d b/cddl/lib/libdtrace/siftr.d index 791693db7638..ecb307822671 100644 --- a/cddl/lib/libdtrace/siftr.d +++ b/cddl/lib/libdtrace/siftr.d @@ -21,6 +21,7 @@ * $FreeBSD$ */ +#pragma D depends_on library ip.d #pragma D depends_on module kernel #pragma D depends_on module siftr #pragma D depends_on provider tcp @@ -44,20 +45,22 @@ typedef struct siftrinfo { struct timeval tval; uint8_t direction; uint8_t ipver; - uint16_t tcp_localport; - uint16_t tcp_foreignport; + uint16_t lport; + uint16_t rport; + string laddr; + string raddr; uint32_t snd_cwnd; uint32_t snd_wnd; uint32_t rcv_wnd; uint32_t t_flags2; uint32_t snd_ssthresh; int conn_state; - u_int max_seg_size; + uint32_t mss; uint32_t srtt; u_char sack_enabled; u_char snd_scale; u_char rcv_scale; - u_int flags; + u_int t_flags; uint32_t rto; u_int snd_buf_hiwater; u_int snd_buf_cc; @@ -73,20 +76,28 @@ typedef struct siftrinfo { translator siftrinfo_t < struct pkt_node *p > { direction = p == NULL ? 0 : p->direction; ipver = p == NULL ? 0 : p->ipver; - tcp_localport = p == NULL ? 0 : ntohs(p->tcp_localport); - tcp_foreignport = p == NULL ? 0 : ntohs(p->tcp_foreignport); + lport = p == NULL ? 0 : ntohs(p->lport); + rport = p == NULL ? 0 : ntohs(p->fport); + laddr = p == NULL ? "" : + p->ipver == INP_IPV4 ? + inet_ntoa(&p->laddr.id46_addr.ia46_addr4.s_addr) : + inet_ntoa6(&p->laddr.id6_addr); + raddr = p == NULL ? "" : + p->ipver == INP_IPV4 ? + inet_ntoa(&p->faddr.id46_addr.ia46_addr4.s_addr) : + inet_ntoa6(&p->faddr.id6_addr); snd_cwnd = p == NULL ? 0 : p->snd_cwnd; snd_wnd = p == NULL ? 0 : p->snd_wnd; rcv_wnd = p == NULL ? 0 : p->rcv_wnd; t_flags2 = p == NULL ? 0 : p->t_flags2; snd_ssthresh = p == NULL ? 0 : p->snd_ssthresh; conn_state = p == NULL ? 0 : p->conn_state; - max_seg_size = p == NULL ? 0 : p->max_seg_size; + mss = p == NULL ? 0 : p->mss; srtt = p == NULL ? 0 : p->srtt; sack_enabled = p == NULL ? 0 : p->sack_enabled; snd_scale = p == NULL ? 0 : p->snd_scale; rcv_scale = p == NULL ? 0 : p->rcv_scale; - flags = p == NULL ? 0 : p->flags; + t_flags = p == NULL ? 0 : p->t_flags; rto = p == NULL ? 0 : p->rto; snd_buf_hiwater = p == NULL ? 0 : p->snd_buf_hiwater; snd_buf_cc = p == NULL ? 0 : p->snd_buf_cc; diff --git a/share/man/man4/dtrace_tcp.4 b/share/man/man4/dtrace_tcp.4 index 49dd9449d887..0bb5b79169e4 100644 --- a/share/man/man4/dtrace_tcp.4 +++ b/share/man/man4/dtrace_tcp.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 1, 2023 +.Dd July 2, 2023 .Dt DTRACE_TCP 4 .Os .Sh NAME @@ -319,10 +319,14 @@ Either for IPv4, or .Qq 2 for IPv6. -.It Vt uint16_t tcp_localport +.It Vt uint16_t lport The TCP port that the local host is communicating via. -.It Vt uint16_t tcp_foreignport -The TCP port that the foreign host is communicating via. +.It Vt uint16_t rport +The TCP port that the remote host is communicating via. +.It Vt string laddr +The IPv4 or IPv6 address of the local host. +.It Vt string raddr +The IPv4 or IPv6 address of the remote host. .It Vt uint32_t snd_cwnd The current congestion window (CWND) for the flow, in bytes. .It Vt uint32_t snd_wnd @@ -342,8 +346,8 @@ The valid TCP state values are given by the constants prefixed with .Ql TCPS_ in .Pa /usr/lib/dtrace/tcp.d . -.It Vt u_int max_seg_size -The maximum segment size for the flow, in bytes. +.It Vt uint32_t mss +The maximum segment size (MSS) for the flow, in bytes. .It Vt uint32_t srtt The current smoothed RTT (SRTT) for the flow in microseconds. .It Vt u_char sack_enabled @@ -352,7 +356,7 @@ SACK enabled indicator. 1 if SACK enabled, 0 otherwise. The current window scaling factor for the sending window. .It Vt u_char rcv_scale The current window scaling factor for the receiving window. -.It Vt u_int flags +.It Vt u_int t_flags The current value of the t_flags for the flow. .It Vt uint32_t rto The current retransmission timeout (RTO) for the flow in microseconds. @@ -480,15 +484,15 @@ and SSTHRESH when a packet is sent or received: dtrace:::BEGIN { - printf(" %3s %5s %5s %10s %10s\\n", - "DIR", "LPORT", "RPORT", "CWND", "SSTHRESH"); + printf(" %3s %16s:%-5s %16s:%-5s %10s %10s\\n", + "DIR", "LADDR", "LPORT", "RADDR", "RPORT", "CWND", "SSTHRESH"); } tcp:::siftr { - printf(" %3s %5d %5d %10d %10d\\n", + printf(" %3s %16s:%-5d %16s:%-5d %10u %10u\\n", siftr_dir_string[args[0]->direction], - args[0]->tcp_localport, args[0]->tcp_foreignport, + args[0]->laddr, args[0]->lport, args[0]->raddr, args[0]->rport, args[0]->snd_cwnd, args[0]->snd_ssthresh); } .Ed diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c index abbb72a05b06..9154f89fba30 100644 --- a/sys/netinet/siftr.c +++ b/sys/netinet/siftr.c @@ -163,9 +163,13 @@ struct pkt_node { /* IP version pkt_node relates to; either INP_IPV4 or INP_IPV6. */ uint8_t ipver; /* Local TCP port. */ - uint16_t tcp_localport; + uint16_t lport; /* Foreign TCP port. */ - uint16_t tcp_foreignport; + uint16_t fport; + /* Local address. */ + union in_dependaddr laddr; + /* Foreign address. */ + union in_dependaddr faddr; /* Congestion Window (bytes). */ uint32_t snd_cwnd; /* Sending Window (bytes). */ @@ -179,7 +183,7 @@ struct pkt_node { /* Current state of the TCP FSM. */ int conn_state; /* Max Segment Size (bytes). */ - u_int max_seg_size; + uint32_t mss; /* Smoothed RTT (usecs). */ uint32_t srtt; /* Is SACK enabled? */ @@ -189,7 +193,7 @@ struct pkt_node { /* Window scaling for recv window. */ u_char rcv_scale; /* TCP control block flags. */ - u_int flags; + u_int t_flags; /* Retransmission timeout (usec). */ uint32_t rto; /* Size of the TCP send buffer in bytes. */ @@ -223,7 +227,6 @@ struct flow_info #endif uint16_t lport; /* local TCP port */ uint16_t fport; /* foreign TCP port */ - uint8_t ipver; /* IP version */ uint32_t key; /* flowid of the connection */ }; @@ -427,10 +430,10 @@ siftr_process_pkt(struct pkt_node * pkt_node) pkt_node->snd_scale, pkt_node->rcv_scale, pkt_node->conn_state, - pkt_node->max_seg_size, + pkt_node->mss, pkt_node->srtt, pkt_node->sack_enabled, - pkt_node->flags, + pkt_node->t_flags, pkt_node->rto, pkt_node->snd_buf_hiwater, pkt_node->snd_buf_cc, @@ -642,8 +645,10 @@ siftr_siftdata(struct pkt_node *pn, struct inpcb *inp, struct tcpcb *tp, int ipver, int dir, int inp_locally_locked) { pn->ipver = ipver; - pn->tcp_localport = inp->inp_lport; - pn->tcp_foreignport = inp->inp_fport; + pn->lport = inp->inp_lport; + pn->fport = inp->inp_fport; + pn->laddr = inp->inp_inc.inc_ie.ie_dependladdr; + pn->faddr = inp->inp_inc.inc_ie.ie_dependfaddr; pn->snd_cwnd = tp->snd_cwnd; pn->snd_wnd = tp->snd_wnd; pn->rcv_wnd = tp->rcv_wnd; @@ -652,10 +657,10 @@ siftr_siftdata(struct pkt_node *pn, struct inpcb *inp, struct tcpcb *tp, pn->snd_scale = tp->snd_scale; pn->rcv_scale = tp->rcv_scale; pn->conn_state = tp->t_state; - pn->max_seg_size = tp->t_maxseg; + pn->mss = tp->t_maxseg; pn->srtt = ((uint64_t)tp->t_srtt * tick) >> TCP_RTT_SHIFT; pn->sack_enabled = (tp->t_flags & TF_SACK_PERMIT) != 0; - pn->flags = tp->t_flags; + pn->t_flags = tp->t_flags; pn->rto = tp->t_rxtcur * tick; pn->snd_buf_hiwater = inp->inp_socket->so_snd.sb_hiwat; pn->snd_buf_cc = sbused(&inp->inp_socket->so_snd); @@ -796,7 +801,6 @@ siftr_chkpkt(struct mbuf **m, struct ifnet *ifp, int flags, info.lport = ntohs(inp->inp_lport); info.fport = ntohs(inp->inp_fport); info.key = hash_id; - info.ipver = INP_IPV4; hash_node = siftr_new_hash_node(info, dir, ss); } @@ -946,7 +950,6 @@ siftr_chkpkt6(struct mbuf **m, struct ifnet *ifp, int flags, info.lport = ntohs(inp->inp_lport); info.fport = ntohs(inp->inp_fport); info.key = hash_id; - info.ipver = INP_IPV6; hash_node = siftr_new_hash_node(info, dir, ss); }