Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2024 18:39:04 GMT
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c18966b3dce0 - stable/14 - cxgbe/t4_tom: Detach the toep from the tcpcb when entering TIME_WAIT.
Message-ID:  <202410211839.49LId4KG035829@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=c18966b3dce0e5110c79b23d290d453c22b49252

commit c18966b3dce0e5110c79b23d290d453c22b49252
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2024-07-17 05:23:33 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2024-10-21 16:46:29 +0000

    cxgbe/t4_tom: Detach the toep from the tcpcb when entering TIME_WAIT.
    
    The kernel used to call tod_pcb_detach when entering TIME_WAIT but that
    seems to have changed, likely with the TIME_WAIT overhaul in the kernel
    some time ago.  Catch up by having the driver perform the detach.
    
    The hardware does not handle TIME_WAIT so it's important to detach and
    let the kernel arm the 2MSL timer to deal with it.
    
    Reported by:    Sony Arpita Das @ Chelsio
    Reviewed by:    jhb
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D45990
    
    (cherry picked from commit bbc326241d91ab2cee2ec2c5c0aa8a906480132f)
---
 sys/dev/cxgbe/tom/t4_cpl_io.c | 2 ++
 sys/dev/cxgbe/tom/t4_tom.c    | 2 +-
 sys/dev/cxgbe/tom/t4_tom.h    | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c
index 0d42c89dcf93..0a40bbda3f3f 100644
--- a/sys/dev/cxgbe/tom/t4_cpl_io.c
+++ b/sys/dev/cxgbe/tom/t4_cpl_io.c
@@ -1393,6 +1393,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
 
 	case TCPS_FIN_WAIT_2:
 		restore_so_proto(so, inp->inp_vflag & INP_IPV6);
+		t4_pcb_detach(NULL, tp);
 		tcp_twstart(tp);
 		INP_UNLOCK_ASSERT(inp);	 /* safe, we have a ref on the inp */
 		NET_EPOCH_EXIT(et);
@@ -1454,6 +1455,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_header *rss,
 	switch (tp->t_state) {
 	case TCPS_CLOSING:	/* see TCPS_FIN_WAIT_2 in do_peer_close too */
 		restore_so_proto(so, inp->inp_vflag & INP_IPV6);
+		t4_pcb_detach(NULL, tp);
 		tcp_twstart(tp);
 release:
 		INP_UNLOCK_ASSERT(inp);	/* safe, we have a ref on the  inp */
diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c
index 3fe34c7c01a3..10ee78681365 100644
--- a/sys/dev/cxgbe/tom/t4_tom.c
+++ b/sys/dev/cxgbe/tom/t4_tom.c
@@ -359,7 +359,7 @@ release_offload_resources(struct toepcb *toep)
  * Also gets called when an offloaded active open fails and the TOM wants the
  * kernel to take the TCP PCB back.
  */
-static void
+void
 t4_pcb_detach(struct toedev *tod __unused, struct tcpcb *tp)
 {
 #if defined(KTR) || defined(INVARIANTS)
diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h
index 805d8bc0d644..fb74642d61f7 100644
--- a/sys/dev/cxgbe/tom/t4_tom.h
+++ b/sys/dev/cxgbe/tom/t4_tom.h
@@ -468,6 +468,7 @@ __be32 calc_options2(struct vi_info *, struct conn_params *);
 uint64_t select_ntuple(struct vi_info *, struct l2t_entry *);
 int negative_advice(int);
 int add_tid_to_history(struct adapter *, u_int);
+void t4_pcb_detach(struct toedev *, struct tcpcb *);
 
 /* t4_connect.c */
 void t4_init_connect_cpl_handlers(void);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410211839.49LId4KG035829>