diff options
42 files changed, 123 insertions, 2 deletions
diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c index 15cd3e0..ec96d95 100644 --- a/sys/dev/an/if_an.c +++ b/sys/dev/an/if_an.c @@ -833,6 +833,8 @@ an_rxeof(sc) struct an_card_rx_desc an_rx_desc; u_int8_t *buf; + AN_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; if (!sc->mpi350) { @@ -981,7 +983,9 @@ an_rxeof(sc) rx_frame.an_rx_signal_strength, rx_frame.an_rsvd0); #endif + AN_UNLOCK(sc); (*ifp->if_input)(ifp, m); + AN_LOCK(sc); } } else { /* MPI-350 */ diff --git a/sys/dev/an/if_anreg.h b/sys/dev/an/if_anreg.h index 86b5efa..6ed2bf9 100644 --- a/sys/dev/an/if_anreg.h +++ b/sys/dev/an/if_anreg.h @@ -502,6 +502,7 @@ struct an_softc { #define AN_LOCK(_sc) mtx_lock(&(_sc)->an_mtx) #define AN_UNLOCK(_sc) mtx_unlock(&(_sc)->an_mtx) +#define AN_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->an_mtx, MA_OWNED) void an_release_resources (device_t); int an_alloc_port (device_t, int, int); diff --git a/sys/dev/bfe/if_bfe.c b/sys/dev/bfe/if_bfe.c index 3d5a7e7..d91d416 100644 --- a/sys/dev/bfe/if_bfe.c +++ b/sys/dev/bfe/if_bfe.c @@ -1153,7 +1153,9 @@ bfe_rxeof(struct bfe_softc *sc) ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; + BFE_UNLOCK(sc); (*ifp->if_input)(ifp, m); + BFE_LOCK(sc); BFE_INC(cons, BFE_RX_LIST_CNT); } diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index dc1c1b3..45ec33f 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -2723,6 +2723,8 @@ dc_rxeof(struct dc_softc *sc) int i, total_len = 0; u_int32_t rxstat; + DC_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; i = sc->dc_cdata.dc_rx_prod; @@ -2816,7 +2818,9 @@ dc_rxeof(struct dc_softc *sc) } ifp->if_ipackets++; + DC_UNLOCK(sc); (*ifp->if_input)(ifp, m); + DC_LOCK(sc); } sc->dc_cdata.dc_rx_prod = i; @@ -3069,6 +3073,7 @@ dc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) CSR_WRITE_4(sc, DC_IMR, DC_INTRS); return; } + DC_LOCK(sc); sc->rxcycles = count; dc_rxeof(sc); dc_txeof(sc); @@ -3082,8 +3087,10 @@ dc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) status &= (DC_ISR_RX_WATDOGTIMEO | DC_ISR_RX_NOBUF | DC_ISR_TX_NOBUF | DC_ISR_TX_IDLE | DC_ISR_TX_UNDERRUN | DC_ISR_BUS_ERR); - if (!status) + if (!status) { + DC_UNLOCK(sc); return; + } /* ack what we have */ CSR_WRITE_4(sc, DC_ISR, status); @@ -3107,6 +3114,7 @@ dc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) dc_init(sc); } } + DC_UNLOCK(sc); } #endif /* DEVICE_POLLING */ diff --git a/sys/dev/dc/if_dcreg.h b/sys/dev/dc/if_dcreg.h index 14912b5..fc77dd8 100644 --- a/sys/dev/dc/if_dcreg.h +++ b/sys/dev/dc/if_dcreg.h @@ -766,6 +766,7 @@ struct dc_softc { #define DC_LOCK(_sc) mtx_lock(&(_sc)->dc_mtx) #define DC_UNLOCK(_sc) mtx_unlock(&(_sc)->dc_mtx) +#define DC_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->dc_mtx, MA_OWNED) #define DC_TX_POLL 0x00000001 #define DC_TX_COALESCE 0x00000002 diff --git a/sys/dev/my/if_my.c b/sys/dev/my/if_my.c index b1dffa8..82b45af 100644 --- a/sys/dev/my/if_my.c +++ b/sys/dev/my/if_my.c @@ -1277,7 +1277,9 @@ my_rxeof(struct my_softc * sc) } } #endif + MY_UNLOCK(sc); (*ifp->if_input)(ifp, m); + MY_LOCK(sc); } MY_UNLOCK(sc); return; diff --git a/sys/dev/owi/if_owi.c b/sys/dev/owi/if_owi.c index 70f1941..6f3488b 100644 --- a/sys/dev/owi/if_owi.c +++ b/sys/dev/owi/if_owi.c @@ -449,6 +449,8 @@ wi_rxeof(sc) struct mbuf *m; int id; + WI_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; id = CSR_READ_2(sc, WI_RX_FID); @@ -650,7 +652,9 @@ wi_rxeof(sc) #ifdef WICACHE wi_cache_store(sc, eh, m, rx_frame.wi_q_info); #endif + WI_UNLOCK(sc); (*ifp->if_input)(ifp, m); + WI_LOCK(sc); } } diff --git a/sys/dev/owi/if_wivar.h b/sys/dev/owi/if_wivar.h index 723f2ca..98f1970 100644 --- a/sys/dev/owi/if_wivar.h +++ b/sys/dev/owi/if_wivar.h @@ -171,9 +171,11 @@ struct wi_card_ident { #define ifaddr_byindex(idx) ifnet_addrs[(idx) - 1]; #define WI_LOCK(_sc, _s) s = splimp() #define WI_UNLOCK(_sc, _s) splx(s) +#define WI_LOCK_ASSERT(_sc) #else #define WI_LOCK(_sc, _s) _s = 1 #define WI_UNLOCK(_sc, _s) +#define WI_LOCK_ASSERT(_sc) #endif int owi_generic_attach(device_t); diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index c72d43b..13b1216 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -1517,6 +1517,8 @@ re_rxeof(sc) struct rl_desc *cur_rx; u_int32_t rxstat, rxvlan; + RL_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; i = sc->rl_ldata.rl_rx_prodidx; @@ -1659,7 +1661,9 @@ re_rxeof(sc) if (rxvlan & RL_RDESC_VLANCTL_TAG) VLAN_INPUT_TAG(ifp, m, ntohs((rxvlan & RL_RDESC_VLANCTL_DATA)), continue); + RL_UNLOCK(sc); (*ifp->if_input)(ifp, m); + RL_LOCK(sc); } /* Flush the RX DMA ring */ diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c index e1def22..254277a 100644 --- a/sys/dev/sf/if_sf.c +++ b/sys/dev/sf/if_sf.c @@ -955,6 +955,8 @@ sf_rxeof(sc) u_int32_t rxcons, rxprod; int cmpprodidx, cmpconsidx, bufprodidx; + SF_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; rxcons = csr_read_4(sc, SF_CQ_CONSIDX); @@ -988,7 +990,9 @@ sf_rxeof(sc) m = m0; ifp->if_ipackets++; + SF_UNLOCK(sc); (*ifp->if_input)(ifp, m); + SF_LOCK(sc); } csr_write_4(sc, SF_CQ_CONSIDX, diff --git a/sys/dev/sf/if_sfreg.h b/sys/dev/sf/if_sfreg.h index 1975cfc..630f0b2 100644 --- a/sys/dev/sf/if_sfreg.h +++ b/sys/dev/sf/if_sfreg.h @@ -1051,6 +1051,7 @@ struct sf_softc { #define SF_LOCK(_sc) mtx_lock(&(_sc)->sf_mtx) #define SF_UNLOCK(_sc) mtx_unlock(&(_sc)->sf_mtx) +#define SF_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sf_mtx, MA_OWNED) #define SF_TIMEOUT 1000 diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index 1ef4493..3226d91 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -1839,6 +1839,7 @@ static void sk_rxeof(sc_if) struct sk_if_softc *sc_if; { + struct sk_softc *sc; struct mbuf *m; struct ifnet *ifp; struct sk_chain *cur_rx; @@ -1846,10 +1847,13 @@ sk_rxeof(sc_if) int i; u_int32_t rxstat; + sc = sc_if->sk_softc; ifp = &sc_if->arpcom.ac_if; i = sc_if->sk_cdata.sk_rx_prod; cur_rx = &sc_if->sk_cdata.sk_rx_chain[i]; + SK_LOCK_ASSERT(sc); + while(!(sc_if->sk_rdata->sk_rx_ring[i].sk_ctl & SK_RXCTL_OWN)) { cur_rx = &sc_if->sk_cdata.sk_rx_chain[i]; @@ -1891,7 +1895,9 @@ sk_rxeof(sc_if) } ifp->if_ipackets++; + SK_UNLOCK(sc); (*ifp->if_input)(ifp, m); + SK_LOCK(sc); } sc_if->sk_cdata.sk_rx_prod = i; diff --git a/sys/dev/sk/if_skreg.h b/sys/dev/sk/if_skreg.h index 7309841..8e2eb53 100644 --- a/sys/dev/sk/if_skreg.h +++ b/sys/dev/sk/if_skreg.h @@ -1423,6 +1423,7 @@ struct sk_softc { #define SK_LOCK(_sc) mtx_lock(&(_sc)->sk_mtx) #define SK_UNLOCK(_sc) mtx_unlock(&(_sc)->sk_mtx) +#define SK_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sk_mtx, MA_OWNED) #define SK_IF_LOCK(_sc) mtx_lock(&(_sc)->sk_softc->sk_mtx) #define SK_IF_UNLOCK(_sc) mtx_unlock(&(_sc)->sk_softc->sk_mtx) diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 4cbea9b..c5f3fc0 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -2384,6 +2384,8 @@ ti_rxeof(sc) struct ifnet *ifp; struct ti_cmd_desc cmd; + TI_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; while(sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { @@ -2479,7 +2481,9 @@ ti_rxeof(sc) */ if (have_tag) VLAN_INPUT_TAG(ifp, m, vlan_tag, continue); + TI_UNLOCK(sc); (*ifp->if_input)(ifp, m); + TI_LOCK(sc); } /* Only necessary on the Tigon 1. */ diff --git a/sys/dev/ti/if_tireg.h b/sys/dev/ti/if_tireg.h index b15b28b..71d9661 100644 --- a/sys/dev/ti/if_tireg.h +++ b/sys/dev/ti/if_tireg.h @@ -1030,6 +1030,7 @@ struct ti_softc { #define TI_LOCK(_sc) mtx_lock(&(_sc)->ti_mtx) #define TI_UNLOCK(_sc) mtx_unlock(&(_sc)->ti_mtx) +#define TI_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->ti_mtx, MA_OWNED) /* * Microchip Technology 24Cxx EEPROM control bytes diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c index 712bbea..1d35c3f 100644 --- a/sys/dev/vr/if_vr.c +++ b/sys/dev/vr/if_vr.c @@ -1061,6 +1061,8 @@ vr_rxeof(sc) int total_len = 0; u_int32_t rxstat; + VR_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; while(!((rxstat = sc->vr_cdata.vr_rx_head->vr_ptr->vr_status) & @@ -1122,7 +1124,9 @@ vr_rxeof(sc) m = m0; ifp->if_ipackets++; + VR_UNLOCK(sc); (*ifp->if_input)(ifp, m); + VR_LOCK(sc); } return; diff --git a/sys/dev/vr/if_vrreg.h b/sys/dev/vr/if_vrreg.h index 043c3ed..2f8e810 100644 --- a/sys/dev/vr/if_vrreg.h +++ b/sys/dev/vr/if_vrreg.h @@ -475,6 +475,7 @@ struct vr_softc { #define VR_LOCK(_sc) mtx_lock(&(_sc)->vr_mtx) #define VR_UNLOCK(_sc) mtx_unlock(&(_sc)->vr_mtx) +#define VR_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->vr_mtx, MA_OWNED) /* * register space access macros diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c index ecf1fa4..465a490 100644 --- a/sys/dev/wl/if_wl.c +++ b/sys/dev/wl/if_wl.c @@ -265,6 +265,7 @@ struct wl_softc{ }; #define WL_LOCK(_sc) mtx_lock(&(_sc)->wl_mtx) +#define WL_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->wl_mtx, MA_OWNED) #define WL_UNLOCK(_sc) mtx_unlock(&(_sc)->wl_mtx) static int wlprobe(device_t); @@ -1069,6 +1070,7 @@ wlread(struct wl_softc *sc, u_short fd_p) u_short mlen, len; u_short bytes_in_msg, bytes_in_mbuf, bytes; + WL_LOCK_ASSERT(sc); #ifdef WLDEBUG if (sc->wl_if.if_flags & IFF_DEBUG) @@ -1212,7 +1214,9 @@ wlread(struct wl_softc *sc, u_short fd_p) * received packet is now in a chain of mbuf's. next step is * to pass the packet upwards. */ + WL_UNLOCK(sc); (*ifp->if_input)(ifp, m); + WL_LOCK(sc); return 1; } diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c index dc1c1b3..45ec33f 100644 --- a/sys/pci/if_dc.c +++ b/sys/pci/if_dc.c @@ -2723,6 +2723,8 @@ dc_rxeof(struct dc_softc *sc) int i, total_len = 0; u_int32_t rxstat; + DC_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; i = sc->dc_cdata.dc_rx_prod; @@ -2816,7 +2818,9 @@ dc_rxeof(struct dc_softc *sc) } ifp->if_ipackets++; + DC_UNLOCK(sc); (*ifp->if_input)(ifp, m); + DC_LOCK(sc); } sc->dc_cdata.dc_rx_prod = i; @@ -3069,6 +3073,7 @@ dc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) CSR_WRITE_4(sc, DC_IMR, DC_INTRS); return; } + DC_LOCK(sc); sc->rxcycles = count; dc_rxeof(sc); dc_txeof(sc); @@ -3082,8 +3087,10 @@ dc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) status &= (DC_ISR_RX_WATDOGTIMEO | DC_ISR_RX_NOBUF | DC_ISR_TX_NOBUF | DC_ISR_TX_IDLE | DC_ISR_TX_UNDERRUN | DC_ISR_BUS_ERR); - if (!status) + if (!status) { + DC_UNLOCK(sc); return; + } /* ack what we have */ CSR_WRITE_4(sc, DC_ISR, status); @@ -3107,6 +3114,7 @@ dc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) dc_init(sc); } } + DC_UNLOCK(sc); } #endif /* DEVICE_POLLING */ diff --git a/sys/pci/if_dcreg.h b/sys/pci/if_dcreg.h index 14912b5..fc77dd8 100644 --- a/sys/pci/if_dcreg.h +++ b/sys/pci/if_dcreg.h @@ -766,6 +766,7 @@ struct dc_softc { #define DC_LOCK(_sc) mtx_lock(&(_sc)->dc_mtx) #define DC_UNLOCK(_sc) mtx_unlock(&(_sc)->dc_mtx) +#define DC_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->dc_mtx, MA_OWNED) #define DC_TX_POLL 0x00000001 #define DC_TX_COALESCE 0x00000002 diff --git a/sys/pci/if_pcn.c b/sys/pci/if_pcn.c index 914b54b..56d57e1 100644 --- a/sys/pci/if_pcn.c +++ b/sys/pci/if_pcn.c @@ -796,6 +796,8 @@ pcn_rxeof(sc) struct pcn_rx_desc *cur_rx; int i; + PCN_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; i = sc->pcn_cdata.pcn_rx_prod; @@ -833,7 +835,9 @@ pcn_rxeof(sc) cur_rx->pcn_rxlen - ETHER_CRC_LEN; m->m_pkthdr.rcvif = ifp; + PCN_UNLOCK(sc); (*ifp->if_input)(ifp, m); + PCN_LOCK(sc); } sc->pcn_cdata.pcn_rx_prod = i; diff --git a/sys/pci/if_pcnreg.h b/sys/pci/if_pcnreg.h index 79ef531..0f3b86d 100644 --- a/sys/pci/if_pcnreg.h +++ b/sys/pci/if_pcnreg.h @@ -453,6 +453,7 @@ struct pcn_softc { #define PCN_LOCK(_sc) mtx_lock(&(_sc)->pcn_mtx) #define PCN_UNLOCK(_sc) mtx_unlock(&(_sc)->pcn_mtx) +#define PCN_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->pcn_mtx, MA_OWNED) /* * register space access macros diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c index 9e25e2f..526b727 100644 --- a/sys/pci/if_rl.c +++ b/sys/pci/if_rl.c @@ -1236,6 +1236,8 @@ rl_rxeof(sc) u_int16_t limit; u_int16_t rx_bytes = 0, max_bytes; + RL_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; bus_dmamap_sync(sc->rl_tag, sc->rl_cdata.rl_rx_dmamap, @@ -1336,7 +1338,9 @@ rl_rxeof(sc) continue; ifp->if_ipackets++; + RL_UNLOCK(sc); (*ifp->if_input)(ifp, m); + RL_LOCK(sc); } return; diff --git a/sys/pci/if_rlreg.h b/sys/pci/if_rlreg.h index 4d33c42..8bf6ada 100644 --- a/sys/pci/if_rlreg.h +++ b/sys/pci/if_rlreg.h @@ -692,6 +692,7 @@ struct rl_softc { #define RL_LOCK(_sc) mtx_lock(&(_sc)->rl_mtx) #define RL_UNLOCK(_sc) mtx_unlock(&(_sc)->rl_mtx) +#define RL_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->rl_mtx, MA_OWNED) /* * register space access macros diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c index e1def22..254277a 100644 --- a/sys/pci/if_sf.c +++ b/sys/pci/if_sf.c @@ -955,6 +955,8 @@ sf_rxeof(sc) u_int32_t rxcons, rxprod; int cmpprodidx, cmpconsidx, bufprodidx; + SF_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; rxcons = csr_read_4(sc, SF_CQ_CONSIDX); @@ -988,7 +990,9 @@ sf_rxeof(sc) m = m0; ifp->if_ipackets++; + SF_UNLOCK(sc); (*ifp->if_input)(ifp, m); + SF_LOCK(sc); } csr_write_4(sc, SF_CQ_CONSIDX, diff --git a/sys/pci/if_sfreg.h b/sys/pci/if_sfreg.h index 1975cfc..630f0b2 100644 --- a/sys/pci/if_sfreg.h +++ b/sys/pci/if_sfreg.h @@ -1051,6 +1051,7 @@ struct sf_softc { #define SF_LOCK(_sc) mtx_lock(&(_sc)->sf_mtx) #define SF_UNLOCK(_sc) mtx_unlock(&(_sc)->sf_mtx) +#define SF_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sf_mtx, MA_OWNED) #define SF_TIMEOUT 1000 diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c index fec9a41..bd3a265 100644 --- a/sys/pci/if_sis.c +++ b/sys/pci/if_sis.c @@ -1594,6 +1594,8 @@ sis_rxeof(sc) int i, total_len = 0; u_int32_t rxstat; + SIS_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; i = sc->sis_cdata.sis_rx_prod; @@ -1661,7 +1663,9 @@ sis_rxeof(sc) ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; + SIS_UNLOCK(sc); (*ifp->if_input)(ifp, m); + SIS_LOCK(sc); } sc->sis_cdata.sis_rx_prod = i; diff --git a/sys/pci/if_sisreg.h b/sys/pci/if_sisreg.h index daccbb1..e39bd08 100644 --- a/sys/pci/if_sisreg.h +++ b/sys/pci/if_sisreg.h @@ -479,6 +479,7 @@ struct sis_softc { #define SIS_LOCK(_sc) mtx_lock(&(_sc)->sis_mtx) #define SIS_UNLOCK(_sc) mtx_unlock(&(_sc)->sis_mtx) +#define SIS_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sis_mtx, MA_OWNED) /* * register space access macros diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c index 1ef4493..3226d91 100644 --- a/sys/pci/if_sk.c +++ b/sys/pci/if_sk.c @@ -1839,6 +1839,7 @@ static void sk_rxeof(sc_if) struct sk_if_softc *sc_if; { + struct sk_softc *sc; struct mbuf *m; struct ifnet *ifp; struct sk_chain *cur_rx; @@ -1846,10 +1847,13 @@ sk_rxeof(sc_if) int i; u_int32_t rxstat; + sc = sc_if->sk_softc; ifp = &sc_if->arpcom.ac_if; i = sc_if->sk_cdata.sk_rx_prod; cur_rx = &sc_if->sk_cdata.sk_rx_chain[i]; + SK_LOCK_ASSERT(sc); + while(!(sc_if->sk_rdata->sk_rx_ring[i].sk_ctl & SK_RXCTL_OWN)) { cur_rx = &sc_if->sk_cdata.sk_rx_chain[i]; @@ -1891,7 +1895,9 @@ sk_rxeof(sc_if) } ifp->if_ipackets++; + SK_UNLOCK(sc); (*ifp->if_input)(ifp, m); + SK_LOCK(sc); } sc_if->sk_cdata.sk_rx_prod = i; diff --git a/sys/pci/if_skreg.h b/sys/pci/if_skreg.h index 7309841..8e2eb53 100644 --- a/sys/pci/if_skreg.h +++ b/sys/pci/if_skreg.h @@ -1423,6 +1423,7 @@ struct sk_softc { #define SK_LOCK(_sc) mtx_lock(&(_sc)->sk_mtx) #define SK_UNLOCK(_sc) mtx_unlock(&(_sc)->sk_mtx) +#define SK_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sk_mtx, MA_OWNED) #define SK_IF_LOCK(_sc) mtx_lock(&(_sc)->sk_softc->sk_mtx) #define SK_IF_UNLOCK(_sc) mtx_unlock(&(_sc)->sk_softc->sk_mtx) diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c index cf1e920..5c08f85 100644 --- a/sys/pci/if_ste.c +++ b/sys/pci/if_ste.c @@ -693,6 +693,8 @@ ste_rxeof(sc) int total_len = 0, count=0; u_int32_t rxstat; + STE_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; while((rxstat = sc->ste_cdata.ste_rx_head->ste_ptr->ste_status) @@ -750,7 +752,9 @@ ste_rxeof(sc) m->m_pkthdr.len = m->m_len = total_len; ifp->if_ipackets++; + STE_UNLOCK(sc); (*ifp->if_input)(ifp, m); + STE_LOCK(sc); cur_rx->ste_ptr->ste_status = 0; count++; diff --git a/sys/pci/if_stereg.h b/sys/pci/if_stereg.h index 5c1f8ff..99295ac 100644 --- a/sys/pci/if_stereg.h +++ b/sys/pci/if_stereg.h @@ -530,6 +530,7 @@ struct ste_softc { #define STE_LOCK(_sc) mtx_lock(&(_sc)->ste_mtx) #define STE_UNLOCK(_sc) mtx_unlock(&(_sc)->ste_mtx) +#define STE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->ste_mtx, MA_OWNED) struct ste_mii_frame { u_int8_t mii_stdelim; diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index 4cbea9b..c5f3fc0 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -2384,6 +2384,8 @@ ti_rxeof(sc) struct ifnet *ifp; struct ti_cmd_desc cmd; + TI_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; while(sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { @@ -2479,7 +2481,9 @@ ti_rxeof(sc) */ if (have_tag) VLAN_INPUT_TAG(ifp, m, vlan_tag, continue); + TI_UNLOCK(sc); (*ifp->if_input)(ifp, m); + TI_LOCK(sc); } /* Only necessary on the Tigon 1. */ diff --git a/sys/pci/if_tireg.h b/sys/pci/if_tireg.h index b15b28b..71d9661 100644 --- a/sys/pci/if_tireg.h +++ b/sys/pci/if_tireg.h @@ -1030,6 +1030,7 @@ struct ti_softc { #define TI_LOCK(_sc) mtx_lock(&(_sc)->ti_mtx) #define TI_UNLOCK(_sc) mtx_unlock(&(_sc)->ti_mtx) +#define TI_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->ti_mtx, MA_OWNED) /* * Microchip Technology 24Cxx EEPROM control bytes diff --git a/sys/pci/if_tl.c b/sys/pci/if_tl.c index df7784f..dd20b2a 100644 --- a/sys/pci/if_tl.c +++ b/sys/pci/if_tl.c @@ -1504,6 +1504,8 @@ tl_intvec_rxeof(xsc, type) sc = xsc; ifp = &sc->arpcom.ac_if; + TL_LOCK_ASSERT(sc); + while(sc->tl_cdata.tl_rx_head != NULL) { cur_rx = sc->tl_cdata.tl_rx_head; if (!(cur_rx->tl_ptr->tlist_cstat & TL_CSTAT_FRAMECMP)) @@ -1543,7 +1545,9 @@ tl_intvec_rxeof(xsc, type) m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = total_len; + TL_UNLOCK(sc); (*ifp->if_input)(ifp, m); + TL_LOCK(sc); } return(r); diff --git a/sys/pci/if_tlreg.h b/sys/pci/if_tlreg.h index fe711ac..086738d 100644 --- a/sys/pci/if_tlreg.h +++ b/sys/pci/if_tlreg.h @@ -130,6 +130,7 @@ struct tl_softc { #define TL_LOCK(_sc) mtx_lock(&(_sc)->tl_mtx) #define TL_UNLOCK(_sc) mtx_unlock(&(_sc)->tl_mtx) +#define TL_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->tl_mtx, MA_OWNED) /* * Transmit interrupt threshold. diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c index 712bbea..1d35c3f 100644 --- a/sys/pci/if_vr.c +++ b/sys/pci/if_vr.c @@ -1061,6 +1061,8 @@ vr_rxeof(sc) int total_len = 0; u_int32_t rxstat; + VR_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; while(!((rxstat = sc->vr_cdata.vr_rx_head->vr_ptr->vr_status) & @@ -1122,7 +1124,9 @@ vr_rxeof(sc) m = m0; ifp->if_ipackets++; + VR_UNLOCK(sc); (*ifp->if_input)(ifp, m); + VR_LOCK(sc); } return; diff --git a/sys/pci/if_vrreg.h b/sys/pci/if_vrreg.h index 043c3ed..2f8e810 100644 --- a/sys/pci/if_vrreg.h +++ b/sys/pci/if_vrreg.h @@ -475,6 +475,7 @@ struct vr_softc { #define VR_LOCK(_sc) mtx_lock(&(_sc)->vr_mtx) #define VR_UNLOCK(_sc) mtx_unlock(&(_sc)->vr_mtx) +#define VR_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->vr_mtx, MA_OWNED) /* * register space access macros diff --git a/sys/pci/if_wb.c b/sys/pci/if_wb.c index 13b29b0..14be722 100644 --- a/sys/pci/if_wb.c +++ b/sys/pci/if_wb.c @@ -1132,6 +1132,8 @@ wb_rxeof(sc) int total_len = 0; u_int32_t rxstat; + WB_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; while(!((rxstat = sc->wb_cdata.wb_rx_head->wb_ptr->wb_status) & @@ -1186,7 +1188,9 @@ wb_rxeof(sc) m = m0; ifp->if_ipackets++; + WB_UNLOCK(sc); (*ifp->if_input)(ifp, m); + WB_LOCK(sc); } } diff --git a/sys/pci/if_wbreg.h b/sys/pci/if_wbreg.h index 983886b..5467de6 100644 --- a/sys/pci/if_wbreg.h +++ b/sys/pci/if_wbreg.h @@ -383,6 +383,7 @@ struct wb_softc { #define WB_LOCK(_sc) mtx_lock(&(_sc)->wb_mtx) #define WB_UNLOCK(_sc) mtx_unlock(&(_sc)->wb_mtx) +#define WB_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->wb_mtx, MA_OWNED) /* * register space access macros diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index ae078ff..3f5e8c9 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -2046,6 +2046,8 @@ xl_rxeof(sc) int total_len = 0; u_int32_t rxstat; + XL_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; again: @@ -2137,7 +2139,9 @@ again: } } + XL_UNLOCK(sc); (*ifp->if_input)(ifp, m); + XL_LOCK(sc); } /* diff --git a/sys/pci/if_xlreg.h b/sys/pci/if_xlreg.h index d32d636..2fb139c 100644 --- a/sys/pci/if_xlreg.h +++ b/sys/pci/if_xlreg.h @@ -610,9 +610,11 @@ struct xl_softc { /* These are a bit premature. The driver still tries to sleep with locks. */ #define XL_LOCK(_sc) mtx_lock(&(_sc)->xl_mtx) #define XL_UNLOCK(_sc) mtx_unlock(&(_sc)->xl_mtx) +#define XL_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->xl_mtx, MA_OWNED) #else #define XL_LOCK(x) do { } while (0) #define XL_UNLOCK(x) do { } while (0) +#define XL_LOCK_ASSERT(x) do { } while (0) #endif #define xl_rx_goodframes(x) \ |