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 the auto negotiation timer isn't ...



details:   https://anonhg.NetBSD.org/src/rev/97ea79cda9ba
branches:  trunk
changeset: 787214:97ea79cda9ba
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Jun 06 03:10:48 2013 +0000

description:
Fix a bug that the auto negotiation timer isn't cleard as we expected.
To not to forget clearing the timer and to reduce the code duplication,
clear mii_ticks in *mii_phy_auto().

diffstat:

 sys/dev/mii/atphy.c       |  6 +++---
 sys/dev/mii/brgphy.c      |  5 +++--
 sys/dev/mii/ciphy.c       |  5 ++---
 sys/dev/mii/mii_physubr.c |  6 +++---
 sys/dev/mii/rgephy.c      |  6 +++---
 sys/dev/mii/urlphy.c      |  5 ++---
 6 files changed, 16 insertions(+), 17 deletions(-)

diffs (180 lines):

diff -r 907d083c8365 -r 97ea79cda9ba sys/dev/mii/atphy.c
--- a/sys/dev/mii/atphy.c       Thu Jun 06 02:00:59 2013 +0000
+++ b/sys/dev/mii/atphy.c       Thu Jun 06 03:10:48 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atphy.c,v 1.12 2012/07/23 00:09:49 matt Exp $ */
+/*     $NetBSD: atphy.c,v 1.13 2013/06/06 03:10:48 msaitoh Exp $ */
 /*     $OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $  */
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.12 2012/07/23 00:09:49 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.13 2013/06/06 03:10:48 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -289,7 +289,6 @@
                if (sc->mii_ticks <= sc->mii_anegticks)
                        break;
 
-               sc->mii_ticks = 0;
                atphy_mii_phy_auto(sc);
                break;
        }
@@ -405,6 +404,7 @@
 {
        uint16_t anar;
 
+       sc->mii_ticks = 0;
        anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA;
        if (sc->mii_flags & MIIF_DOPAUSE)
                anar |= ANAR_X_PAUSE_TOWARDS;
diff -r 907d083c8365 -r 97ea79cda9ba sys/dev/mii/brgphy.c
--- a/sys/dev/mii/brgphy.c      Thu Jun 06 02:00:59 2013 +0000
+++ b/sys/dev/mii/brgphy.c      Thu Jun 06 03:10:48 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: brgphy.c,v 1.63 2013/04/01 13:41:37 msaitoh Exp $      */
+/*     $NetBSD: brgphy.c,v 1.64 2013/06/06 03:10:48 msaitoh Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.63 2013/04/01 13:41:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.64 2013/06/06 03:10:48 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -581,6 +581,7 @@
 {
        int anar, ktcr = 0;
 
+       sc->mii_ticks = 0;
        brgphy_loop(sc);
        PHY_RESET(sc);
 
diff -r 907d083c8365 -r 97ea79cda9ba sys/dev/mii/ciphy.c
--- a/sys/dev/mii/ciphy.c       Thu Jun 06 02:00:59 2013 +0000
+++ b/sys/dev/mii/ciphy.c       Thu Jun 06 03:10:48 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.19 2009/05/12 14:31:27 cegger Exp $ */
+/* $NetBSD: ciphy.c,v 1.20 2013/06/06 03:10:48 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.19 2009/05/12 14:31:27 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.20 2013/06/06 03:10:48 msaitoh Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -275,7 +275,6 @@
                if (++sc->mii_ticks <= MII_ANEGTICKS)
                        break;
 
-               sc->mii_ticks = 0;
                mii_phy_auto(sc, 0);
                return (0);
        }
diff -r 907d083c8365 -r 97ea79cda9ba sys/dev/mii/mii_physubr.c
--- a/sys/dev/mii/mii_physubr.c Thu Jun 06 02:00:59 2013 +0000
+++ b/sys/dev/mii/mii_physubr.c Thu Jun 06 03:10:48 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mii_physubr.c,v 1.75 2012/10/03 07:08:58 mlelstv Exp $ */
+/*     $NetBSD: mii_physubr.c,v 1.76 2013/06/06 03:10:48 msaitoh 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.75 2012/10/03 07:08:58 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.76 2013/06/06 03:10:48 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -202,6 +202,7 @@
        struct mii_data *mii = sc->mii_pdata;
        struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
 
+       sc->mii_ticks = 0;
        if ((sc->mii_flags & MIIF_DOINGAUTO) == 0) {
                /*
                 * Check for 1000BASE-X.  Autonegotiation is a bit
@@ -346,7 +347,6 @@
        if (++sc->mii_ticks <= sc->mii_anegticks)
                return (EJUSTRETURN);
 
-       sc->mii_ticks = 0;
        PHY_RESET(sc);
 
        if (mii_phy_auto(sc, 0) == EJUSTRETURN)
diff -r 907d083c8365 -r 97ea79cda9ba sys/dev/mii/rgephy.c
--- a/sys/dev/mii/rgephy.c      Thu Jun 06 02:00:59 2013 +0000
+++ b/sys/dev/mii/rgephy.c      Thu Jun 06 03:10:48 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rgephy.c,v 1.29 2010/07/18 03:00:39 jakllsch Exp $     */
+/*     $NetBSD: rgephy.c,v 1.30 2013/06/06 03:10:48 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2003
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.29 2010/07/18 03:00:39 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.30 2013/06/06 03:10:48 msaitoh Exp $");
 
 
 /*
@@ -319,7 +319,6 @@
                if (sc->mii_ticks <= sc->mii_anegticks)
                        return 0;
 
-               sc->mii_ticks = 0;
                rgephy_mii_phy_auto(sc);
                break;
        }
@@ -428,6 +427,7 @@
 {
        int anar;
 
+       mii->mii_ticks = 0;
        rgephy_loop(mii);
        rgephy_reset(mii);
 
diff -r 907d083c8365 -r 97ea79cda9ba sys/dev/mii/urlphy.c
--- a/sys/dev/mii/urlphy.c      Thu Jun 06 02:00:59 2013 +0000
+++ b/sys/dev/mii/urlphy.c      Thu Jun 06 03:10:48 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: urlphy.c,v 1.25 2009/01/31 05:44:05 hira Exp $ */
+/*     $NetBSD: urlphy.c,v 1.26 2013/06/06 03:10:48 msaitoh Exp $      */
 /*
  * Copyright (c) 2001, 2002
  *     Shingo WATANABE <nabe%nabechan.org@localhost>.  All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.25 2009/01/31 05:44:05 hira Exp $");
+__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.26 2013/06/06 03:10:48 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -196,7 +196,6 @@
                if (++sc->mii_ticks <= sc->mii_anegticks)
                        return (0);
 
-               sc->mii_ticks = 0;
                PHY_RESET(sc);
 
                if (mii_phy_auto(sc, 0) == EJUSTRETURN)



Home | Main Index | Thread Index | Old Index