Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Fix yet another fiber mediachange fix. Not tested.



details:   https://anonhg.NetBSD.org/src/rev/2db1a5020f38
branches:  trunk
changeset: 998227:2db1a5020f38
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Apr 11 04:50:47 2019 +0000

description:
Fix yet another fiber mediachange fix. Not tested.
- Don't clear bits other than IFM_[FH]DX.
- Always reset PCS when any IFM_[FH]DX bit is changed.

diffstat:

 sys/dev/ic/gem.c |  28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diffs (53 lines):

diff -r 1eb0b2cf4aba -r 2db1a5020f38 sys/dev/ic/gem.c
--- a/sys/dev/ic/gem.c  Thu Apr 11 04:43:40 2019 +0000
+++ b/sys/dev/ic/gem.c  Thu Apr 11 04:50:47 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gem.c,v 1.115 2019/04/09 07:23:41 msaitoh Exp $ */
+/*     $NetBSD: gem.c,v 1.116 2019/04/11 04:50:47 msaitoh Exp $ */
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.115 2019/04/09 07:23:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.116 2019/04/11 04:50:47 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -2570,22 +2570,22 @@
                return 0;
        }
        if (s == IFM_1000_SX) {
-               t = IFM_OPTIONS(sc->sc_mii.mii_media.ifm_media);
-               if (t == IFM_FDX || t == IFM_HDX) {
-                       if (sc->sc_mii_media != t) {
-                               sc->sc_mii_media = t;
+               t = IFM_OPTIONS(sc->sc_mii.mii_media.ifm_media)
+                   & (IFM_FDX | IFM_HDX);
+               if ((sc->sc_mii_media & (IFM_FDX | IFM_HDX)) != t) {
+                       sc->sc_mii_media &= ~(IFM_FDX | IFM_HDX);
+                       sc->sc_mii_media |= t;
 #ifdef GEM_DEBUG
-                               aprint_debug_dev(sc->sc_dev,
-                                   "setting media to 1000baseSX-%s\n",
-                                   t == IFM_FDX ? "FDX" : "HDX");
+                       aprint_debug_dev(sc->sc_dev,
+                           "setting media to 1000baseSX-%s\n",
+                           t == IFM_FDX ? "FDX" : "HDX");
 #endif
-                               if (ifp->if_flags & IFF_UP) {
-                                       gem_pcs_stop(sc, 0);
-                                       gem_pcs_start(sc);
-                               }
+                       if (ifp->if_flags & IFF_UP) {
+                               gem_pcs_stop(sc, 0);
+                               gem_pcs_start(sc);
                        }
-                       return 0;
                }
+               return 0;
        }
        return EINVAL;
 }



Home | Main Index | Thread Index | Old Index