Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic le(4): add link status change reporting to driver...



details:   https://anonhg.NetBSD.org/src/rev/fa681564d8f4
branches:  trunk
changeset: 941417:fa681564d8f4
user:      roy <roy%NetBSD.org@localhost>
date:      Tue Oct 20 18:17:58 2020 +0000

description:
le(4): add link status change reporting to drivers which support it

Reviewed by thorpej@
Tested by martin@

diffstat:

 sys/arch/mac68k/dev/if_mc.c    |  9 +++++++--
 sys/arch/macppc/dev/am79c950.c |  9 +++++++--
 sys/dev/ic/am7990.c            |  9 +++++++--
 sys/dev/ic/am79900.c           |  9 +++++++--
 4 files changed, 28 insertions(+), 8 deletions(-)

diffs (148 lines):

diff -r c7e9e71ab20b -r fa681564d8f4 sys/arch/mac68k/dev/if_mc.c
--- a/sys/arch/mac68k/dev/if_mc.c       Tue Oct 20 13:47:30 2020 +0000
+++ b/sys/arch/mac68k/dev/if_mc.c       Tue Oct 20 18:17:58 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_mc.c,v 1.55 2020/01/30 06:30:52 martin Exp $        */
+/*     $NetBSD: if_mc.c,v 1.56 2020/10/20 18:17:58 roy Exp $   */
 
 /*-
  * Copyright (c) 1997 David Huang <khym%azeotrope.org@localhost>
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.55 2020/01/30 06:30:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mc.c,v 1.56 2020/10/20 18:17:58 roy Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -455,6 +455,7 @@
         * Pretend we have carrier; if we don't this will be cleared
         * shortly.
         */
+       const int ocarrier = sc->sc_havecarrier;
        sc->sc_havecarrier = 1;
 
        if (ir & XMTINT)
@@ -462,6 +463,10 @@
 
        if (ir & RCVINT)
                mc_rint(sc);
+
+       if (sc->sc_havecarrier != ocarrier)
+               if_link_state_change(&sc->sc_if,
+                   sc->sc_havecarrier ? LINK_STATE_UP : LINK_STATE_DOWN);
 }
 
 integrate void
diff -r c7e9e71ab20b -r fa681564d8f4 sys/arch/macppc/dev/am79c950.c
--- a/sys/arch/macppc/dev/am79c950.c    Tue Oct 20 13:47:30 2020 +0000
+++ b/sys/arch/macppc/dev/am79c950.c    Tue Oct 20 18:17:58 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: am79c950.c,v 1.49 2020/02/04 13:47:34 martin Exp $     */
+/*     $NetBSD: am79c950.c,v 1.50 2020/10/20 18:17:58 roy Exp $        */
 
 /*-
  * Copyright (c) 1997 David Huang <khym%bga.com@localhost>
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.49 2020/02/04 13:47:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.50 2020/10/20 18:17:58 roy Exp $");
 
 #include "opt_inet.h"
 
@@ -458,6 +458,7 @@
         * Pretend we have carrier; if we don't this will be cleared
         * shortly.
         */
+       const int ocarrier = sc->sc_havecarrier;
        sc->sc_havecarrier = 1;
 
        if (ir & XMTINT)
@@ -466,6 +467,10 @@
        if (ir & RCVINT)
                mc_rint(sc);
 
+       if (sc->sc_havecarrier != ocarrier)
+               if_link_state_change(&sc->sc_if,
+                   sc->sc_havecarrier ? LINK_STATE_UP : LINK_STATE_DOWN);
+
        return 1;
 }
 
diff -r c7e9e71ab20b -r fa681564d8f4 sys/dev/ic/am7990.c
--- a/sys/dev/ic/am7990.c       Tue Oct 20 13:47:30 2020 +0000
+++ b/sys/dev/ic/am7990.c       Tue Oct 20 18:17:58 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: am7990.c,v 1.82 2020/03/19 02:31:28 thorpej Exp $      */
+/*     $NetBSD: am7990.c,v 1.83 2020/10/20 18:17:58 roy Exp $  */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: am7990.c,v 1.82 2020/03/19 02:31:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am7990.c,v 1.83 2020/10/20 18:17:58 roy Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -435,6 +435,7 @@
         * Pretend we have carrier; if we don't this will be cleared
         * shortly.
         */
+       const int ocarrier = sc->sc_havecarrier;
        sc->sc_havecarrier = 1;
 
        if (isr & LE_C0_RINT)
@@ -442,6 +443,10 @@
        if (isr & LE_C0_TINT)
                am7990_tint(sc);
 
+       if (sc->sc_havecarrier != ocarrier)
+               if_link_state_change(ifp,
+                   sc->sc_havecarrier ? LINK_STATE_UP : LINK_STATE_DOWN);
+
        rnd_add_uint32(&sc->rnd_source, isr);
 
        return (1);
diff -r c7e9e71ab20b -r fa681564d8f4 sys/dev/ic/am79900.c
--- a/sys/dev/ic/am79900.c      Tue Oct 20 13:47:30 2020 +0000
+++ b/sys/dev/ic/am79900.c      Tue Oct 20 18:17:58 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: am79900.c,v 1.30 2020/03/19 02:31:28 thorpej Exp $     */
+/*     $NetBSD: am79900.c,v 1.31 2020/10/20 18:17:58 roy Exp $ */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: am79900.c,v 1.30 2020/03/19 02:31:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79900.c,v 1.31 2020/10/20 18:17:58 roy Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -456,6 +456,7 @@
         * Pretend we have carrier; if we don't this will be cleared
         * shortly.
         */
+       const int ocarrier = sc->sc_havecarrier;
        sc->sc_havecarrier = 1;
 
        if (isr & LE_C0_RINT)
@@ -463,6 +464,10 @@
        if (isr & LE_C0_TINT)
                am79900_tint(sc);
 
+       if (sc->sc_havecarrier != ocarrier)
+               if_link_state_change(ifp,
+                   sc->sc_havecarrier ? LINK_STATE_UP : LINK_STATE_DOWN);
+
        rnd_add_uint32(&sc->rnd_source, isr);
 
        return (1);



Home | Main Index | Thread Index | Old Index