mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-21 17:25:09 +00:00
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.
This commit is contained in:
parent
e21e2eea58
commit
73e7361eac
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=199538
|
@ -4642,8 +4642,9 @@ lmc_raw_output(struct ifnet *ifp, struct mbuf *m,
|
||||||
|
|
||||||
/* Called from a softirq once a second. */
|
/* Called from a softirq once a second. */
|
||||||
static void
|
static void
|
||||||
lmc_ifnet_watchdog(struct ifnet *ifp)
|
lmc_watchdog(void *arg)
|
||||||
{
|
{
|
||||||
|
struct ifnet *ifp = arg;
|
||||||
softc_t *sc = IFP2SC(ifp);
|
softc_t *sc = IFP2SC(ifp);
|
||||||
u_int8_t old_oper_status = sc->status.oper_status;
|
u_int8_t old_oper_status = sc->status.oper_status;
|
||||||
struct event_cntrs *cntrs = &sc->status.cntrs;
|
struct event_cntrs *cntrs = &sc->status.cntrs;
|
||||||
|
@ -4734,7 +4735,7 @@ lmc_ifnet_watchdog(struct ifnet *ifp)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Call this procedure again after one second. */
|
/* Call this procedure again after one second. */
|
||||||
ifp->if_timer = 1;
|
callout_reset(&sc->callout, hz, lmc_watchdog, ifp);
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef __OpenBSD__
|
# ifdef __OpenBSD__
|
||||||
|
@ -4822,8 +4823,6 @@ setup_ifnet(struct ifnet *ifp)
|
||||||
ifp->if_start = lmc_ifnet_start; /* sppp changes this */
|
ifp->if_start = lmc_ifnet_start; /* sppp changes this */
|
||||||
ifp->if_output = lmc_raw_output; /* sppp & p2p change this */
|
ifp->if_output = lmc_raw_output; /* sppp & p2p change this */
|
||||||
ifp->if_input = lmc_raw_input;
|
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_mtu = MAX_DESC_LEN; /* sppp & p2p change this */
|
||||||
ifp->if_type = IFT_PTPSERIAL; /* p2p changes this */
|
ifp->if_type = IFT_PTPSERIAL; /* p2p changes this */
|
||||||
|
|
||||||
|
@ -4917,6 +4916,8 @@ lmc_ifnet_attach(softc_t *sc)
|
||||||
}
|
}
|
||||||
# endif /* __OpenBSD__ */
|
# endif /* __OpenBSD__ */
|
||||||
|
|
||||||
|
callout_reset(&sc->callout, hz, lmc_watchdog, sc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5244,7 +5245,7 @@ ng_watchdog(void *arg)
|
||||||
sc->status.line_prot = 0;
|
sc->status.line_prot = 0;
|
||||||
|
|
||||||
/* Call this procedure again after one second. */
|
/* 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
|
# endif
|
||||||
|
|
||||||
|
@ -5301,16 +5302,9 @@ ng_attach(softc_t *sc)
|
||||||
IFQ_SET_MAXLEN(&sc->ng_sndq, SNDQ_MAXLEN);
|
IFQ_SET_MAXLEN(&sc->ng_sndq, SNDQ_MAXLEN);
|
||||||
IFQ_SET_READY(&sc->ng_sndq);
|
IFQ_SET_READY(&sc->ng_sndq);
|
||||||
|
|
||||||
/* If ifnet is present, it will call watchdog. */
|
|
||||||
/* Otherwise, arrange to call watchdog here. */
|
|
||||||
# if (IFNET == 0)
|
# if (IFNET == 0)
|
||||||
/* Arrange to call ng_watchdog() once a second. */
|
/* Arrange to call ng_watchdog() once a second. */
|
||||||
# if (__FreeBSD_version >= 500000)
|
callout_reset(&sc->callout, hz, ng_watchdog, sc);
|
||||||
callout_init(&sc->ng_callout, 0);
|
|
||||||
# else /* FreeBSD-4 */
|
|
||||||
callout_init(&sc->ng_callout);
|
|
||||||
# endif
|
|
||||||
callout_reset(&sc->ng_callout, hz, ng_watchdog, sc);
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -5319,9 +5313,7 @@ ng_attach(softc_t *sc)
|
||||||
static void
|
static void
|
||||||
ng_detach(softc_t *sc)
|
ng_detach(softc_t *sc)
|
||||||
{
|
{
|
||||||
# if (IFNET == 0)
|
callout_drain(&sc->callout);
|
||||||
callout_stop(&sc->ng_callout);
|
|
||||||
# endif
|
|
||||||
# if (__FreeBSD_version >= 500000)
|
# if (__FreeBSD_version >= 500000)
|
||||||
mtx_destroy(&sc->ng_sndq.ifq_mtx);
|
mtx_destroy(&sc->ng_sndq.ifq_mtx);
|
||||||
mtx_destroy(&sc->ng_fastq.ifq_mtx);
|
mtx_destroy(&sc->ng_fastq.ifq_mtx);
|
||||||
|
@ -5493,6 +5485,12 @@ attach_card(softc_t *sc, const char *intrstr)
|
||||||
/* Start the card. */
|
/* Start the card. */
|
||||||
if ((error = startup_card(sc))) return error;
|
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. */
|
/* Attach a kernel interface. */
|
||||||
#if NETGRAPH
|
#if NETGRAPH
|
||||||
if ((error = ng_attach(sc))) return error;
|
if ((error = ng_attach(sc))) return error;
|
||||||
|
|
|
@ -1140,7 +1140,6 @@ struct softc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if NETGRAPH
|
#if NETGRAPH
|
||||||
struct callout ng_callout; /* ng_watchdog needs this */
|
|
||||||
node_p ng_node; /* pointer to our node struct */
|
node_p ng_node; /* pointer to our node struct */
|
||||||
hook_p ng_hook; /* non-zero means NETGRAPH owns device */
|
hook_p ng_hook; /* non-zero means NETGRAPH owns device */
|
||||||
# if (__FreeBSD_version >= 503000)
|
# if (__FreeBSD_version >= 503000)
|
||||||
|
@ -1153,6 +1152,7 @@ struct softc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
|
struct callout callout; /* watchdog needs this */
|
||||||
struct device *dev; /* base device pointer */
|
struct device *dev; /* base device pointer */
|
||||||
bus_space_tag_t csr_tag; /* bus_space needs this */
|
bus_space_tag_t csr_tag; /* bus_space needs this */
|
||||||
bus_space_handle_t csr_handle;/* 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 void lmc_ifnet_start(struct ifnet *);
|
||||||
static int lmc_raw_output(struct ifnet *, struct mbuf *,
|
static int lmc_raw_output(struct ifnet *, struct mbuf *,
|
||||||
struct sockaddr *, struct route *);
|
struct sockaddr *, struct route *);
|
||||||
static void lmc_ifnet_watchdog(struct ifnet *);
|
|
||||||
# ifdef __OpenBSD__
|
# ifdef __OpenBSD__
|
||||||
static int ifmedia_change(struct ifnet *);
|
static int ifmedia_change(struct ifnet *);
|
||||||
static void ifmedia_status(struct ifnet *, struct ifmediareq *);
|
static void ifmedia_status(struct ifnet *, struct ifmediareq *);
|
||||||
|
|
Loading…
Reference in a new issue