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.
This commit is contained in:
msaitoh 2020-11-04 09:15:10 +00:00
parent 938a5fbe96
commit c8b8553e08
3 changed files with 7 additions and 10 deletions

View File

@ -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 @@ igphy_status(struct mii_softc *sc)
PHY_READ(sc, MII_BMCR, &bmcr);
if (bmcr & BMCR_ISO) {
mii->mii_media_active |= IFM_NONE;
mii->mii_media_status = 0;
return;
}

View File

@ -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 @@ ihphy_status(struct mii_softc *sc)
PHY_READ(sc, MII_BMCR, &bmcr);
if (bmcr & (BMCR_ISO | BMCR_PDOWN)) {
mii->mii_media_active |= IFM_NONE;
mii->mii_media_status = 0;
return;
}

View File

@ -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 @@ makphy_status(struct mii_softc *sc)
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;
}