FreeBSD Bugzilla – Attachment 26200 Details for
Bug 44772
Device polling support for nge(4) driver
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 2.92 KB, created by
Takashi Oono
on 2002-10-31 04:20:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Takashi Oono
Created:
2002-10-31 04:20:01 UTC
Size:
2.92 KB
patch
obsolete
>*** if_nge.c.orig Fri Aug 16 01:38:55 2002 >--- if_nge.c Thu Oct 31 10:33:49 2002 >*************** >*** 1380,1385 **** >--- 1380,1393 ---- > struct mbuf *m0 = NULL; > u_int32_t extsts; > >+ #ifdef DEVICE_POLLING >+ if (ifp->if_ipending & IFF_POLLING) { >+ if (sc->rxcycles <= 0) >+ break; >+ sc->rxcycles--; >+ } >+ #endif /* DEVICE_POLLING */ >+ > cur_rx = &sc->nge_ldata->nge_rx_list[i]; > rxstat = cur_rx->nge_rxstat; > extsts = cur_rx->nge_extsts; >*************** >*** 1584,1589 **** >--- 1592,1645 ---- > return; > } > >+ #ifdef DEVICE_POLLING >+ static poll_handler_t nge_poll; >+ >+ static void >+ nge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) >+ { >+ struct nge_softc *sc = ifp->if_softc; >+ >+ if (cmd == POLL_DEREGISTER) { /* final call, enable interrupts */ >+ CSR_WRITE_4(sc, NGE_IER, 1); >+ return; >+ } >+ >+ /* >+ * On the nge, reading the status register also clears it. >+ * So before returning to intr mode we must make sure that all >+ * possible pending sources of interrupts have been served. >+ * In practice this means run to completion the *eof routines, >+ * and then call the interrupt routine >+ */ >+ sc->rxcycles = count; >+ nge_rxeof(sc); >+ nge_txeof(sc); >+ if (ifp->if_snd.ifq_head != NULL) >+ nge_start(ifp); >+ >+ if (sc->rxcycles > 0 || cmd == POLL_AND_CHECK_STATUS) { >+ u_int32_t status; >+ >+ /* Reading the ISR register clears all interrupts. */ >+ status = CSR_READ_4(sc, NGE_ISR); >+ >+ if (status & (NGE_ISR_RX_ERR|NGE_ISR_RX_OFLOW)) >+ nge_rxeof(sc); >+ >+ if (status & (NGE_ISR_RX_IDLE)) >+ NGE_SETBIT(sc, NGE_CSR, NGE_CSR_RX_ENABLE); >+ >+ if (status & NGE_ISR_SYSERR) { >+ nge_reset(sc); >+ nge_init(sc); >+ } >+ } >+ } >+ #endif /* DEVICE_POLLING */ >+ >+ >+ > static void nge_intr(arg) > void *arg; > { >*************** >*** 1594,1599 **** >--- 1650,1665 ---- > sc = arg; > ifp = &sc->arpcom.ac_if; > >+ #ifdef DEVICE_POLLING >+ if (ifp->if_ipending & IFF_POLLING) >+ return; >+ if (ether_poll_register(nge_poll, ifp)) { /* ok, disable interrupts */ >+ CSR_WRITE_4(sc, NGE_IER, 0); >+ nge_poll(ifp, 0, 1); >+ return; >+ } >+ #endif /* DEVICE_POLLING */ >+ > /* Supress unwanted interrupts */ > if (!(ifp->if_flags & IFF_UP)) { > nge_stop(sc); >*************** >*** 1957,1962 **** >--- 2023,2037 ---- > * Enable interrupts. > */ > CSR_WRITE_4(sc, NGE_IMR, NGE_INTRS); >+ #ifdef DEVICE_POLLING >+ /* >+ * ... only enable interrupts if we are not polling, make sure >+ * they are off otherwise. >+ */ >+ if (ifp->if_ipending & IFF_POLLING) >+ CSR_WRITE_4(sc, NGE_IER, 0); >+ else >+ #endif /* DEVICE_POLLING */ > CSR_WRITE_4(sc, NGE_IER, 1); > > /* Enable receiver and transmitter. */ >*************** >*** 2210,2215 **** >--- 2285,2293 ---- > } > > untimeout(nge_tick, sc, sc->nge_stat_ch); >+ #ifdef DEVICE_POLLING >+ ether_poll_deregister(ifp); >+ #endif > CSR_WRITE_4(sc, NGE_IER, 0); > CSR_WRITE_4(sc, NGE_IMR, 0); > NGE_SETBIT(sc, NGE_CSR, NGE_CSR_TX_DISABLE|NGE_CSR_RX_DISABLE);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 44772
: 26200 |
26201