svn commit: r354421 - in head/sys: dev/cxgbe/cxgbei dev/cxgbe/tom kern netinet

Gleb Smirnoff glebius at FreeBSD.org
Thu Nov 7 00:08:37 UTC 2019


Author: glebius
Date: Thu Nov  7 00:08:34 2019
New Revision: 354421
URL: https://svnweb.freebsd.org/changeset/base/354421

Log:
  Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER().
  Remove few outdated comments and extraneous assertions.  No
  functional change here.

Modified:
  head/sys/dev/cxgbe/cxgbei/cxgbei.c
  head/sys/dev/cxgbe/tom/t4_connect.c
  head/sys/dev/cxgbe/tom/t4_cpl_io.c
  head/sys/dev/cxgbe/tom/t4_listen.c
  head/sys/dev/cxgbe/tom/t4_tls.c
  head/sys/kern/uipc_ktls.c
  head/sys/netinet/in_pcb.c
  head/sys/netinet/tcp_lro.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/toecore.c

Modified: head/sys/dev/cxgbe/cxgbei/cxgbei.c
==============================================================================
--- head/sys/dev/cxgbe/cxgbei/cxgbei.c	Thu Nov  7 00:07:54 2019	(r354420)
+++ head/sys/dev/cxgbe/cxgbei/cxgbei.c	Thu Nov  7 00:08:34 2019	(r354421)
@@ -412,12 +412,12 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_he
 		SOCKBUF_UNLOCK(sb);
 		INP_WUNLOCK(inp);
 
-		INP_INFO_RLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_ENTER(et);
 		INP_WLOCK(inp);
 		tp = tcp_drop(tp, ECONNRESET);
 		if (tp)
 			INP_WUNLOCK(inp);
-		INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_EXIT(et);
 
 		icl_cxgbei_conn_pdu_free(NULL, ip);
 #ifdef INVARIANTS

Modified: head/sys/dev/cxgbe/tom/t4_connect.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_connect.c	Thu Nov  7 00:07:54 2019	(r354420)
+++ head/sys/dev/cxgbe/tom/t4_connect.c	Thu Nov  7 00:08:34 2019	(r354421)
@@ -124,12 +124,12 @@ act_open_failure_cleanup(struct adapter *sc, u_int ati
 
 	CURVNET_SET(toep->vnet);
 	if (status != EAGAIN)
-		INP_INFO_RLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_ENTER(et);
 	INP_WLOCK(inp);
 	toe_connect_failed(tod, inp, status);
 	final_cpl_received(toep);	/* unlocks inp */
 	if (status != EAGAIN)
-		INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_EXIT(et);
 	CURVNET_RESTORE();
 }
 

Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_cpl_io.c	Thu Nov  7 00:07:54 2019	(r354420)
+++ head/sys/dev/cxgbe/tom/t4_cpl_io.c	Thu Nov  7 00:08:34 2019	(r354421)
@@ -1214,7 +1214,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head
 	KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__));
 
 	CURVNET_SET(toep->vnet);
-	INP_INFO_RLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_ENTER(et);
 	INP_WLOCK(inp);
 	tp = intotcpcb(inp);
 
@@ -1260,7 +1260,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head
 	case TCPS_FIN_WAIT_2:
 		tcp_twstart(tp);
 		INP_UNLOCK_ASSERT(inp);	 /* safe, we have a ref on the inp */
-		INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_EXIT(et);
 		CURVNET_RESTORE();
 
 		INP_WLOCK(inp);
@@ -1273,7 +1273,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_head
 	}
 done:
 	INP_WUNLOCK(inp);
-	INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_EXIT(et);
 	CURVNET_RESTORE();
 	return (0);
 }
@@ -1303,7 +1303,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_h
 	KASSERT(toep->tid == tid, ("%s: toep tid mismatch", __func__));
 
 	CURVNET_SET(toep->vnet);
-	INP_INFO_RLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_ENTER(et);
 	INP_WLOCK(inp);
 	tp = intotcpcb(inp);
 
@@ -1321,7 +1321,7 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_h
 		tcp_twstart(tp);
 release:
 		INP_UNLOCK_ASSERT(inp);	/* safe, we have a ref on the  inp */
-		INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_EXIT(et);
 		CURVNET_RESTORE();
 
 		INP_WLOCK(inp);
@@ -1346,7 +1346,7 @@ release:
 	}
 done:
 	INP_WUNLOCK(inp);
-	INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_EXIT(et);
 	CURVNET_RESTORE();
 	return (0);
 }
