Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/sys/dev/pci Pull up following revision(s) (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/d0868d9d3600
branches:  netbsd-6
changeset: 776362:d0868d9d3600
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Jun 13 07:40:24 2013 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #898):
        sys/dev/pci/if_alc.c: revision 1.7
avoid illegal sleeps in the softint routine.
XXX could probably do better by creating a watchdog thread.

diffstat:

 sys/dev/pci/if_alc.c |  30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)

diffs (122 lines):

diff -r e522591f581b -r d0868d9d3600 sys/dev/pci/if_alc.c
--- a/sys/dev/pci/if_alc.c      Thu Jun 13 07:30:45 2013 +0000
+++ b/sys/dev/pci/if_alc.c      Thu Jun 13 07:40:24 2013 +0000
@@ -103,6 +103,7 @@
 static int     alc_detach(device_t, int);
 
 static int     alc_init(struct ifnet *);
+static int     alc_init_backend(struct ifnet *, bool);
 static void    alc_start(struct ifnet *);
 static int     alc_ioctl(struct ifnet *, u_long, void *);
 static void    alc_watchdog(struct ifnet *);
@@ -119,7 +120,7 @@
 static void    alc_get_macaddr(struct alc_softc *);
 static void    alc_init_cmb(struct alc_softc *);
 static void    alc_init_rr_ring(struct alc_softc *);
-static int     alc_init_rx_ring(struct alc_softc *);
+static int     alc_init_rx_ring(struct alc_softc *, bool);
 static void    alc_init_smb(struct alc_softc *);
 static void    alc_init_tx_ring(struct alc_softc *);
 static int     alc_intr(void *);
@@ -127,7 +128,7 @@
 static int     alc_miibus_readreg(device_t, int, int);
 static void    alc_miibus_statchg(device_t);
 static void    alc_miibus_writereg(device_t, int, int, int);
-static int     alc_newbuf(struct alc_softc *, struct alc_rxdesc *, int);
+static int     alc_newbuf(struct alc_softc *, struct alc_rxdesc *, bool);
 static void    alc_phy_down(struct alc_softc *);
 static void    alc_phy_reset(struct alc_softc *);
 static void    alc_reset(struct alc_softc *);
@@ -1445,13 +1446,13 @@
                printf("%s: watchdog timeout (missed link)\n",
                    device_xname(sc->sc_dev));
                ifp->if_oerrors++;
-               alc_init(ifp);
+               alc_init_backend(ifp, false);
                return;
        }
 
        printf("%s: watchdog timeout\n", device_xname(sc->sc_dev));
        ifp->if_oerrors++;
-       alc_init(ifp);
+       alc_init_backend(ifp, false);
 
        if (!IFQ_IS_EMPTY(&ifp->if_snd))
                 alc_start(ifp);
@@ -1681,7 +1682,7 @@
 
                        error = alc_rxintr(sc);
                        if (error) {
-                               alc_init(ifp);
+                               alc_init_backend(ifp, false);
                                return (0);
                        }
                }
@@ -1697,7 +1698,7 @@
                        if (status & INTR_TXQ_TO_RST)
                                printf("%s: TxQ reset! -- resetting\n",
                                    device_xname(sc->sc_dev));
-                       alc_init(ifp);
+                       alc_init_backend(ifp, false);
                        return (0);
                }
 
@@ -1768,7 +1769,7 @@
 }
 
 static int
-alc_newbuf(struct alc_softc *sc, struct alc_rxdesc *rxd, int init)
+alc_newbuf(struct alc_softc *sc, struct alc_rxdesc *rxd, bool init)
 {
        struct mbuf *m;
        bus_dmamap_t map;
@@ -1923,7 +1924,7 @@
                rxd = &sc->alc_cdata.alc_rxdesc[rx_cons];
                mp = rxd->rx_m;
                /* Add a new receive buffer to the ring. */
-               if (alc_newbuf(sc, rxd, 0) != 0) {
+               if (alc_newbuf(sc, rxd, false) != 0) {
                        ifp->if_iqdrops++;
                        /* Reuse Rx buffers. */
                        if (sc->alc_cdata.alc_rxhead != NULL)
@@ -2047,6 +2048,13 @@
 static int
 alc_init(struct ifnet *ifp)
 {
+       
+       return alc_init_backend(ifp, true);
+}
+
+static int
+alc_init_backend(struct ifnet *ifp, bool init)
+{
        struct alc_softc *sc = ifp->if_softc;
        struct mii_data *mii;
        uint8_t eaddr[ETHER_ADDR_LEN];
@@ -2064,7 +2072,7 @@
        alc_reset(sc);
 
        /* Initialize Rx descriptors. */
-       error = alc_init_rx_ring(sc);
+       error = alc_init_rx_ring(sc, init);
        if (error != 0) {
                printf("%s: no memory for Rx buffers.\n", device_xname(sc->sc_dev));
                alc_stop(ifp, 0);
@@ -2517,7 +2525,7 @@
 }
 
 static int
-alc_init_rx_ring(struct alc_softc *sc)
+alc_init_rx_ring(struct alc_softc *sc, bool init)
 {
        struct alc_ring_data *rd;
        struct alc_rxdesc *rxd;
@@ -2530,7 +2538,7 @@
                rxd = &sc->alc_cdata.alc_rxdesc[i];
                rxd->rx_m = NULL;
                rxd->rx_desc = &rd->alc_rx_ring[i];
-               if (alc_newbuf(sc, rxd, 1) != 0)
+               if (alc_newbuf(sc, rxd, init) != 0)
                        return (ENOBUFS);
        }
 



Home | Main Index | Thread Index | Old Index