Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Fix a bug that non-GMII devices don't send a rou...



details:   https://anonhg.NetBSD.org/src/rev/ae74f5b622e2
branches:  trunk
changeset: 822750:ae74f5b622e2
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Apr 05 10:44:35 2017 +0000

description:
Fix a bug that non-GMII devices don't send a routing message when the link
status is changed. Call if_link_state_change(). Tested with 82572EI(TBI) and
I350(SERDES).

XXX pullup-[67].

diffstat:

 sys/dev/pci/if_wm.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (65 lines):

diff -r 6f86a142c8d1 -r ae74f5b622e2 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Wed Apr 05 08:51:04 2017 +0000
+++ b/sys/dev/pci/if_wm.c       Wed Apr 05 10:44:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.505 2017/03/24 10:39:10 knakahara Exp $    */
+/*     $NetBSD: if_wm.c,v 1.506 2017/04/05 10:44:35 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.505 2017/03/24 10:39:10 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.506 2017/04/05 10:44:35 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -8283,6 +8283,7 @@
 static void
 wm_linkintr_tbi(struct wm_softc *sc, uint32_t icr)
 {
+       struct ifnet *ifp = &sc->sc_ethercom.ec_if;
        uint32_t status;
 
        DPRINTF(WM_DEBUG_LINK, ("%s: %s:\n", device_xname(sc->sc_dev),
@@ -8315,10 +8316,12 @@
                                      WMREG_OLD_FCRTL : WMREG_FCRTL,
                                      sc->sc_fcrtl);
                        sc->sc_tbi_linkup = 1;
+                       if_link_state_change(ifp, LINK_STATE_UP);
                } else {
                        DPRINTF(WM_DEBUG_LINK, ("%s: LINK: LSC -> down\n",
                            device_xname(sc->sc_dev)));
                        sc->sc_tbi_linkup = 0;
+                       if_link_state_change(ifp, LINK_STATE_DOWN);
                }
                /* Update LED */
                wm_tbi_serdes_set_linkled(sc);
@@ -8337,6 +8340,7 @@
 static void
 wm_linkintr_serdes(struct wm_softc *sc, uint32_t icr)
 {
+       struct ifnet *ifp = &sc->sc_ethercom.ec_if;
        struct mii_data *mii = &sc->sc_mii;
        struct ifmedia_entry *ife = sc->sc_mii.mii_media.ifm_cur;
        uint32_t pcs_adv, pcs_lpab, reg;
@@ -8348,11 +8352,17 @@
                /* Check PCS */
                reg = CSR_READ(sc, WMREG_PCS_LSTS);
                if ((reg & PCS_LSTS_LINKOK) != 0) {
+                       DPRINTF(WM_DEBUG_LINK, ("%s: LINK: LSC -> up\n",
+                               device_xname(sc->sc_dev)));
                        mii->mii_media_status |= IFM_ACTIVE;
                        sc->sc_tbi_linkup = 1;
+                       if_link_state_change(ifp, LINK_STATE_UP);
                } else {
+                       DPRINTF(WM_DEBUG_LINK, ("%s: LINK: LSC -> down\n",
+                               device_xname(sc->sc_dev)));
                        mii->mii_media_status |= IFM_NONE;
                        sc->sc_tbi_linkup = 0;
+                       if_link_state_change(ifp, LINK_STATE_DOWN);
                        wm_tbi_serdes_set_linkled(sc);
                        return;
                }



Home | Main Index | Thread Index | Old Index