@@ -1423,7 +1423,7 @@ do_abort_req(struct sge_iq *iq, const struct rss_heade
 
 	inp = toep->inp;
 	CURVNET_SET(toep->vnet);
-	INP_INFO_RLOCK_ET(&V_tcbinfo, et);	/* for tcp_close */
+	NET_EPOCH_ENTER(et);	/* for tcp_close */
 	INP_WLOCK(inp);
 
 	tp = intotcpcb(inp);
@@ -1457,7 +1457,7 @@ do_abort_req(struct sge_iq *iq, const struct rss_heade
 
 	final_cpl_received(toep);
 done:
-	INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_EXIT(et);
 	CURVNET_RESTORE();
 	send_abort_rpl(sc, ofld_txq, tid, CPL_ABORT_NO_RST);
 	return (0);
@@ -1572,12 +1572,12 @@ do_rx_data(struct sge_iq *iq, const struct rss_header 
 		INP_WUNLOCK(inp);
 
 		CURVNET_SET(toep->vnet);
-		INP_INFO_RLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_ENTER(et);
 		INP_WLOCK(inp);
 		tp = tcp_drop(tp, ECONNRESET);
 		if (tp)
 			INP_WUNLOCK(inp);
-		INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_EXIT(et);
 		CURVNET_RESTORE();
 
 		return (0);

Modified: head/sys/dev/cxgbe/tom/t4_listen.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_listen.c	Thu Nov  7 00:07:54 2019	(r354420)
+++ head/sys/dev/cxgbe/tom/t4_listen.c	Thu Nov  7 00:08:34 2019	(r354421)
@@ -949,7 +949,7 @@ t4_offload_socket(struct toedev *tod, void *arg, struc
 #endif
 	struct toepcb *toep = synqe->toep;
 
-	INP_INFO_RLOCK_ASSERT(&V_tcbinfo); /* prevents bad race with accept() */
+	NET_EPOCH_ASSERT();	/* prevents bad race with accept() */
 	INP_WLOCK_ASSERT(inp);
 	KASSERT(synqe->flags & TPF_SYNQE,
 	    ("%s: %p not a synq_entry?", __func__, arg));
@@ -1242,12 +1242,12 @@ found:
 		REJECT_PASS_ACCEPT_REQ(true);
 
 	/* Don't offload if the 4-tuple is already in use */
-	INP_INFO_RLOCK_ET(&V_tcbinfo, et);	/* for 4-tuple check */
+	NET_EPOCH_ENTER(et);	/* for 4-tuple check */
 	if (toe_4tuple_check(&inc, &th, ifp) != 0) {
-		INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_EXIT(et);
 		REJECT_PASS_ACCEPT_REQ(false);
 	}
-	INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_EXIT(et);
 
 	inp = lctx->inp;		/* listening socket, not owned by TOE */
 	INP_WLOCK(inp);
@@ -1396,7 +1396,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_
 	    ("%s: tid %u (ctx %p) not a synqe", __func__, tid, synqe));
 
 	CURVNET_SET(lctx->vnet);
-	INP_INFO_RLOCK_ET(&V_tcbinfo, et);	/* for syncache_expand */
+	NET_EPOCH_ENTER(et);	/* for syncache_expand */
 	INP_WLOCK(inp);
 
 	CTR6(KTR_CXGBE,
@@ -1412,7 +1412,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_
 reset:
 		send_reset_synqe(TOEDEV(ifp), synqe);
 		INP_WUNLOCK(inp);
-		INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_EXIT(et);
 		CURVNET_RESTORE();
 		return (0);
 	}
@@ -1471,7 +1471,7 @@ reset:
 	inp = release_synqe(sc, synqe);
 	if (inp != NULL)
 		INP_WUNLOCK(inp);
-	INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_EXIT(et);
 	CURVNET_RESTORE();
 
 	return (0);

Modified: head/sys/dev/cxgbe/tom/t4_tls.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tls.c	Thu Nov  7 00:07:54 2019	(r354420)
+++ head/sys/dev/cxgbe/tom/t4_tls.c	Thu Nov  7 00:08:34 2019	(r354421)
@@ -2125,12 +2125,12 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_head
 		INP_WUNLOCK(inp);
 
 		CURVNET_SET(toep->vnet);
-		INP_INFO_RLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_ENTER(et);
 		INP_WLOCK(inp);
 		tp = tcp_drop(tp, ECONNRESET);
 		if (tp)
 			INP_WUNLOCK(inp);
-		INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_EXIT(et);
 		CURVNET_RESTORE();
 
 		return (0);

Modified: head/sys/kern/uipc_ktls.c
==============================================================================
--- head/sys/kern/uipc_ktls.c	Thu Nov  7 00:07:54 2019	(r354420)
+++ head/sys/kern/uipc_ktls.c	Thu Nov  7 00:08:34 2019	(r354421)
@@ -1137,7 +1137,7 @@ ktls_reset_send_tag(void *context, int pending)
 		 * the send tag is fixed or just rely on timers?
 		 */
 	} else {
-		INP_INFO_RLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_ENTER(et);
 		INP_WLOCK(inp);
 		if (!in_pcbrele_wlocked(inp)) {
 			if (!(inp->inp_flags & INP_TIMEWAIT) &&
@@ -1150,7 +1150,7 @@ ktls_reset_send_tag(void *context, int pending)
 			} else
 				INP_WUNLOCK(inp);
 		}
-		INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+		NET_EPOCH_EXIT(et);
 
 		counter_u64_add(ktls_ifnet_reset_failed, 1);
 

Modified: head/sys/netinet/in_pcb.c
==============================================================================
--- head/sys/netinet/in_pcb.c	Thu Nov  7 00:07:54 2019	(r354420)
+++ head/sys/netinet/in_pcb.c	Thu Nov  7 00:08:34 2019	(r354421)
@@ -515,7 +515,7 @@ in_pcballoc(struct socket *so, struct inpcbinfo *pcbin
 
 #ifdef INVARIANTS
 	if (pcbinfo == &V_tcbinfo) {
-		INP_INFO_RLOCK_ASSERT(pcbinfo);
+		NET_EPOCH_ASSERT();
 	} else {
 		INP_INFO_WLOCK_ASSERT(pcbinfo);
 	}
@@ -2657,7 +2657,7 @@ in_pcbremlists(struct inpcb *inp)
 
 #ifdef INVARIANTS
 	if (pcbinfo == &V_tcbinfo) {
-		INP_INFO_RLOCK_ASSERT(pcbinfo);
+		NET_EPOCH_ASSERT();
 	} else {
 		INP_INFO_WLOCK_ASSERT(pcbinfo);
 	}

Modified: head/sys/netinet/tcp_lro.c
==============================================================================
--- head/sys/netinet/tcp_lro.c	Thu Nov  7 00:07:54 2019	(r354420)
+++ head/sys/netinet/tcp_lro.c	Thu Nov  7 00:08:34 2019	(r354421)
@@ -884,7 +884,7 @@ tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *l
 	 */
 	if ((tcplro_stacks_wanting_mbufq == 0) || (le->m_head->m_flags & M_VLANTAG))
 		goto skip_lookup;
-	INP_INFO_RLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_ENTER(et);
 	switch (le->eh_type) {
 #ifdef INET6
 	case ETHERTYPE_IPV6:
@@ -903,7 +903,7 @@ tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *l
 		break;
 #endif
 	}
-	INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_EXIT(et);
 	if (inp && ((inp->inp_flags & (INP_DROPPED|INP_TIMEWAIT)) ||
 		    (inp->inp_flags2 & INP_FREED))) {
 		/* We don't want this guy */

Modified: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c	Thu Nov  7 00:07:54 2019	(r354420)
+++ head/sys/netinet/tcp_subr.c	Thu Nov  7 00:08:34 2019	(r354421)
@@ -1941,7 +1941,7 @@ tcp_timer_discard(void *ptp)
 	
 	tp = (struct tcpcb *)ptp;
 	CURVNET_SET(tp->t_vnet);
-	INP_INFO_RLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_ENTER(et);
 	inp = tp->t_inpcb;
 	KASSERT(inp != NULL, ("%s: tp %p tp->t_inpcb == NULL",
 		__func__, tp));
@@ -1961,13 +1961,13 @@ tcp_timer_discard(void *ptp)
 		tp->t_inpcb = NULL;
 		uma_zfree(V_tcpcb_zone, tp);
 		if (in_pcbrele_wlocked(inp)) {
-			INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+			NET_EPOCH_EXIT(et);
 			CURVNET_RESTORE();
 			return;
 		}
 	}
 	INP_WUNLOCK(inp);
-	INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_EXIT(et);
 	CURVNET_RESTORE();
 }
 
@@ -2770,7 +2770,7 @@ tcp_drop_syn_sent(struct inpcb *inp, int errno)
 {
 	struct tcpcb *tp;
 
-	INP_INFO_RLOCK_ASSERT(&V_tcbinfo);
+	NET_EPOCH_ASSERT();
 	INP_WLOCK_ASSERT(inp);
 
 	if ((inp->inp_flags & INP_TIMEWAIT) ||
@@ -3042,7 +3042,7 @@ sysctl_drop(SYSCTL_HANDLER_ARGS)
 	default:
 		return (EINVAL);
 	}
-	INP_INFO_RLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_ENTER(et);
 	switch (addrs[0].ss_family) {
 #ifdef INET6
 	case AF_INET6:
@@ -3081,7 +3081,7 @@ sysctl_drop(SYSCTL_HANDLER_ARGS)
 			INP_WUNLOCK(inp);
 	} else
 		error = ESRCH;
-	INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_EXIT(et);
 	return (error);
 }
 
@@ -3157,7 +3157,7 @@ sysctl_switch_tls(SYSCTL_HANDLER_ARGS)
 	default:
 		return (EINVAL);
 	}
-	INP_INFO_RLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_ENTER(et);
 	switch (addrs[0].ss_family) {
 #ifdef INET6
 	case AF_INET6:
@@ -3173,7 +3173,7 @@ sysctl_switch_tls(SYSCTL_HANDLER_ARGS)
 		break;
 #endif
 	}
-	INP_INFO_RUNLOCK_ET(&V_tcbinfo, et);
+	NET_EPOCH_EXIT(et);
 	if (inp != NULL) {
 		if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) != 0 ||
 		    inp->inp_socket == NULL) {

Modified: head/sys/netinet/tcp_syncache.c
==============================================================================
--- head/sys/netinet/tcp_syncache.c	Thu Nov  7 00:07:54 2019	(r354420)
+++ head/sys/netinet/tcp_syncache.c	Thu Nov  7 00:08:34 2019	(r354421)
@@ -771,7 +771,7 @@ syncache_socket(struct syncache *sc, struct socket *ls
 	int error;
 	char *s;
 
-	INP_INFO_RLOCK_ASSERT(&V_tcbinfo);
+	NET_EPOCH_ASSERT();
 
 	/*
 	 * Ok, create the full blown connection, and set things up
@@ -1091,11 +1091,7 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt
 	char *s;
 	bool locked;
 
-	/*
-	 * Global TCP locks are held because we manipulate the PCB lists
-	 * and create a new socket.
-	 */
-	INP_INFO_RLOCK_ASSERT(&V_tcbinfo);
+	NET_EPOCH_ASSERT();
 	KASSERT((th->th_flags & (TH_RST|TH_ACK|TH_SYN)) == TH_ACK,
 	    ("%s: can handle only ACK", __func__));
 
@@ -1331,11 +1327,7 @@ syncache_tfo_expand(struct syncache *sc, struct socket
 	struct tcpcb *tp;
 	unsigned int *pending_counter;
 
-	/*
-	 * Global TCP locks are held because we manipulate the PCB lists
-	 * and create a new socket.
-	 */
-	INP_INFO_RLOCK_ASSERT(&V_tcbinfo);
+	NET_EPOCH_ASSERT();
 
 	pending_counter = intotcpcb(sotoinpcb(*lsop))->t_tfo_pending;
 	*lsop = syncache_socket(sc, *lsop, m);

Modified: head/sys/netinet/toecore.c
==============================================================================
--- head/sys/netinet/toecore.c	Thu Nov  7 00:07:54 2019	(r354420)
+++ head/sys/netinet/toecore.c	Thu Nov  7 00:08:34 2019	(r354421)
@@ -360,7 +360,7 @@ toe_syncache_expand(struct in_conninfo *inc, struct tc
     struct tcphdr *th, struct socket **lsop)
 {
 
-	INP_INFO_RLOCK_ASSERT(&V_tcbinfo);
+	NET_EPOCH_ASSERT();
 
 	return (syncache_expand(inc, to, th, lsop, NULL));
 }
@@ -390,8 +390,6 @@ toe_4tuple_check(struct in_conninfo *inc, struct tcphd
 		INP_WLOCK_ASSERT(inp);
 
 		if ((inp->inp_flags & INP_TIMEWAIT) && th != NULL) {
-
-			INP_INFO_RLOCK_ASSERT(&V_tcbinfo); /* for twcheck */
 			if (!tcp_twcheck(inp, NULL, th, NULL, 0))
 				return (EADDRINUSE);
 		} else {
@@ -529,7 +527,7 @@ toe_connect_failed(struct toedev *tod, struct inpcb *i
 			(void) tp->t_fb->tfb_tcp_output(tp);
 		} else {
 
-			INP_INFO_RLOCK_ASSERT(&V_tcbinfo);
+			NET_EPOCH_ASSERT();
 			tp = tcp_drop(tp, err);
 			if (tp == NULL)
 				INP_WLOCK(inp);	/* re-acquire */


More information about the svn-src-all mailing list