From owner-svn-src-head@FreeBSD.ORG Thu Nov 19 18:21:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 754F81065670; Thu, 19 Nov 2009 18:21:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 648488FC0C; Thu, 19 Nov 2009 18:21:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJILpQN014637; Thu, 19 Nov 2009 18:21:51 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJILpZ6014634; Thu, 19 Nov 2009 18:21:51 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200911191821.nAJILpZ6014634@svn.freebsd.org> From: John Baldwin Date: Thu, 19 Nov 2009 18:21:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199538 - head/sys/dev/lmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2009 18:21:51 -0000 Author: jhb Date: Thu Nov 19 18:21:51 2009 New Revision: 199538 URL: http://svn.freebsd.org/changeset/base/199538 Log: 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. Modified: head/sys/dev/lmc/if_lmc.c head/sys/dev/lmc/if_lmc.h Modified: head/sys/dev/lmc/if_lmc.c ============================================================================== --- head/sys/dev/lmc/if_lmc.c Thu Nov 19 18:11:23 2009 (r199537) +++ head/sys/dev/lmc/if_lmc.c Thu Nov 19 18:21:51 2009 (r199538) @@ -4642,8 +4642,9 @@ lmc_raw_output(struct ifnet *ifp, struct /* 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 *int /* 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; Modified: head/sys/dev/lmc/if_lmc.h ============================================================================== --- head/sys/dev/lmc/if_lmc.h Thu Nov 19 18:11:23 2009 (r199537) +++ head/sys/dev/lmc/if_lmc.h Thu Nov 19 18:21:51 2009 (r199538) @@ -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 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 *);