Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER().

Remove few outdated comments and extraneous assertions.  No
functional change here.
This commit is contained in:
Gleb Smirnoff 2019-11-07 00:08:34 +00:00
parent 42800fb374
commit 1a49612526
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354421
11 changed files with 42 additions and 52 deletions

View File

@ -412,12 +412,12 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
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

View File

@ -124,12 +124,12 @@ act_open_failure_cleanup(struct adapter *sc, u_int atid, u_int status)
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();
}

View File

@ -1214,7 +1214,7 @@ do_peer_close(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
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_header *rss, struct mbuf *m)
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_header *rss, struct mbuf *m)
}
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_header *rss,
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_header *rss,
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 @@ do_close_con_rpl(struct sge_iq *iq, const struct rss_header *rss,
}
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_header *rss, struct mbuf *m)
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_header *rss, struct mbuf *m)
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 *rss, struct mbuf *m)
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);

View File

@ -949,7 +949,7 @@ t4_offload_socket(struct toedev *tod, void *arg, struct socket *so)
#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 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss_header *rss,
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_header *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_header *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 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss,
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);

View File

@ -2125,12 +2125,12 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m)
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);

View File

@ -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);

View File

@ -515,7 +515,7 @@ in_pcballoc(struct socket *so, struct inpcbinfo *pcbinfo)
#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);
}

View File

@ -884,7 +884,7 @@ tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *le)
*/
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 *le)
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 */

View File

@ -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) {

View File

@ -771,7 +771,7 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
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 *to, struct tcphdr *th,
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 **lsop, struct mbuf *m,
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);

View File

@ -360,7 +360,7 @@ toe_syncache_expand(struct in_conninfo *inc, struct tcpopt *to,
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 tcphdr *th, struct ifnet *ifp)
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 *inp, int err)
(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 */