git: bbc326241d91 - main - cxgbe/t4_tom: Detach the toep from the tcpcb when entering TIME_WAIT.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 Jul 2024 16:18:19 UTC
The branch main has been updated by np:
URL: https://cgit.FreeBSD.org/src/commit/?id=bbc326241d91ab2cee2ec2c5c0aa8a906480132f
commit bbc326241d91ab2cee2ec2c5c0aa8a906480132f
Author: Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2024-07-17 05:23:33 +0000
Commit: Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2024-07-19 16:12:31 +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
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D45990
---
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 842e72bf8b2b..cb229d327386 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);