Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/mii Keep the change check invariant intact. The prev...
details: https://anonhg.NetBSD.org/src/rev/4b51e3e15f5c
branches: trunk
changeset: 937720:4b51e3e15f5c
user: kardel <kardel%NetBSD.org@localhost>
date: Mon Aug 24 12:46:04 2020 +0000
description:
Keep the change check invariant intact. The previous code could miss
status updates by picking up a new status different from the tested
status. This left addresses in the DETACHED state although the
link status is already UP again.
addresses PR/kern 55538
diffstat:
sys/dev/mii/mii_physubr.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diffs (45 lines):
diff -r db0c4fc4125a -r 4b51e3e15f5c sys/dev/mii/mii_physubr.c
--- a/sys/dev/mii/mii_physubr.c Mon Aug 24 12:45:48 2020 +0000
+++ b/sys/dev/mii/mii_physubr.c Mon Aug 24 12:46:04 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mii_physubr.c,v 1.92 2020/08/24 04:23:41 msaitoh Exp $ */
+/* $NetBSD: mii_physubr.c,v 1.93 2020/08/24 12:46:04 kardel Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.92 2020/08/24 04:23:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.93 2020/08/24 12:46:04 kardel Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -440,16 +440,21 @@
mii_phy_update(struct mii_softc *sc, int cmd)
{
struct mii_data *mii = sc->mii_pdata;
+ u_int mii_media_active;
+ int mii_media_status;
KASSERT(mii_locked(mii));
- if (sc->mii_media_active != mii->mii_media_active ||
- sc->mii_media_status != mii->mii_media_status ||
+ mii_media_active = mii->mii_media_active;
+ mii_media_status = mii->mii_media_status;
+
+ if (sc->mii_media_active != mii_media_active ||
+ sc->mii_media_status != mii_media_status ||
cmd == MII_MEDIACHG) {
+ (*mii->mii_statchg)(mii->mii_ifp);
+ sc->mii_media_active = mii_media_active;
+ sc->mii_media_status = mii_media_status;
mii_phy_statusmsg(sc);
- (*mii->mii_statchg)(mii->mii_ifp);
- sc->mii_media_active = mii->mii_media_active;
- sc->mii_media_status = mii->mii_media_status;
}
}
Home |
Main Index |
Thread Index |
Old Index