[Midnightbsd-cvs] src [8391] trunk/sys/dev/cxgbe/tom: Remove the tid from the software table (and bump down the in-use

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Sep 18 15:21:59 EDT 2016


Revision: 8391
          http://svnweb.midnightbsd.org/src/?rev=8391
Author:   laffer1
Date:     2016-09-18 15:21:59 -0400 (Sun, 18 Sep 2016)
Log Message:
-----------
Remove the tid from the software table (and bump down the in-use
counter) when the syncache doesn't want the driver to reply to an
incoming SYN.  This fixes a harmless bug where tids_in_use would
go out of sync with the hardware counter.

Make sure the inp hasn't been dropped before trying to access its socket
and tcpcb.

Modified Paths:
--------------
    trunk/sys/dev/cxgbe/tom/t4_cpl_io.c
    trunk/sys/dev/cxgbe/tom/t4_listen.c

Modified: trunk/sys/dev/cxgbe/tom/t4_cpl_io.c
===================================================================
--- trunk/sys/dev/cxgbe/tom/t4_cpl_io.c	2016-09-18 19:21:29 UTC (rev 8390)
+++ trunk/sys/dev/cxgbe/tom/t4_cpl_io.c	2016-09-18 19:21:59 UTC (rev 8391)
@@ -982,7 +982,6 @@
 	struct sge_wrq *ofld_txq = toep->ofld_txq;
 	struct inpcb *inp;
 	struct tcpcb *tp;
-	struct socket *so;
 #ifdef INVARIANTS
 	unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl)));
 #endif
@@ -1008,7 +1007,6 @@
 	INP_WLOCK(inp);
 
 	tp = intotcpcb(inp);
-	so = inp->inp_socket;
 
 	CTR6(KTR_CXGBE,
 	    "%s: tid %d (%s), toep_flags 0x%x, inp_flags 0x%x, status %d",
@@ -1026,11 +1024,17 @@
 	}
 	toep->flags |= TPF_ABORT_SHUTDOWN;
 
-	so_error_set(so, abort_status_to_errno(tp, cpl->status));
-	tp = tcp_close(tp);
-	if (tp == NULL)
-		INP_WLOCK(inp);	/* re-acquire */
+	if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) == 0) {
+		struct socket *so = inp->inp_socket;
 
+		if (so != NULL)
+			so_error_set(so, abort_status_to_errno(tp,
+			    cpl->status));
+		tp = tcp_close(tp);
+		if (tp == NULL)
+			INP_WLOCK(inp);	/* re-acquire */
+	}
+
 	final_cpl_received(toep);
 done:
 	INP_INFO_WUNLOCK(&V_tcbinfo);

Modified: trunk/sys/dev/cxgbe/tom/t4_listen.c
===================================================================
--- trunk/sys/dev/cxgbe/tom/t4_listen.c	2016-09-18 19:21:29 UTC (rev 8390)
+++ trunk/sys/dev/cxgbe/tom/t4_listen.c	2016-09-18 19:21:59 UTC (rev 8391)
@@ -1202,6 +1202,7 @@
 		if (m)
 			m->m_pkthdr.rcvif = ifp;
 
+		remove_tid(sc, synqe->tid);
 		release_synqe(synqe);	/* about to exit function */
 		free(wr, M_CXGBE);
 		REJECT_PASS_ACCEPT();



More information about the Midnightbsd-cvs mailing list