-/* $OpenBSD: if_mvneta.c,v 1.23 2022/06/01 04:31:08 dlg Exp $ */
+/* $OpenBSD: if_mvneta.c,v 1.24 2022/06/01 06:33:46 dlg Exp $ */
/* $NetBSD: if_mvneta.c,v 1.41 2015/04/15 10:15:40 hsuenaga Exp $ */
/*
* Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
bus_dma_tag_t sc_dmat;
+ void *sc_ih;
struct arpcom sc_ac;
#define sc_enaddr sc_ac.ac_enaddr
while (MVNETA_READ(sc, MVNETA_PMACC2) & MVNETA_PMACC2_PORTMACRESET)
;
- fdt_intr_establish(faa->fa_node, IPL_NET, mvneta_intr, sc,
- sc->sc_dev.dv_xname);
+ sc->sc_ih = fdt_intr_establish(faa->fa_node, IPL_NET | IPL_MPSAFE,
+ mvneta_intr, sc, sc->sc_dev.dv_xname);
ifp = &sc->sc_ac.ac_if;
ifp->if_softc = sc;
ic = MVNETA_READ(sc, MVNETA_PRXTXTIC);
if (ic & MVNETA_PRXTXTI_PMISCICSUMMARY) {
+ KERNEL_LOCK();
misc = MVNETA_READ(sc, MVNETA_PMIC);
MVNETA_WRITE(sc, MVNETA_PMIC, 0);
if (sc->sc_inband_status && (misc &
MVNETA_PMI_PSCSYNCCHNG))) {
mvneta_inband_statchg(sc);
}
+ KERNEL_UNLOCK();
}
- if (!(ifp->if_flags & IFF_RUNNING))
+ if (!ISSET(ifp->if_flags, IFF_RUNNING))
return 1;
if (ic & MVNETA_PRXTXTI_TBTCQ(0))
DPRINTFN(2, ("mvneta_down\n"));
timeout_del(&sc->sc_tick_ch);
+ ifp->if_flags &= ~IFF_RUNNING;
+ intr_barrier(sc->sc_ih);
/* Stop Rx port activity. Check port Rx activity. */
reg = MVNETA_READ(sc, MVNETA_RQC);
MVNETA_WRITE(sc, MVNETA_PRXINIT, 0);
MVNETA_WRITE(sc, MVNETA_PTXINIT, 0);
- ifp->if_flags &= ~IFF_RUNNING;
ifq_clr_oactive(&ifp->if_snd);
}