summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-11-19 18:21:51 +0000
committerjhb <jhb@FreeBSD.org>2009-11-19 18:21:51 +0000
commit4ba3c79b59a632c50b603118ca52aa1141c73e20 (patch)
tree7d4ac6df6f2bcf8cafe98b7d4e597d7c69c708cb
parent680691ac7237fea5f2e6b3085a067e698eba44ee (diff)
downloadFreeBSD-src-4ba3c79b59a632c50b603118ca52aa1141c73e20.zip
FreeBSD-src-4ba3c79b59a632c50b603118ca52aa1141c73e20.tar.gz
This driver has two modes, a netgraph mode and an ifnet mode. In the
netgraph mode it used a private timer to drive the transmit watchdog. In the ifnet mode it used if_watchdog. Now it always uses the private timer.
-rw-r--r--sys/dev/lmc/if_lmc.c30
-rw-r--r--sys/dev/lmc/if_lmc.h3
2 files changed, 15 insertions, 18 deletions
diff --git a/sys/dev/lmc/if_lmc.c b/sys/dev/lmc/if_lmc.c
index e03f33c..23f6da9 100644
--- a/sys/dev/lmc/if_lmc.c
+++ b/sys/dev/lmc/if_lmc.c
@@ -4642,8 +4642,9 @@ lmc_raw_output(struct ifnet *ifp, struct mbuf *m,
/* Called from a softirq once a second. */
static void
-lmc_ifnet_watchdog(struct ifnet *ifp)
+lmc_watchdog(void *arg)
{
+ struct ifnet *ifp = arg;
softc_t *sc = IFP2SC(ifp);
u_int8_t old_oper_status = sc->status.oper_status;
struct event_cntrs *cntrs = &sc->status.cntrs;
@@ -4734,7 +4735,7 @@ lmc_ifnet_watchdog(struct ifnet *ifp)
# endif
/* Call this procedure again after one second. */
- ifp->if_timer = 1;
+ callout_reset(&sc->callout, hz, lmc_watchdog, ifp);
}
# ifdef __OpenBSD__
@@ -4822,8 +4823,6 @@ setup_ifnet(struct ifnet *ifp)
ifp->if_start = lmc_ifnet_start; /* sppp changes this */
ifp->if_output = lmc_raw_output; /* sppp & p2p change this */
ifp->if_input = lmc_raw_input;
- ifp->if_watchdog = lmc_ifnet_watchdog;
- ifp->if_timer = 1;
ifp->if_mtu = MAX_DESC_LEN; /* sppp & p2p change this */
ifp->if_type = IFT_PTPSERIAL; /* p2p changes this */
@@ -4917,6 +4916,8 @@ lmc_ifnet_attach(softc_t *sc)
}
# endif /* __OpenBSD__ */
+ callout_reset(&sc->callout, hz, lmc_watchdog, sc);
+
return 0;
}
@@ -5244,7 +5245,7 @@ ng_watchdog(void *arg)
sc->status.line_prot = 0;
/* Call this procedure again after one second. */
- callout_reset(&sc->ng_callout, hz, ng_watchdog, sc);
+ callout_reset(&sc->callout, hz, ng_watchdog, sc);
}
# endif
@@ -5301,16 +5302,9 @@ ng_attach(softc_t *sc)
IFQ_SET_MAXLEN(&sc->ng_sndq, SNDQ_MAXLEN);
IFQ_SET_READY(&sc->ng_sndq);
- /* If ifnet is present, it will call watchdog. */
- /* Otherwise, arrange to call watchdog here. */
# if (IFNET == 0)
/* Arrange to call ng_watchdog() once a second. */
-# if (__FreeBSD_version >= 500000)
- callout_init(&sc->ng_callout, 0);
-# else /* FreeBSD-4 */
- callout_init(&sc->ng_callout);
-# endif
- callout_reset(&sc->ng_callout, hz, ng_watchdog, sc);
+ callout_reset(&sc->callout, hz, ng_watchdog, sc);
# endif
return 0;
@@ -5319,9 +5313,7 @@ ng_attach(softc_t *sc)
static void
ng_detach(softc_t *sc)
{
-# if (IFNET == 0)
- callout_stop(&sc->ng_callout);
-# endif
+ callout_drain(&sc->callout);
# if (__FreeBSD_version >= 500000)
mtx_destroy(&sc->ng_sndq.ifq_mtx);
mtx_destroy(&sc->ng_fastq.ifq_mtx);
@@ -5493,6 +5485,12 @@ attach_card(softc_t *sc, const char *intrstr)
/* Start the card. */
if ((error = startup_card(sc))) return error;
+# if (__FreeBSD_version >= 500000)
+ callout_init(&sc->callout, 0);
+# else /* FreeBSD-4 */
+ callout_init(&sc->callout);
+# endif
+
/* Attach a kernel interface. */
#if NETGRAPH
if ((error = ng_attach(sc))) return error;
diff --git a/sys/dev/lmc/if_lmc.h b/sys/dev/lmc/if_lmc.h
index fb34e03..0212f51 100644
--- a/sys/dev/lmc/if_lmc.h
+++ b/sys/dev/lmc/if_lmc.h
@@ -1140,7 +1140,6 @@ struct softc
#endif
#if NETGRAPH
- struct callout ng_callout; /* ng_watchdog needs this */
node_p ng_node; /* pointer to our node struct */
hook_p ng_hook; /* non-zero means NETGRAPH owns device */
# if (__FreeBSD_version >= 503000)
@@ -1153,6 +1152,7 @@ struct softc
#endif
#ifdef __FreeBSD__
+ struct callout callout; /* watchdog needs this */
struct device *dev; /* base device pointer */
bus_space_tag_t csr_tag; /* bus_space needs this */
bus_space_handle_t csr_handle;/* bus_space_needs this */
@@ -1596,7 +1596,6 @@ static int lmc_ifnet_ioctl(struct ifnet *, u_long, caddr_t);
static void lmc_ifnet_start(struct ifnet *);
static int lmc_raw_output(struct ifnet *, struct mbuf *,
struct sockaddr *, struct route *);
-static void lmc_ifnet_watchdog(struct ifnet *);
# ifdef __OpenBSD__
static int ifmedia_change(struct ifnet *);
static void ifmedia_status(struct ifnet *, struct ifmediareq *);
OpenPOWER on IntegriCloud