net: introduce change lower state notifier
When lower device like bonding slave, team/bridge port, etc changes its state, it is useful for others to notice this change. Currently this is implemented specificly for bonding as NETDEV_BONDING_INFO notifier. This patch aims to replace this specific usage and make this more generic to be used for all upper-lower devices. Introduce NETDEV_CHANGELOWERSTATE netdev notifier type and netdev_lower_state_changed() helper. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
41f0b04964
commit
04d482660a
@@ -5756,6 +5756,26 @@ int dev_get_nest_level(struct net_device *dev,
|
||||
}
|
||||
EXPORT_SYMBOL(dev_get_nest_level);
|
||||
|
||||
/**
|
||||
* netdev_lower_change - Dispatch event about lower device state change
|
||||
* @lower_dev: device
|
||||
* @lower_state_info: state to dispatch
|
||||
*
|
||||
* Send NETDEV_CHANGELOWERSTATE to netdev notifiers with info.
|
||||
* The caller must hold the RTNL lock.
|
||||
*/
|
||||
void netdev_lower_state_changed(struct net_device *lower_dev,
|
||||
void *lower_state_info)
|
||||
{
|
||||
struct netdev_notifier_changelowerstate_info changelowerstate_info;
|
||||
|
||||
ASSERT_RTNL();
|
||||
changelowerstate_info.lower_state_info = lower_state_info;
|
||||
call_netdevice_notifiers_info(NETDEV_CHANGELOWERSTATE, lower_dev,
|
||||
&changelowerstate_info.info);
|
||||
}
|
||||
EXPORT_SYMBOL(netdev_lower_state_changed);
|
||||
|
||||
static void dev_change_rx_flags(struct net_device *dev, int flags)
|
||||
{
|
||||
const struct net_device_ops *ops = dev->netdev_ops;
|
||||
|
||||
Reference in New Issue
Block a user