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: I70e63c5b219d7ab022400741b2dc789cfef71ead
Signed-off-by: Manoj Sekar <quic_sekar@quicinc.com>
This commit is contained in:
Manoj Sekar 2023-06-26 20:31:54 +05:30 • committed by Xinyue Ling
commit 895cfcbb7a
3 changed files with 6 additions and 1 deletions

View file

@ -2554,6 +2554,8 @@ enum netdev_cmd {
NETDEV_CVLAN_FILTER_DROP_INFO,
NETDEV_SVLAN_FILTER_PUSH_INFO,
NETDEV_SVLAN_FILTER_DROP_INFO,
NETDEV_BR_JOIN,
NETDEV_BR_LEAVE,
};
const char *netdev_cmd_to_name(enum netdev_cmd cmd);

View file

@ -695,6 +695,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
br_set_gso_limits(br);
kobject_uevent(&p->kobj, KOBJ_ADD);
call_netdevice_notifiers(NETDEV_BR_JOIN, dev);
return 0;
@ -732,6 +733,8 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
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.

View file

@ -1521,7 +1521,7 @@ const char *netdev_cmd_to_name(enum netdev_cmd cmd)
N(UDP_TUNNEL_DROP_INFO) N(CHANGE_TX_QUEUE_LEN)
N(CVLAN_FILTER_PUSH_INFO) N(CVLAN_FILTER_DROP_INFO)
N(SVLAN_FILTER_PUSH_INFO) N(SVLAN_FILTER_DROP_INFO)
N(PRE_CHANGEADDR)
N(PRE_CHANGEADDR) N(BR_JOIN) N(BR_LEAVE)
}
#undef N
return "UNKNOWN_NETDEV_EVENT";