Module Name: src Committed By: martin Date: Tue Feb 19 14:51:25 UTC 2019
Modified Files: src/sys/dev/usb [netbsd-8]: if_axen.c Log Message: Pull up following revision(s) (requested by rin in ticket #1190): sys/dev/usb/if_axen.c: revision 1.21 sys/dev/usb/if_axen.c: revision 1.22 Enable AXEN_RXCTL_START bit only when RX is ready. Otherwise, the adapter eventually falls into "no carrier" state while it is not running. In axen_tick_task(), call axen_miibus_statchg() when link is lost (like other drivers). Otherwise, link can be lost forever, which results in sysmtem freeze. Drop AXEN_MEDIUM_ALWAYS_ONE (from Linux), which reduces drop erros in RX. To generate a diff of this commit: cvs rdiff -u -r1.11.8.3 -r1.11.8.4 src/sys/dev/usb/if_axen.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/usb/if_axen.c diff -u src/sys/dev/usb/if_axen.c:1.11.8.3 src/sys/dev/usb/if_axen.c:1.11.8.4 --- src/sys/dev/usb/if_axen.c:1.11.8.3 Thu Feb 7 06:14:34 2019 +++ src/sys/dev/usb/if_axen.c Tue Feb 19 14:51:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_axen.c,v 1.11.8.3 2019/02/07 06:14:34 msaitoh Exp $ */ +/* $NetBSD: if_axen.c,v 1.11.8.4 2019/02/19 14:51:24 martin Exp $ */ /* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */ /* @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.11.8.3 2019/02/07 06:14:34 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.11.8.4 2019/02/19 14:51:24 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -587,7 +587,6 @@ axen_ax88179_init(struct axen_softc *sc) /* Set RX control register */ ctl = AXEN_RXCTL_IPE | AXEN_RXCTL_DROPCRCERR | AXEN_RXCTL_AUTOB; ctl |= AXEN_RXCTL_ACPT_PHY_MCAST | AXEN_RXCTL_ACPT_ALL_MCAST; - ctl |= AXEN_RXCTL_START; wval = htole16(ctl); axen_cmd(sc, AXEN_CMD_MAC_WRITE2, 2, AXEN_MAC_RXCTL, &wval); @@ -1212,15 +1211,8 @@ axen_tick_task(void *xsc) s = splnet(); mii_tick(mii); - if (sc->axen_link == 0 && - (mii->mii_media_status & IFM_ACTIVE) != 0 && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - DPRINTF(("%s: %s: got link\n", device_xname(sc->axen_dev), - __func__)); - sc->axen_link++; - if (!IFQ_IS_EMPTY(&ifp->if_snd)) - axen_start(ifp); - } + if (sc->axen_link == 0) + axen_miibus_statchg(ifp); callout_schedule(&sc->axen_stat_ch, hz); @@ -1479,9 +1471,19 @@ axen_stop(struct ifnet *ifp, int disable struct axen_softc *sc = ifp->if_softc; usbd_status err; int i; + uint16_t rxmode, wval; axen_reset(sc); + /* Disable receiver, set RX mode */ + axen_lock_mii(sc); + axen_cmd(sc, AXEN_CMD_MAC_READ2, 2, AXEN_MAC_RXCTL, &wval); + rxmode = le16toh(wval); + rxmode &= ~AXEN_RXCTL_START; + wval = htole16(rxmode); + axen_cmd(sc, AXEN_CMD_MAC_WRITE2, 2, AXEN_MAC_RXCTL, &wval); + axen_unlock_mii(sc); + ifp->if_timer = 0; ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);