59 lines
1.9 KiB
Diff
59 lines
1.9 KiB
Diff
From a05aa24a03675158abf450788bb29bedfdf74b34 Mon Sep 17 00:00:00 2001
|
|
From: Murat Sezgin <msezgin@codeaurora.org>
|
|
Date: Wed, 11 Mar 2020 12:44:01 -0700
|
|
Subject: [PATCH 217/500] net: Add netdevice notification for bridge activity
|
|
|
|
This modification allows programs to get notified whenever a
|
|
device is added to or removed from a bridge. This will be used
|
|
by NSS Qdisc for updating bridge shaper configuration.
|
|
|
|
Change-Id: I97aa6951c98ba83cd0d176cd60a9e9fd910f7ad4
|
|
Signed-off-by: Shashank Balashankar <sbalasha@codeaurora.org>
|
|
Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
|
|
---
|
|
include/linux/netdevice.h | 2 ++
|
|
net/bridge/br_if.c | 3 +++
|
|
net/core/dev.c | 1 +
|
|
3 files changed, 6 insertions(+)
|
|
|
|
--- a/include/linux/netdevice.h
|
|
+++ b/include/linux/netdevice.h
|
|
@@ -2939,6 +2939,8 @@ enum netdev_cmd {
|
|
NETDEV_OFFLOAD_XSTATS_REPORT_USED,
|
|
NETDEV_OFFLOAD_XSTATS_REPORT_DELTA,
|
|
NETDEV_XDP_FEAT_CHANGE,
|
|
+ NETDEV_BR_JOIN,
|
|
+ NETDEV_BR_LEAVE,
|
|
};
|
|
const char *netdev_cmd_to_name(enum netdev_cmd cmd);
|
|
|
|
--- a/net/bridge/br_if.c
|
|
+++ b/net/bridge/br_if.c
|
|
@@ -700,6 +700,7 @@ int br_add_if(struct net_bridge *br, str
|
|
br_set_gso_limits(br);
|
|
|
|
kobject_uevent(&p->kobj, KOBJ_ADD);
|
|
+ call_netdevice_notifiers(NETDEV_BR_JOIN, dev);
|
|
|
|
return 0;
|
|
|
|
@@ -736,6 +737,8 @@ int br_del_if(struct net_bridge *br, str
|
|
if (!p || p->br != br)
|
|
return -EINVAL;
|
|
|
|
+ call_netdevice_notifiers(NETDEV_BR_LEAVE, dev);
|
|
+
|
|
/* Since more than one interface can be attached to a bridge,
|
|
* there still maybe an alternate path for netconsole to use;
|
|
* therefore there is no reason for a NETDEV_RELEASE event.
|
|
--- a/net/core/dev.c
|
|
+++ b/net/core/dev.c
|
|
@@ -1730,6 +1730,7 @@ const char *netdev_cmd_to_name(enum netd
|
|
N(PRE_CHANGEADDR) N(OFFLOAD_XSTATS_ENABLE) N(OFFLOAD_XSTATS_DISABLE)
|
|
N(OFFLOAD_XSTATS_REPORT_USED) N(OFFLOAD_XSTATS_REPORT_DELTA)
|
|
N(XDP_FEAT_CHANGE)
|
|
+ N(BR_JOIN) N(BR_LEAVE)
|
|
}
|
|
#undef N
|
|
return "UNKNOWN_NETDEV_EVENT";
|