Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/jme/if_jme.c
Show First 20 Lines • Show All 2,354 Lines • ▼ Show 20 Lines | jme_intr(void *arg) | ||||
taskqueue_enqueue(sc->jme_tq, &sc->jme_int_task); | taskqueue_enqueue(sc->jme_tq, &sc->jme_int_task); | ||||
return (FILTER_HANDLED); | return (FILTER_HANDLED); | ||||
} | } | ||||
static void | static void | ||||
jme_int_task(void *arg, int pending) | jme_int_task(void *arg, int pending) | ||||
{ | { | ||||
struct epoch_tracker et; | |||||
struct jme_softc *sc; | struct jme_softc *sc; | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
uint32_t status; | uint32_t status; | ||||
int more; | int more; | ||||
sc = (struct jme_softc *)arg; | sc = (struct jme_softc *)arg; | ||||
ifp = sc->jme_ifp; | ifp = sc->jme_ifp; | ||||
Show All 10 Lines | jme_int_task(void *arg, int pending) | ||||
if ((status & (INTR_TXQ_COAL | INTR_TXQ_COAL_TO)) != 0) | if ((status & (INTR_TXQ_COAL | INTR_TXQ_COAL_TO)) != 0) | ||||
status |= INTR_TXQ_COAL | INTR_TXQ_COAL_TO | INTR_TXQ_COMP; | status |= INTR_TXQ_COAL | INTR_TXQ_COAL_TO | INTR_TXQ_COMP; | ||||
if ((status & (INTR_RXQ_COAL | INTR_RXQ_COAL_TO)) != 0) | if ((status & (INTR_RXQ_COAL | INTR_RXQ_COAL_TO)) != 0) | ||||
status |= INTR_RXQ_COAL | INTR_RXQ_COAL_TO | INTR_RXQ_COMP; | status |= INTR_RXQ_COAL | INTR_RXQ_COAL_TO | INTR_RXQ_COMP; | ||||
CSR_WRITE_4(sc, JME_INTR_STATUS, status); | CSR_WRITE_4(sc, JME_INTR_STATUS, status); | ||||
more = 0; | more = 0; | ||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { | if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { | ||||
if ((status & (INTR_RXQ_COAL | INTR_RXQ_COAL_TO)) != 0) { | if ((status & (INTR_RXQ_COAL | INTR_RXQ_COAL_TO)) != 0) { | ||||
NET_EPOCH_ENTER(et); | |||||
more = jme_rxintr(sc, sc->jme_process_limit); | more = jme_rxintr(sc, sc->jme_process_limit); | ||||
NET_EPOCH_EXIT(et); | |||||
if (more != 0) | if (more != 0) | ||||
sc->jme_morework = 1; | sc->jme_morework = 1; | ||||
} | } | ||||
if ((status & INTR_RXQ_DESC_EMPTY) != 0) { | if ((status & INTR_RXQ_DESC_EMPTY) != 0) { | ||||
/* | /* | ||||
* Notify hardware availability of new Rx | * Notify hardware availability of new Rx | ||||
* buffers. | * buffers. | ||||
* Reading RXCSR takes very long time under | * Reading RXCSR takes very long time under | ||||
▲ Show 20 Lines • Show All 600 Lines • ▼ Show 20 Lines | jme_init_locked(struct jme_softc *sc) | ||||
ifp->if_drv_flags |= IFF_DRV_RUNNING; | ifp->if_drv_flags |= IFF_DRV_RUNNING; | ||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; | ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; | ||||
} | } | ||||
static void | static void | ||||
jme_stop(struct jme_softc *sc) | jme_stop(struct jme_softc *sc) | ||||
{ | { | ||||
struct epoch_tracker et; | |||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
struct jme_txdesc *txd; | struct jme_txdesc *txd; | ||||
struct jme_rxdesc *rxd; | struct jme_rxdesc *rxd; | ||||
int i; | int i; | ||||
JME_LOCK_ASSERT(sc); | JME_LOCK_ASSERT(sc); | ||||
/* | /* | ||||
* Mark the interface down and cancel the watchdog timer. | * Mark the interface down and cancel the watchdog timer. | ||||
Show All 14 Lines | jme_stop(struct jme_softc *sc) | ||||
CSR_WRITE_4(sc, JME_SHBASE_ADDR_LO, | CSR_WRITE_4(sc, JME_SHBASE_ADDR_LO, | ||||
CSR_READ_4(sc, JME_SHBASE_ADDR_LO) & ~SHBASE_POST_ENB); | CSR_READ_4(sc, JME_SHBASE_ADDR_LO) & ~SHBASE_POST_ENB); | ||||
/* Stop receiver, transmitter. */ | /* Stop receiver, transmitter. */ | ||||
jme_stop_rx(sc); | jme_stop_rx(sc); | ||||
jme_stop_tx(sc); | jme_stop_tx(sc); | ||||
/* Reclaim Rx/Tx buffers that have been completed. */ | /* Reclaim Rx/Tx buffers that have been completed. */ | ||||
NET_EPOCH_ENTER(et); | |||||
jme_rxintr(sc, JME_RX_RING_CNT); | jme_rxintr(sc, JME_RX_RING_CNT); | ||||
NET_EPOCH_EXIT(et); | |||||
if (sc->jme_cdata.jme_rxhead != NULL) | if (sc->jme_cdata.jme_rxhead != NULL) | ||||
m_freem(sc->jme_cdata.jme_rxhead); | m_freem(sc->jme_cdata.jme_rxhead); | ||||
JME_RXCHAIN_RESET(sc); | JME_RXCHAIN_RESET(sc); | ||||
jme_txeof(sc); | jme_txeof(sc); | ||||
/* | /* | ||||
* Free RX and TX mbufs still in the queues. | * Free RX and TX mbufs still in the queues. | ||||
*/ | */ | ||||
for (i = 0; i < JME_RX_RING_CNT; i++) { | for (i = 0; i < JME_RX_RING_CNT; i++) { | ||||
▲ Show 20 Lines • Show All 414 Lines • Show Last 20 Lines |