Source-Changes-HG archive

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

[src/trunk]: src/sys/net net: Add a callback to ifnet to notify of link state...



details:   https://anonhg.NetBSD.org/src/rev/a690ce220083
branches:  trunk
changeset: 939392:a690ce220083
user:      roy <roy%NetBSD.org@localhost>
date:      Sat Sep 26 18:35:12 2020 +0000

description:
net: Add a callback to ifnet to notify of link state changes

diffstat:

 sys/net/if.c |  9 +++++++--
 sys/net/if.h |  3 ++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diffs (54 lines):

diff -r 798817643867 -r a690ce220083 sys/net/if.c
--- a/sys/net/if.c      Sat Sep 26 17:49:49 2020 +0000
+++ b/sys/net/if.c      Sat Sep 26 18:35:12 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.480 2020/09/26 11:57:05 roy Exp $     */
+/*     $NetBSD: if.c,v 1.481 2020/09/26 18:35:12 roy Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.480 2020/09/26 11:57:05 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.481 2020/09/26 18:35:12 roy Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1212,6 +1212,8 @@
        ifp->if_slowtimo = if_nullslowtimo;
        ifp->if_drain    = if_nulldrain;
 
+       ifp->if_link_state_changed = NULL;
+
        /* No more packets may be enqueued. */
        ifp->if_snd.ifq_maxlen = 0;
 
@@ -2415,6 +2417,9 @@
                carp_carpdev_state(ifp);
 #endif
 
+       if (ifp->if_link_state_changed != NULL)
+               ifp->if_link_state_changed(ifp, link_state);
+
        DOMAIN_FOREACH(dp) {
                if (dp->dom_if_link_state_change != NULL)
                        dp->dom_if_link_state_change(ifp, link_state);
diff -r 798817643867 -r a690ce220083 sys/net/if.h
--- a/sys/net/if.h      Sat Sep 26 17:49:49 2020 +0000
+++ b/sys/net/if.h      Sat Sep 26 18:35:12 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.h,v 1.286 2020/09/26 11:57:05 roy Exp $     */
+/*     $NetBSD: if.h,v 1.287 2020/09/26 18:35:12 roy Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -419,6 +419,7 @@
        uint16_t        if_link_queue;  /* q: masked link state change queue */
                                        /* q: is link state work scheduled? */
        bool            if_link_scheduled;
+       void            (*if_link_state_changed)(struct ifnet *, int);
        struct pslist_entry
                        if_pslist_entry;/* i: */
        struct psref_target



Home | Main Index | Thread Index | Old Index