Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii Fix a bug that "ifconfig xx0 media none" set LIN...



details:   https://anonhg.NetBSD.org/src/rev/5e3abee7a335
branches:  trunk
changeset: 1015932:5e3abee7a335
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Nov 04 09:15:10 2020 +0000

description:
Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.

diffstat:

 sys/dev/mii/igphy.c  |  5 ++---
 sys/dev/mii/ihphy.c  |  5 ++---
 sys/dev/mii/makphy.c |  7 +++----
 3 files changed, 7 insertions(+), 10 deletions(-)

diffs (81 lines):

diff -r c9a46add3026 -r 5e3abee7a335 sys/dev/mii/igphy.c
--- a/sys/dev/mii/igphy.c       Wed Nov 04 07:51:08 2020 +0000
+++ b/sys/dev/mii/igphy.c       Wed Nov 04 09:15:10 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: igphy.c,v 1.36 2020/08/03 07:25:59 msaitoh Exp $       */
+/*     $NetBSD: igphy.c,v 1.37 2020/11/04 09:15:10 msaitoh Exp $       */
 
 /*
  * The Intel copyright applies to the analog register setup, and the
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.36 2020/08/03 07:25:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.37 2020/11/04 09:15:10 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mii.h"
@@ -437,7 +437,6 @@
        PHY_READ(sc, MII_BMCR, &bmcr);
        if (bmcr & BMCR_ISO) {
                mii->mii_media_active |= IFM_NONE;
-               mii->mii_media_status = 0;
                return;
        }
 
diff -r c9a46add3026 -r 5e3abee7a335 sys/dev/mii/ihphy.c
--- a/sys/dev/mii/ihphy.c       Wed Nov 04 07:51:08 2020 +0000
+++ b/sys/dev/mii/ihphy.c       Wed Nov 04 09:15:10 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ihphy.c,v 1.18 2020/03/28 18:37:18 thorpej Exp $       */
+/*     $NetBSD: ihphy.c,v 1.19 2020/11/04 09:15:10 msaitoh Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.18 2020/03/28 18:37:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.19 2020/11/04 09:15:10 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -242,7 +242,6 @@
        PHY_READ(sc, MII_BMCR, &bmcr);
        if (bmcr & (BMCR_ISO | BMCR_PDOWN)) {
                mii->mii_media_active |= IFM_NONE;
-               mii->mii_media_status = 0;
                return;
        }
 
diff -r c9a46add3026 -r 5e3abee7a335 sys/dev/mii/makphy.c
--- a/sys/dev/mii/makphy.c      Wed Nov 04 07:51:08 2020 +0000
+++ b/sys/dev/mii/makphy.c      Wed Nov 04 09:15:10 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: makphy.c,v 1.67 2020/10/20 08:53:34 msaitoh Exp $      */
+/*     $NetBSD: makphy.c,v 1.68 2020/11/04 09:15:10 msaitoh Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.67 2020/10/20 08:53:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.68 2020/11/04 09:15:10 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -436,9 +436,8 @@
        if (bmcr & BMCR_LOOP)
                mii->mii_media_active |= IFM_LOOP;
 
-       if (bmcr & BMCR_ISO) {
+       if (bmcr & (BMCR_ISO | BMCR_PDOWN)) {
                mii->mii_media_active |= IFM_NONE;
-               mii->mii_media_status = 0;
                return;
        }
 



Home | Main Index | Thread Index | Old Index