From f8dd9c11165f53f7fea9d09c39605c5a6b11d37d Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 13 Apr 2002 21:33:33 +0000 Subject: [PATCH] If the receiver runs out of space for an received frame in the internal FIFO or the in-RAM descriptors it will switch to RX_IDLE from where it is not restarted. We used to deal with RX_IDLE by doing a total reinit but this lost our link and caused a potential 30sec autonegotiation against switches. This was changed to a less heavyhanded approach, but this failed to restart the receiver it it were in the RX_IDLE state. This change adds the RX_IDLE and the RX_FIFO_OFLOW conditions as triggers for interrupts and receive side processing, and restarts the receiver when it is RX_IDLE. Remove the #ifdef notyet'ed nge_rxeoc() function. Sponsored by: Cybercity Internet, Denmark. MFC after: 7 days --- sys/dev/nge/if_nge.c | 27 ++++++--------------------- sys/dev/nge/if_ngereg.h | 3 ++- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c index 32b1752aea5d..77b00347a73f 100644 --- a/sys/dev/nge/if_nge.c +++ b/sys/dev/nge/if_nge.c @@ -160,9 +160,6 @@ static int nge_newbuf (struct nge_softc *, static int nge_encap (struct nge_softc *, struct mbuf *, u_int32_t *); static void nge_rxeof (struct nge_softc *); -#ifdef notdef -static void nge_rxeoc (struct nge_softc *); -#endif static void nge_txeof (struct nge_softc *); static void nge_intr (void *); static void nge_tick (void *); @@ -1348,20 +1345,6 @@ static void nge_rxeof(sc) return; } -#ifdef notdef -void nge_rxeoc(sc) - struct nge_softc *sc; -{ - struct ifnet *ifp; - - ifp = &sc->arpcom.ac_if; - nge_rxeof(sc); - ifp->if_flags &= ~IFF_RUNNING; - nge_init(sc); - return; -} -#endif - /* * A frame was downloaded to the chip. It's safe for us to clean up * the list buffers. @@ -1496,12 +1479,14 @@ static void nge_intr(arg) if ((status & NGE_ISR_RX_DESC_OK) || (status & NGE_ISR_RX_ERR) || (status & NGE_ISR_RX_OFLOW) || + (status & NGE_ISR_RX_FIFO_OFLOW) || + (status & NGE_ISR_RX_IDLE) || (status & NGE_ISR_RX_OK)) nge_rxeof(sc); -#ifdef notdef - if ((status & NGE_ISR_RX_OFLOW)) - nge_rxeoc(sc); -#endif + + if ((status & NGE_ISR_RX_IDLE)) + NGE_SETBIT(sc, NGE_CSR, NGE_CSR_RX_ENABLE); + if (status & NGE_ISR_SYSERR) { nge_reset(sc); ifp->if_flags &= ~IFF_RUNNING; diff --git a/sys/dev/nge/if_ngereg.h b/sys/dev/nge/if_ngereg.h index f10590e2c883..e5292457dc74 100644 --- a/sys/dev/nge/if_ngereg.h +++ b/sys/dev/nge/if_ngereg.h @@ -226,7 +226,8 @@ #define NGE_INTRS \ (NGE_IMR_RX_OFLOW|NGE_IMR_TX_UFLOW|NGE_IMR_TX_OK|\ NGE_IMR_TX_IDLE|NGE_IMR_RX_OK|NGE_IMR_RX_ERR|\ - NGE_IMR_SYSERR|NGE_IMR_PHY_INTR) + NGE_IMR_SYSERR|NGE_IMR_PHY_INTR|\ + NGE_IMR_RX_IDLE|NGE_IMR_RX_FIFO_OFLOW) /* Interrupt enable register */ #define NGE_IER_INTRENB 0x00000001