Date: Wed, 12 Nov 2003 10:55:38 -0800 (PST) From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 42150 for review Message-ID: <200311121855.hACItcZ4008438@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=42150 Change 42150 by sam@sam_ebb on 2003/11/12 10:55:11 drop driver lock around calls to if_input to avoid a LOR if the packet comes back directly from the bridge or a packet forwarding path Affected files ... .. //depot/projects/netperf/sys/dev/an/if_an.c#5 edit .. //depot/projects/netperf/sys/dev/an/if_anreg.h#4 edit .. //depot/projects/netperf/sys/dev/bfe/if_bfe.c#3 edit .. //depot/projects/netperf/sys/dev/my/if_my.c#5 edit .. //depot/projects/netperf/sys/dev/owi/if_owi.c#3 edit .. //depot/projects/netperf/sys/dev/owi/if_wivar.h#2 edit .. //depot/projects/netperf/sys/dev/re/if_re.c#5 edit .. //depot/projects/netperf/sys/dev/wl/if_wl.c#4 edit .. //depot/projects/netperf/sys/pci/if_dc.c#12 edit .. //depot/projects/netperf/sys/pci/if_dcreg.h#3 edit .. //depot/projects/netperf/sys/pci/if_pcn.c#4 edit .. //depot/projects/netperf/sys/pci/if_rl.c#11 edit .. //depot/projects/netperf/sys/pci/if_rlreg.h#7 edit .. //depot/projects/netperf/sys/pci/if_sf.c#4 edit .. //depot/projects/netperf/sys/pci/if_sfreg.h#2 edit .. //depot/projects/netperf/sys/pci/if_sis.c#15 edit .. //depot/projects/netperf/sys/pci/if_sisreg.h#5 edit .. //depot/projects/netperf/sys/pci/if_sk.c#6 edit .. //depot/projects/netperf/sys/pci/if_skreg.h#4 edit .. //depot/projects/netperf/sys/pci/if_ste.c#4 edit .. //depot/projects/netperf/sys/pci/if_stereg.h#2 edit .. //depot/projects/netperf/sys/pci/if_ti.c#6 edit .. //depot/projects/netperf/sys/pci/if_tireg.h#2 edit .. //depot/projects/netperf/sys/pci/if_tl.c#4 edit .. //depot/projects/netperf/sys/pci/if_tlreg.h#2 edit .. //depot/projects/netperf/sys/pci/if_vr.c#4 edit .. //depot/projects/netperf/sys/pci/if_vrreg.h#2 edit .. //depot/projects/netperf/sys/pci/if_wb.c#4 edit .. //depot/projects/netperf/sys/pci/if_wbreg.h#2 edit .. //depot/projects/netperf/sys/pci/if_xl.c#10 edit .. //depot/projects/netperf/sys/pci/if_xlreg.h#3 edit Differences ... ==== //depot/projects/netperf/sys/dev/an/if_an.c#5 (text+ko) ==== @@ -833,6 +833,8 @@ 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 @@ 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 */ ==== //depot/projects/netperf/sys/dev/an/if_anreg.h#4 (text+ko) ==== @@ -502,6 +502,7 @@ #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); ==== //depot/projects/netperf/sys/dev/bfe/if_bfe.c#3 (text+ko) ==== @@ -1153,7 +1153,9 @@ 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); } ==== //depot/projects/netperf/sys/dev/my/if_my.c#5 (text+ko) ==== @@ -1279,7 +1279,9 @@ } } #endif + MY_UNLOCK(sc); (*ifp->if_input)(ifp, m); + MY_LOCK(sc); } MY_UNLOCK(sc); return; ==== //depot/projects/netperf/sys/dev/owi/if_owi.c#3 (text+ko) ==== @@ -449,6 +449,8 @@ 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 @@ #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); } } ==== //depot/projects/netperf/sys/dev/owi/if_wivar.h#2 (text+ko) ==== @@ -171,9 +171,11 @@ #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); ==== //depot/projects/netperf/sys/dev/re/if_re.c#5 (text+ko) ==== @@ -1519,6 +1519,8 @@ 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; @@ -1661,7 +1663,9 @@ 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 */ ==== //depot/projects/netperf/sys/dev/wl/if_wl.c#4 (text+ko) ==== @@ -266,6 +266,7 @@ }; #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); @@ -1070,6 +1071,7 @@ 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) @@ -1213,7 +1215,9 @@ * 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; } ==== //depot/projects/netperf/sys/pci/if_dc.c#12 (text+ko) ==== @@ -2721,6 +2721,8 @@ 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; @@ -2814,7 +2816,9 @@ } ifp->if_ipackets++; + DC_UNLOCK(sc); (*ifp->if_input)(ifp, m); + DC_LOCK(sc); } sc->dc_cdata.dc_rx_prod = i; @@ -3067,6 +3071,7 @@ CSR_WRITE_4(sc, DC_IMR, DC_INTRS); return; } + DC_LOCK(sc); sc->rxcycles = count; dc_rxeof(sc); dc_txeof(sc); @@ -3080,8 +3085,10 @@ 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); @@ -3105,6 +3112,7 @@ dc_init(sc); } } + DC_UNLOCK(sc); } #endif /* DEVICE_POLLING */ ==== //depot/projects/netperf/sys/pci/if_dcreg.h#3 (text+ko) ==== @@ -766,6 +766,7 @@ #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 ==== //depot/projects/netperf/sys/pci/if_pcn.c#4 (text+ko) ==== @@ -794,6 +794,8 @@ struct pcn_rx_desc *cur_rx; int i; + PCN_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; i = sc->pcn_cdata.pcn_rx_prod; @@ -831,7 +833,9 @@ 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; ==== //depot/projects/netperf/sys/pci/if_rl.c#11 (text+ko) ==== @@ -1239,6 +1239,8 @@ 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, @@ -1339,7 +1341,9 @@ continue; ifp->if_ipackets++; + RL_UNLOCK(sc); (*ifp->if_input)(ifp, m); + RL_LOCK(sc); } return; ==== //depot/projects/netperf/sys/pci/if_rlreg.h#7 (text+ko) ==== @@ -692,6 +692,7 @@ #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 ==== //depot/projects/netperf/sys/pci/if_sf.c#4 (text+ko) ==== @@ -958,6 +958,8 @@ 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); @@ -991,7 +993,9 @@ m = m0; ifp->if_ipackets++; + SF_UNLOCK(sc); (*ifp->if_input)(ifp, m); + SF_LOCK(sc); } csr_write_4(sc, SF_CQ_CONSIDX, ==== //depot/projects/netperf/sys/pci/if_sfreg.h#2 (text+ko) ==== @@ -1051,6 +1051,7 @@ #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 ==== //depot/projects/netperf/sys/pci/if_sis.c#15 (text+ko) ==== @@ -1596,6 +1596,8 @@ 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; @@ -1663,7 +1665,9 @@ 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; ==== //depot/projects/netperf/sys/pci/if_sisreg.h#5 (text+ko) ==== @@ -479,6 +479,7 @@ #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 ==== //depot/projects/netperf/sys/pci/if_sk.c#6 (text+ko) ==== @@ -1834,6 +1834,7 @@ 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; @@ -1841,10 +1842,13 @@ 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]; @@ -1886,7 +1890,9 @@ } ifp->if_ipackets++; + SK_UNLOCK(sc); (*ifp->if_input)(ifp, m); + SK_LOCK(sc); } sc_if->sk_cdata.sk_rx_prod = i; ==== //depot/projects/netperf/sys/pci/if_skreg.h#4 (text+ko) ==== @@ -1418,6 +1418,7 @@ #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) ==== //depot/projects/netperf/sys/pci/if_ste.c#4 (text+ko) ==== @@ -695,6 +695,8 @@ 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) @@ -752,7 +754,9 @@ 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++; ==== //depot/projects/netperf/sys/pci/if_stereg.h#2 (text+ko) ==== @@ -530,6 +530,7 @@ #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; ==== //depot/projects/netperf/sys/pci/if_ti.c#6 (text+ko) ==== @@ -2384,6 +2384,8 @@ 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 @@ */ 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. */ ==== //depot/projects/netperf/sys/pci/if_tireg.h#2 (text+ko) ==== @@ -1030,6 +1030,7 @@ #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 ==== //depot/projects/netperf/sys/pci/if_tl.c#4 (text+ko) ==== @@ -1506,6 +1506,8 @@ 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)) @@ -1545,7 +1547,9 @@ 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); ==== //depot/projects/netperf/sys/pci/if_tlreg.h#2 (text+ko) ==== @@ -130,6 +130,7 @@ #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. ==== //depot/projects/netperf/sys/pci/if_vr.c#4 (text+ko) ==== @@ -1063,6 +1063,8 @@ 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) & @@ -1124,7 +1126,9 @@ m = m0; ifp->if_ipackets++; + VR_UNLOCK(sc); (*ifp->if_input)(ifp, m); + VR_LOCK(sc); } return; ==== //depot/projects/netperf/sys/pci/if_vrreg.h#2 (text+ko) ==== @@ -475,6 +475,7 @@ #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 ==== //depot/projects/netperf/sys/pci/if_wb.c#4 (text+ko) ==== @@ -1134,6 +1134,8 @@ 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) & @@ -1188,7 +1190,9 @@ m = m0; ifp->if_ipackets++; + WB_UNLOCK(sc); (*ifp->if_input)(ifp, m); + WB_LOCK(sc); } } ==== //depot/projects/netperf/sys/pci/if_wbreg.h#2 (text+ko) ==== @@ -383,6 +383,7 @@ #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 ==== //depot/projects/netperf/sys/pci/if_xl.c#10 (text+ko) ==== @@ -2048,6 +2048,8 @@ int total_len = 0; u_int32_t rxstat; + XL_LOCK_ASSERT(sc); + ifp = &sc->arpcom.ac_if; again: @@ -2139,7 +2141,9 @@ } } + XL_UNLOCK(sc); (*ifp->if_input)(ifp, m); + XL_LOCK(sc); } /* ==== //depot/projects/netperf/sys/pci/if_xlreg.h#3 (text+ko) ==== @@ -610,9 +610,11 @@ /* 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) \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311121855.hACItcZ4008438>