Commit d59bc188 authored by Gleb Smirnoff's avatar Gleb Smirnoff
Browse files

sockbuf: remove unused mbuf counter and cluster counter

With M_EXTPG mbufs these two counters already do not represent the
reality.  As we are moving towards protocol independent socket buffers,
which may not even use mbufs at all, the counters become less and less
relevant.  The only userland seeing them was 'netstat -x'.

PR:			264181 (exp-run)
Reviewed by:		markj
Differential revision:	https://reviews.freebsd.org/D35334
parent 55c8093f
......@@ -408,8 +408,6 @@ db_print_sockbuf(struct sockbuf *sb, const char *sockbufname, int indent)
db_printf("sb_mbmax: %u\n", sb->sb_mbmax);
db_print_indent(indent);
db_printf("sb_mcnt: %u ", sb->sb_mcnt);
db_printf("sb_ccnt: %u ", sb->sb_ccnt);
db_printf("sb_ctl: %u ", sb->sb_ctl);
db_printf("sb_lowat: %d ", sb->sb_lowat);
db_printf("sb_timeo: %jd\n", sb->sb_timeo);
......
......@@ -153,10 +153,8 @@ sbready_compress(struct sockbuf *sb, struct mbuf *m0, struct mbuf *end)
if ((m->m_flags & M_EXTPG) && m->m_len <= MLEN &&
!mbuf_has_tls_session(m)) {
ext_size = m->m_ext.ext_size;
if (mb_unmapped_compress(m) == 0) {
if (mb_unmapped_compress(m) == 0)
sb->sb_mbcnt -= ext_size;
sb->sb_ccnt -= 1;
}
}
while ((n != NULL) && (n != end) && (m->m_flags & M_EOR) == 0 &&
......@@ -178,11 +176,8 @@ sbready_compress(struct sockbuf *sb, struct mbuf *m0, struct mbuf *end)
sb->sb_mbtail = m;
sb->sb_mbcnt -= MSIZE;
sb->sb_mcnt -= 1;
if (n->m_flags & M_EXT) {
if (n->m_flags & M_EXT)
sb->sb_mbcnt -= n->m_ext.ext_size;
sb->sb_ccnt -= 1;
}
m_free(n);
n = m->m_next;
}
......@@ -281,12 +276,9 @@ sballoc(struct sockbuf *sb, struct mbuf *m)
sb->sb_ctl += m->m_len;
sb->sb_mbcnt += MSIZE;
sb->sb_mcnt += 1;
if (m->m_flags & M_EXT) {
if (m->m_flags & M_EXT)
sb->sb_mbcnt += m->m_ext.ext_size;
sb->sb_ccnt += 1;
}
}
/*
......@@ -324,11 +316,8 @@ sbfree(struct sockbuf *sb, struct mbuf *m)
sb->sb_ctl -= m->m_len;
sb->sb_mbcnt -= MSIZE;
sb->sb_mcnt -= 1;
if (m->m_flags & M_EXT) {
if (m->m_flags & M_EXT)
sb->sb_mbcnt -= m->m_ext.ext_size;
sb->sb_ccnt -= 1;
}
if (sb->sb_sndptr == m) {
sb->sb_sndptr = NULL;
......@@ -354,12 +343,9 @@ sballoc_ktls_rx(struct sockbuf *sb, struct mbuf *m)
sb->sb_tlscc += m->m_len;
sb->sb_mbcnt += MSIZE;
sb->sb_mcnt += 1;
if (m->m_flags & M_EXT) {
if (m->m_flags & M_EXT)
sb->sb_mbcnt += m->m_ext.ext_size;
sb->sb_ccnt += 1;
}
}
void
......@@ -374,12 +360,9 @@ sbfree_ktls_rx(struct sockbuf *sb, struct mbuf *m)
sb->sb_tlscc -= m->m_len;
sb->sb_mbcnt -= MSIZE;
sb->sb_mcnt -= 1;
if (m->m_flags & M_EXT) {
if (m->m_flags & M_EXT)
sb->sb_mbcnt -= m->m_ext.ext_size;
sb->sb_ccnt -= 1;
}
}
#endif
......@@ -1812,8 +1795,6 @@ sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb)
xsb->sb_cc = sb->sb_ccc;
xsb->sb_hiwat = sb->sb_hiwat;
xsb->sb_mbcnt = sb->sb_mbcnt;
xsb->sb_mcnt = sb->sb_mcnt;
xsb->sb_ccnt = sb->sb_ccnt;
xsb->sb_mbmax = sb->sb_mbmax;
xsb->sb_lowat = sb->sb_lowat;
xsb->sb_flags = sb->sb_flags;
......
......@@ -95,8 +95,6 @@ struct sockbuf {
u_int sb_ccc; /* (a) claimed chars in buffer */
u_int sb_hiwat; /* (a) max actual char count */
u_int sb_mbcnt; /* (a) chars of mbufs used */
u_int sb_mcnt; /* (a) number of mbufs in buffer */
u_int sb_ccnt; /* (a) number of clusters in buffer */
u_int sb_mbmax; /* (a) max chars of mbufs to use */
u_int sb_ctl; /* (a) non-data chars in buffer */
u_int sb_tlscc; /* (a) TLS chain characters */
......
......@@ -577,8 +577,6 @@ struct xsocket {
uint32_t sb_cc;
uint32_t sb_hiwat;
uint32_t sb_mbcnt;
uint32_t sb_mcnt;
uint32_t sb_ccnt;
uint32_t sb_mbmax;
int32_t sb_lowat;
int32_t sb_timeo;
......
......@@ -147,8 +147,6 @@ sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb)
xsb->sb_cc = sb->sb_ccc;
xsb->sb_hiwat = sb->sb_hiwat;
xsb->sb_mbcnt = sb->sb_mbcnt;
xsb->sb_mcnt = sb->sb_mcnt;
xsb->sb_ccnt = sb->sb_ccnt;
xsb->sb_mbmax = sb->sb_mbmax;
xsb->sb_lowat = sb->sb_lowat;
xsb->sb_flags = sb->sb_flags;
......@@ -351,11 +349,9 @@ protopr(u_long off, const char *name, int af1, int proto)
xo_emit(" {T:/%-11.11s}", "(state)");
}
if (xflag) {
xo_emit(" {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} "
"{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} "
xo_emit("{T:/%-6.6s} {T:/%-6.6s} "
"{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} "
"{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s}",
"R-MBUF", "S-MBUF", "R-CLUS", "S-CLUS",
"R-HIWA", "S-HIWA", "R-LOWA", "S-LOWA",
"R-BCNT", "S-BCNT", "R-BMAX", "S-BMAX");
xo_emit(" {T:/%7.7s} {T:/%7.7s} {T:/%7.7s} "
......@@ -500,15 +496,12 @@ protopr(u_long off, const char *name, int af1, int proto)
#endif /* INET6 */
}
if (xflag) {
xo_emit("{:receive-mbufs/%6u} {:send-mbufs/%6u} "
"{:receive-clusters/%6u} {:send-clusters/%6u} "
"{:receive-high-water/%6u} {:send-high-water/%6u} "
xo_emit("{:receive-high-water/%6u} "
"{:send-high-water/%6u} "
"{:receive-low-water/%6u} {:send-low-water/%6u} "
"{:receive-mbuf-bytes/%6u} {:send-mbuf-bytes/%6u} "
"{:receive-mbuf-bytes-max/%6u} "
"{:send-mbuf-bytes-max/%6u}",
so->so_rcv.sb_mcnt, so->so_snd.sb_mcnt,
so->so_rcv.sb_ccnt, so->so_snd.sb_ccnt,
so->so_rcv.sb_hiwat, so->so_snd.sb_hiwat,
so->so_rcv.sb_lowat, so->so_snd.sb_lowat,
so->so_rcv.sb_mbcnt, so->so_snd.sb_mbcnt,
......
......@@ -28,7 +28,7 @@
.\" @(#)netstat.1 8.8 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
.Dd September 25, 2020
.Dd May 27, 2022
.Dt NETSTAT 1
.Os
.Sh NAME
......@@ -216,12 +216,7 @@ flag causes
to output all the information recorded about data
stored in the socket buffers.
The fields are:
.Bl -column ".Li R-MBUF"
.It Li R-MBUF Ta Number of mbufs in the receive queue.
.It Li S-MBUF Ta Number of mbufs in the send queue.
.It Li R-CLUS Ta Number of clusters, of any type, in the receive
queue.
.It Li S-CLUS Ta Number of clusters, of any type, in the send queue.
.Bl -column ".Li R-HIWA"
.It Li R-HIWA Ta Receive buffer high water mark, in bytes.
.It Li S-HIWA Ta Send buffer high water mark, in bytes.
.It Li R-LOWA Ta Receive buffer low water mark, in bytes.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment