Module Name: src Committed By: msaitoh Date: Tue Apr 9 07:23:41 UTC 2019
Modified Files: src/sys/dev/ic: gem.c Log Message: Fix a bug that media setting for fiber didn't work correctly. Not tested. The BUGS section in gem(4) manpage says: > BUGS (snip) > On the SX fibre variants of the hardware, the link will stay down if > there is a duplex mismatch. Also, packet transmission may fail when in > half-duplex mode. Is the bug related to this fix? To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/dev/ic/gem.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/ic/gem.c diff -u src/sys/dev/ic/gem.c:1.114 src/sys/dev/ic/gem.c:1.115 --- src/sys/dev/ic/gem.c:1.114 Tue Feb 5 06:17:02 2019 +++ src/sys/dev/ic/gem.c Tue Apr 9 07:23:41 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: gem.c,v 1.114 2019/02/05 06:17:02 msaitoh Exp $ */ +/* $NetBSD: gem.c,v 1.115 2019/04/09 07:23:41 msaitoh Exp $ */ /* * @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.114 2019/02/05 06:17:02 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.115 2019/04/09 07:23:41 msaitoh Exp $"); #include "opt_inet.h" @@ -1044,12 +1044,12 @@ gem_pcs_start(struct gem_softc *sc) bus_space_write_4(t, h, GEM_MII_CONFIG, 0); v = bus_space_read_4(t, h, GEM_MII_ANAR); v |= (GEM_MII_ANEG_SYM_PAUSE | GEM_MII_ANEG_ASYM_PAUSE); - if (sc->sc_mii_media == IFM_AUTO) + if (IFM_SUBTYPE(sc->sc_mii_media) == IFM_AUTO) v |= (GEM_MII_ANEG_FUL_DUPLX | GEM_MII_ANEG_HLF_DUPLX); - else if (sc->sc_mii_media == IFM_FDX) { + else if ((IFM_OPTIONS(sc->sc_mii_media) & IFM_FDX) != 0) { v |= GEM_MII_ANEG_FUL_DUPLX; v &= ~GEM_MII_ANEG_HLF_DUPLX; - } else if (sc->sc_mii_media == IFM_HDX) { + } else if ((IFM_OPTIONS(sc->sc_mii_media) & IFM_HDX) != 0) { v &= ~GEM_MII_ANEG_FUL_DUPLX; v |= GEM_MII_ANEG_HLF_DUPLX; }