Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Fix a bug that media setting for fiber didn't wor...



details:   https://anonhg.NetBSD.org/src/rev/0394eb4cabd5
branches:  trunk
changeset: 998153:0394eb4cabd5
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Apr 09 07:23:41 2019 +0000

description:
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?

diffstat:

 sys/dev/ic/gem.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r 7943c8598857 -r 0394eb4cabd5 sys/dev/ic/gem.c
--- a/sys/dev/ic/gem.c  Tue Apr 09 06:19:34 2019 +0000
+++ b/sys/dev/ic/gem.c  Tue Apr 09 07:23:41 2019 +0000
@@ -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 @@
        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;
        }



Home | Main Index | Thread Index | Old Index