From: dlg Date: Wed, 2 Jun 2021 01:36:10 +0000 (+0000) Subject: tpmr_input is called in an smr crit section, so it doesnt need its own. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2fbecff66ca3940176f501a9ed781be52fa7df8f;p=openbsd tpmr_input is called in an smr crit section, so it doesnt need its own. this simplifies the code a little bit. --- diff --git a/sys/net/if_tpmr.c b/sys/net/if_tpmr.c index ceb8b24fe09..50ac1ed91b4 100644 --- a/sys/net/if_tpmr.c +++ b/sys/net/if_tpmr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tpmr.c,v 1.28 2021/06/02 01:30:30 dlg Exp $ */ +/* $OpenBSD: if_tpmr.c,v 1.29 2021/06/02 01:36:10 dlg Exp $ */ /* * Copyright (c) 2019 The University of Queensland @@ -324,6 +324,7 @@ tpmr_input(struct ifnet *ifp0, struct mbuf *m, uint64_t dst, void *brport) struct tpmr_port *p = brport; struct tpmr_softc *sc = p->p_tpmr; struct ifnet *ifp = &sc->sc_if; + struct ifnet *ifpn; unsigned int iff; struct tpmr_port *pn; int len; @@ -374,27 +375,24 @@ tpmr_input(struct ifnet *ifp0, struct mbuf *m, uint64_t dst, void *brport) } #endif - smr_read_enter(); + SMR_ASSERT_CRITICAL(); /* ether_input calls us in a crit section */ pn = SMR_PTR_GET(&sc->sc_ports[!p->p_slot]); if (pn == NULL) - m_freem(m); - else { - struct ifnet *ifpn = pn->p_ifp0; + goto drop; + ifpn = pn->p_ifp0; #if NPF > 0 - if (!ISSET(iff, IFF_LINK1) && - (m = tpmr_pf(ifpn, PF_OUT, m)) == NULL) - ; - else + if (!ISSET(iff, IFF_LINK1) && + (m = tpmr_pf(ifpn, PF_OUT, m)) == NULL) + return (NULL); #endif - if (if_enqueue(ifpn, m)) - counters_inc(ifp->if_counters, ifc_oerrors); - else { - counters_pkt(ifp->if_counters, - ifc_opackets, ifc_obytes, len); - } + + if (if_enqueue(ifpn, m)) + counters_inc(ifp->if_counters, ifc_oerrors); + else { + counters_pkt(ifp->if_counters, + ifc_opackets, ifc_obytes, len); } - smr_read_leave(); return (NULL);