aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPouria Mousavizadeh Tehrani <pouria@FreeBSD.org>2026-03-24 17:54:46 +0000
committerPouria Mousavizadeh Tehrani <pouria@FreeBSD.org>2026-03-24 22:02:45 +0000
commit769a6f803d1b531d956af8d857e68f2d2d847324 (patch)
tree2d3a0e53aa9b5ea4ea1da2700ce1eec0697aa551
parentcd05c88058b5b3684f0d7f3086afa21a944d9cd1 (diff)
tcp_usrreq: Only allocate TFO counter when required
During tcp_usr_listen(), only allocate TFO counter when required. Reviewed by: tuexen, glebius Differential Revision: https://reviews.freebsd.org/D56067
-rw-r--r--sys/netinet/tcp_usrreq.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index aadcf0c9ce9c..b0a75127b124 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -396,10 +396,11 @@ tcp_usr_listen(struct socket *so, int backlog, struct thread *td)
if (already_listening)
goto out;
- if (error == 0)
+ if (error == 0) {
in_pcblisten(inp);
- if (tp->t_flags & TF_FASTOPEN)
- tp->t_tfo_pending = tcp_fastopen_alloc_counter();
+ if (tp->t_flags & TF_FASTOPEN)
+ tp->t_tfo_pending = tcp_fastopen_alloc_counter();
+ }
out:
tcp_bblog_pru(tp, PRU_LISTEN, error);
@@ -460,12 +461,11 @@ tcp6_usr_listen(struct socket *so, int backlog, struct thread *td)
if (already_listening)
goto out;
- if (error == 0)
+ if (error == 0) {
in_pcblisten(inp);
- if (tp->t_flags & TF_FASTOPEN)
- tp->t_tfo_pending = tcp_fastopen_alloc_counter();
-
- if (error != 0)
+ if (tp->t_flags & TF_FASTOPEN)
+ tp->t_tfo_pending = tcp_fastopen_alloc_counter();
+ } else
inp->inp_vflag = vflagsav;
out: