git: 9front

Download patch

ref: c9d9cb2f16a558d50114557839be6d6266acf733
parent: fda3acee5812fcae68ed2a50c2cbe15f7f354dfd
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Apr 24 05:06:22 EDT 2024

tcp: remove "MaxSegment" MIB stat, add InLimbo stat

This global "Mss" MIB element does not really exists,
and it makes no sense as the MSS is negotiated
per connection.

Put the InLimbo in the statistics table.

--- a/sys/src/9/ip/tcp.c
+++ b/sys/src/9/ip/tcp.c
@@ -308,7 +308,6 @@
 enum {
 	/* MIB stats */
 	MaxConn,
-	Mss,
 	ActiveOpens,
 	PassiveOpens,
 	EstabResets,
@@ -339,6 +338,8 @@
 	RecoveryCwind,
 	RecoveryPA,
 
+	InLimbo,
+
 	Nstats
 };
 
@@ -345,7 +346,6 @@
 static char *statnames[Nstats] =
 {
 [MaxConn]	"MaxConn",
-[Mss]		"MaxSegment",
 [ActiveOpens]	"ActiveOpens",
 [PassiveOpens]	"PassiveOpens",
 [EstabResets]	"EstabResets",
@@ -374,6 +374,8 @@
 [RecoveryNoSeq]	"RecoveryNoSeq",
 [RecoveryCwind]	"RecoveryCwind",
 [RecoveryPA]	"RecoveryPA",
+
+[InLimbo]	"InLimbo",
 };
 
 typedef struct Tcppriv Tcppriv;
@@ -887,7 +889,6 @@
 	Tcpctl *tcb;
 	Tcp4hdr* h4;
 	Tcp6hdr* h6;
-	Tcppriv *tpriv;
 	int mss;
 
 	tcb = (Tcpctl*)s->ptcl;
@@ -944,9 +945,6 @@
 
 	tcb->mss = tcb->cwind = mss;
 	tcb->abcbytes = 0;
-	tpriv = s->p->priv;
-	tpriv->stats[Mss] = tcb->mss;
-
 	/* default is no window scaling */
 	tcpsetscale(s, tcb, 0, 0);
 }
@@ -1304,8 +1302,6 @@
 static void
 tcpsndsyn(Conv *s, Tcpctl *tcb)
 {
-	Tcppriv *tpriv;
-
 	tcb->iss = (nrand(1<<16)<<16)|nrand(1<<16);
 	tcb->rttseq = tcb->iss;
 	tcb->snd.wl2 = tcb->iss;
@@ -1319,8 +1315,6 @@
 
 	/* set desired mss and scale */
 	tcb->mss = tcpmtu(v6lookup(s->p->f, s->raddr, s->laddr, s), s->ipversion, &tcb->scale);
-	tpriv = s->p->priv;
-	tpriv->stats[Mss] = tcb->mss;
 }
 
 static int
@@ -1754,7 +1748,6 @@
 	/* our sending max segment size cannot be bigger than what he asked for */
 	if(lp->mss != 0 && lp->mss < tcb->mss)
 		tcb->mss = lp->mss;
-	tpriv->stats[Mss] = tcb->mss;
 
 	/* window scaling */
 	tcpsetscale(new, tcb, lp->rcvscale, lp->sndscale);
@@ -2985,7 +2978,6 @@
 procsyn(Conv *s, Tcp *seg)
 {
 	Tcpctl *tcb;
-	Tcppriv *tpriv;
 
 	tcb = (Tcpctl*)s->ptcl;
 	tcb->flags |= FORCE;
@@ -2997,11 +2989,8 @@
 	tcb->irs = seg->seq;
 
 	/* our sending max segment size cannot be bigger than what he asked for */
-	if(seg->mss != 0 && seg->mss < tcb->mss) {
+	if(seg->mss != 0 && seg->mss < tcb->mss)
 		tcb->mss = seg->mss;
-		tpriv = s->p->priv;
-		tpriv->stats[Mss] = tcb->mss;
-	}
 
 	/* if the server does not support ws option, disable window scaling */
 	if(seg->ws == 0){
@@ -3393,9 +3382,9 @@
 	priv = tcp->priv;
 	p = buf;
 	e = p+len;
+	priv->stats[InLimbo] = priv->nlimbo;
 	for(i = 0; i < Nstats; i++)
 		p = seprint(p, e, "%s: %llud\n", statnames[i], priv->stats[i]);
-	p = seprint(p, e, "InLimbo: %d\n", priv->nlimbo);
 	return p - buf;
 }
 
--