Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mge/if_mge.c
Show First 20 Lines • Show All 737 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
#ifdef DEVICE_POLLING | #ifdef DEVICE_POLLING | ||||
static poll_handler_t mge_poll; | static poll_handler_t mge_poll; | ||||
static int | static int | ||||
mge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) | mge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) | ||||
{ | { | ||||
struct epoch_tracker et; | |||||
struct mge_softc *sc = ifp->if_softc; | struct mge_softc *sc = ifp->if_softc; | ||||
uint32_t int_cause, int_cause_ext; | uint32_t int_cause, int_cause_ext; | ||||
int rx_npkts = 0; | int rx_npkts = 0; | ||||
MGE_RECEIVE_LOCK(sc); | MGE_RECEIVE_LOCK(sc); | ||||
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { | if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { | ||||
MGE_RECEIVE_UNLOCK(sc); | MGE_RECEIVE_UNLOCK(sc); | ||||
Show All 10 Lines | if (cmd == POLL_AND_CHECK_STATUS) { | ||||
if (int_cause || int_cause_ext) { | if (int_cause || int_cause_ext) { | ||||
MGE_WRITE(sc, MGE_PORT_INT_CAUSE, ~int_cause); | MGE_WRITE(sc, MGE_PORT_INT_CAUSE, ~int_cause); | ||||
MGE_WRITE(sc, MGE_PORT_INT_CAUSE_EXT, ~int_cause_ext); | MGE_WRITE(sc, MGE_PORT_INT_CAUSE_EXT, ~int_cause_ext); | ||||
} | } | ||||
} | } | ||||
NET_EPOCH_ENTER(et); | |||||
rx_npkts = mge_intr_rx_locked(sc, count); | rx_npkts = mge_intr_rx_locked(sc, count); | ||||
NET_EPOCH_EXIT(et); | |||||
MGE_RECEIVE_UNLOCK(sc); | MGE_RECEIVE_UNLOCK(sc); | ||||
MGE_TRANSMIT_LOCK(sc); | MGE_TRANSMIT_LOCK(sc); | ||||
mge_intr_tx_locked(sc); | mge_intr_tx_locked(sc); | ||||
MGE_TRANSMIT_UNLOCK(sc); | MGE_TRANSMIT_UNLOCK(sc); | ||||
return (rx_npkts); | return (rx_npkts); | ||||
} | } | ||||
#endif /* DEVICE_POLLING */ | #endif /* DEVICE_POLLING */ | ||||
▲ Show 20 Lines • Show All 520 Lines • ▼ Show 20 Lines | #endif | ||||
MGE_RECEIVE_UNLOCK(sc); | MGE_RECEIVE_UNLOCK(sc); | ||||
} | } | ||||
static void | static void | ||||
mge_intr_rx_check(struct mge_softc *sc, uint32_t int_cause, | mge_intr_rx_check(struct mge_softc *sc, uint32_t int_cause, | ||||
uint32_t int_cause_ext) | uint32_t int_cause_ext) | ||||
{ | { | ||||
struct epoch_tracker et; | |||||
/* Check for resource error */ | /* Check for resource error */ | ||||
if (int_cause & MGE_PORT_INT_RXERRQ0) { | if (int_cause & MGE_PORT_INT_RXERRQ0) { | ||||
mge_reinit_rx(sc); | mge_reinit_rx(sc); | ||||
MGE_WRITE(sc, MGE_PORT_INT_CAUSE, | MGE_WRITE(sc, MGE_PORT_INT_CAUSE, | ||||
~(int_cause & MGE_PORT_INT_RXERRQ0)); | ~(int_cause & MGE_PORT_INT_RXERRQ0)); | ||||
} | } | ||||
int_cause &= MGE_PORT_INT_RXQ0; | int_cause &= MGE_PORT_INT_RXQ0; | ||||
int_cause_ext &= MGE_PORT_INT_EXT_RXOR; | int_cause_ext &= MGE_PORT_INT_EXT_RXOR; | ||||
if (int_cause || int_cause_ext) { | if (int_cause || int_cause_ext) { | ||||
MGE_WRITE(sc, MGE_PORT_INT_CAUSE, ~int_cause); | MGE_WRITE(sc, MGE_PORT_INT_CAUSE, ~int_cause); | ||||
MGE_WRITE(sc, MGE_PORT_INT_CAUSE_EXT, ~int_cause_ext); | MGE_WRITE(sc, MGE_PORT_INT_CAUSE_EXT, ~int_cause_ext); | ||||
NET_EPOCH_ENTER(et); | |||||
mge_intr_rx_locked(sc, -1); | mge_intr_rx_locked(sc, -1); | ||||
NET_EPOCH_EXIT(et); | |||||
} | } | ||||
} | } | ||||
static int | static int | ||||
mge_intr_rx_locked(struct mge_softc *sc, int count) | mge_intr_rx_locked(struct mge_softc *sc, int count) | ||||
{ | { | ||||
struct ifnet *ifp = sc->ifp; | struct ifnet *ifp = sc->ifp; | ||||
uint32_t status; | uint32_t status; | ||||
▲ Show 20 Lines • Show All 845 Lines • Show Last 20 Lines |