Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/vr/if_vr.c
Show First 20 Lines • Show All 1,596 Lines • ▼ Show 20 Lines | if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) | ||||
rx_npkts = vr_poll_locked(ifp, cmd, count); | rx_npkts = vr_poll_locked(ifp, cmd, count); | ||||
VR_UNLOCK(sc); | VR_UNLOCK(sc); | ||||
return (rx_npkts); | return (rx_npkts); | ||||
} | } | ||||
static int | static int | ||||
vr_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count) | vr_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count) | ||||
{ | { | ||||
struct epoch_tracker et; | |||||
struct vr_softc *sc; | struct vr_softc *sc; | ||||
int rx_npkts; | int rx_npkts; | ||||
sc = ifp->if_softc; | sc = ifp->if_softc; | ||||
VR_LOCK_ASSERT(sc); | VR_LOCK_ASSERT(sc); | ||||
sc->rxcycles = count; | sc->rxcycles = count; | ||||
NET_EPOCH_ENTER(et); | |||||
rx_npkts = vr_rxeof(sc); | rx_npkts = vr_rxeof(sc); | ||||
NET_EPOCH_EXIT(et); | |||||
vr_txeof(sc); | vr_txeof(sc); | ||||
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) | if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) | ||||
vr_start_locked(ifp); | vr_start_locked(ifp); | ||||
if (cmd == POLL_AND_CHECK_STATUS) { | if (cmd == POLL_AND_CHECK_STATUS) { | ||||
uint16_t status; | uint16_t status; | ||||
/* Also check status register. */ | /* Also check status register. */ | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | vr_intr(void *arg) | ||||
taskqueue_enqueue(taskqueue_fast, &sc->vr_inttask); | taskqueue_enqueue(taskqueue_fast, &sc->vr_inttask); | ||||
return (FILTER_HANDLED); | return (FILTER_HANDLED); | ||||
} | } | ||||
static void | static void | ||||
vr_int_task(void *arg, int npending) | vr_int_task(void *arg, int npending) | ||||
{ | { | ||||
struct epoch_tracker et; | |||||
struct vr_softc *sc; | struct vr_softc *sc; | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
uint16_t status; | uint16_t status; | ||||
sc = (struct vr_softc *)arg; | sc = (struct vr_softc *)arg; | ||||
VR_LOCK(sc); | VR_LOCK(sc); | ||||
Show All 19 Lines | for (; (status & VR_INTRS) != 0;) { | ||||
CSR_WRITE_2(sc, VR_ISR, status); | CSR_WRITE_2(sc, VR_ISR, status); | ||||
if ((status & (VR_ISR_BUSERR | VR_ISR_LINKSTAT2 | | if ((status & (VR_ISR_BUSERR | VR_ISR_LINKSTAT2 | | ||||
VR_ISR_STATSOFLOW)) != 0) { | VR_ISR_STATSOFLOW)) != 0) { | ||||
if (vr_error(sc, status) != 0) { | if (vr_error(sc, status) != 0) { | ||||
VR_UNLOCK(sc); | VR_UNLOCK(sc); | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
NET_EPOCH_ENTER(et); | |||||
vr_rxeof(sc); | vr_rxeof(sc); | ||||
NET_EPOCH_EXIT(et); | |||||
if ((status & (VR_ISR_RX_NOBUF | VR_ISR_RX_OFLOW)) != 0) { | if ((status & (VR_ISR_RX_NOBUF | VR_ISR_RX_OFLOW)) != 0) { | ||||
#ifdef VR_SHOW_ERRORS | #ifdef VR_SHOW_ERRORS | ||||
device_printf(sc->vr_dev, "%s: receive error = 0x%b\n", | device_printf(sc->vr_dev, "%s: receive error = 0x%b\n", | ||||
__func__, status, VR_ISR_ERR_BITS); | __func__, status, VR_ISR_ERR_BITS); | ||||
#endif | #endif | ||||
/* Restart Rx if RxDMA SM was stopped. */ | /* Restart Rx if RxDMA SM was stopped. */ | ||||
vr_rx_start(sc); | vr_rx_start(sc); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 929 Lines • Show Last 20 Lines |