aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2025-11-07 15:27:56 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2025-11-10 19:56:59 +0000
commit7cd81bf4e74f39b784f97afe1a5c4a251f1fd39f (patch)
tree8686d1932c2cc50c5182a91c5ee6d99c4f94403b
parent21780b009b398949c7c23dc7f8371f38cd3af02c (diff)
tcp: improve comments in the syncache code
Add a comment explaining why syncache entries are dropped and fix a typo in a comment. Reviewed by: rrs, glebius Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D53564 (cherry picked from commit 17fb082104ee281365b72bd5135604cea5051df2)
-rw-r--r--sys/netinet/tcp_syncache.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 376a5d958504..41195fa02a4e 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -543,6 +543,10 @@ syncache_timer(void *xsch)
TCPSTAT_INC(tcps_sndtotal);
TCPSTAT_INC(tcps_sc_retransmitted);
} else {
+ /*
+ * Most likely we are memory constrained, so free
+ * resources.
+ */
syncache_drop(sc, sch);
TCPSTAT_INC(tcps_sc_dropped);
}
@@ -742,7 +746,7 @@ syncache_unreach(struct in_conninfo *inc, tcp_seq th_seq, uint16_t port)
goto done;
/*
- * If we've rertransmitted 3 times and this is our second error,
+ * If we've retransmitted 3 times and this is our second error,
* we remove the entry. Otherwise, we allow it to continue on.
* This prevents us from incorrectly nuking an entry during a
* spurious network outage.
@@ -1569,6 +1573,10 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
TCPSTAT_INC(tcps_sndacks);
TCPSTAT_INC(tcps_sndtotal);
} else {
+ /*
+ * Most likely we are memory constrained, so free
+ * resources.
+ */
syncache_drop(sc, sch);
TCPSTAT_INC(tcps_sc_dropped);
}
@@ -1754,6 +1762,9 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th,
TCPSTAT_INC(tcps_sndacks);
TCPSTAT_INC(tcps_sndtotal);
} else {
+ /*
+ * Most likely we are memory constrained, so free resources.
+ */
if (sc != &scs)
syncache_free(sc);
TCPSTAT_INC(tcps_sc_dropped);