From 6b35712a03f28d0a3d84776c189e40dceb27fbdf Mon Sep 17 00:00:00 2001 From: msaitoh Date: Tue, 11 Jun 2013 07:22:07 +0000 Subject: [PATCH] Update link status quickly. This change is a part of mii_physubr.c rev. 1.77-1.78. --- sys/dev/mii/ciphy.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sys/dev/mii/ciphy.c b/sys/dev/mii/ciphy.c index 83a432600d07..fcc7362d509e 100644 --- a/sys/dev/mii/ciphy.c +++ b/sys/dev/mii/ciphy.c @@ -1,4 +1,4 @@ -/* $NetBSD: ciphy.c,v 1.23 2013/06/09 09:31:32 msaitoh Exp $ */ +/* $NetBSD: ciphy.c,v 1.24 2013/06/11 07:22:08 msaitoh Exp $ */ /*- * Copyright (c) 2004 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.23 2013/06/09 09:31:32 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.24 2013/06/11 07:22:08 msaitoh Exp $"); /* * Driver for the Cicada CS8201 10/100/1000 copper PHY. @@ -283,10 +283,18 @@ setit: break; } + /* + * mii_ticks == 0 means it's the first tick after changing the + * media or the link became down since the last tick + * (see above), so return with 0 to update the status. + */ + if (sc->mii_ticks++ == 0) + break; + /* * Only retry autonegotiation every N seconds. */ - if (++sc->mii_ticks <= MII_ANEGTICKS_GIGE) + if (sc->mii_ticks <= MII_ANEGTICKS_GIGE) break; mii_phy_auto(sc, 0);