summaryrefslogtreecommitdiffstats
path: root/sys/dev/lge/if_lge.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-11-19 22:14:23 +0000
committerjhb <jhb@FreeBSD.org>2009-11-19 22:14:23 +0000
commit3593f855442b4c99d0bb2e5e2240edc25e4a9de9 (patch)
tree56a1666c810529df49b7c20e9c73407f13a80405 /sys/dev/lge/if_lge.c
parentaffabaa85e18565f9c0a68b33c5b0f2e0587f05a (diff)
downloadFreeBSD-src-3593f855442b4c99d0bb2e5e2240edc25e4a9de9.zip
FreeBSD-src-3593f855442b4c99d0bb2e5e2240edc25e4a9de9.tar.gz
- Hook into the existing stat timer to drive the transmit watchdog instead
of using if_watchdog and if_timer. - Reorder detach to call ether_ifdetach() before anything else in tl(4) and wb(4).
Diffstat (limited to 'sys/dev/lge/if_lge.c')
-rw-r--r--sys/dev/lge/if_lge.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c
index 79a9156..b870bf0 100644
--- a/sys/dev/lge/if_lge.c
+++ b/sys/dev/lge/if_lge.c
@@ -137,7 +137,7 @@ static int lge_ioctl(struct ifnet *, u_long, caddr_t);
static void lge_init(void *);
static void lge_init_locked(struct lge_softc *);
static void lge_stop(struct lge_softc *);
-static void lge_watchdog(struct ifnet *);
+static void lge_watchdog(struct lge_softc *);
static int lge_shutdown(device_t);
static int lge_ifmedia_upd(struct ifnet *);
static void lge_ifmedia_upd_locked(struct ifnet *);
@@ -544,7 +544,6 @@ lge_attach(dev)
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = lge_ioctl;
ifp->if_start = lge_start;
- ifp->if_watchdog = lge_watchdog;
ifp->if_init = lge_init;
ifp->if_snd.ifq_maxlen = LGE_TX_LIST_CNT - 1;
ifp->if_capabilities = IFCAP_RXCSUM;
@@ -1000,7 +999,7 @@ lge_txeof(sc)
ifp = sc->lge_ifp;
/* Clear the timeout timer. */
- ifp->if_timer = 0;
+ sc->lge_timer = 0;
/*
* Go through our tx list and free mbufs for those
@@ -1021,7 +1020,7 @@ lge_txeof(sc)
txdone--;
LGE_INC(idx, LGE_TX_LIST_CNT);
- ifp->if_timer = 0;
+ sc->lge_timer = 0;
}
sc->lge_cdata.lge_tx_cons = idx;
@@ -1064,6 +1063,8 @@ lge_tick(xsc)
}
}
+ if (sc->lge_timer != 0 && --sc->lge_timer == 0)
+ lge_watchdog(sc);
callout_reset(&sc->lge_stat_callout, hz, lge_tick, sc);
return;
@@ -1236,7 +1237,7 @@ lge_start_locked(ifp)
/*
* Set a timeout in case the chip goes out to lunch.
*/
- ifp->if_timer = 5;
+ sc->lge_timer = 5;
return;
}
@@ -1506,14 +1507,14 @@ lge_ioctl(ifp, command, data)
}
static void
-lge_watchdog(ifp)
- struct ifnet *ifp;
-{
+lge_watchdog(sc)
struct lge_softc *sc;
+{
+ struct ifnet *ifp;
- sc = ifp->if_softc;
+ LGE_LOCK_ASSERT(sc);
+ ifp = sc->lge_ifp;
- LGE_LOCK(sc);
ifp->if_oerrors++;
if_printf(ifp, "watchdog timeout\n");
@@ -1524,9 +1525,6 @@ lge_watchdog(ifp)
if (ifp->if_snd.ifq_head != NULL)
lge_start_locked(ifp);
- LGE_UNLOCK(sc);
-
- return;
}
/*
@@ -1542,7 +1540,7 @@ lge_stop(sc)
LGE_LOCK_ASSERT(sc);
ifp = sc->lge_ifp;
- ifp->if_timer = 0;
+ sc->lge_timer = 0;
callout_stop(&sc->lge_stat_callout);
CSR_WRITE_4(sc, LGE_IMR, LGE_IMR_INTR_ENB);
OpenPOWER on IntegriCloud