Commit 61bd3857 authored by Moni Shoua's avatar Moni Shoua Committed by David S. Miller

net/core: Add event for a change in slave state

Add event which provides an indication on a change in the state
of a bonding slave. The event handler should cast the pointer to the
appropriate type (struct netdev_bonding_info) in order to get the
full info about the slave.
Signed-off-by: default avatarMoni Shoua <monis@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 251c005a
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include <linux/netdev_features.h> #include <linux/netdev_features.h>
#include <linux/neighbour.h> #include <linux/neighbour.h>
#include <uapi/linux/netdevice.h> #include <uapi/linux/netdevice.h>
#include <uapi/linux/if_bonding.h>
struct netpoll_info; struct netpoll_info;
struct device; struct device;
...@@ -2056,6 +2057,7 @@ struct pcpu_sw_netstats { ...@@ -2056,6 +2057,7 @@ struct pcpu_sw_netstats {
#define NETDEV_RESEND_IGMP 0x0016 #define NETDEV_RESEND_IGMP 0x0016
#define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */ #define NETDEV_PRECHANGEMTU 0x0017 /* notify before mtu change happened */
#define NETDEV_CHANGEINFODATA 0x0018 #define NETDEV_CHANGEINFODATA 0x0018
#define NETDEV_BONDING_INFO 0x0019
int register_netdevice_notifier(struct notifier_block *nb); int register_netdevice_notifier(struct notifier_block *nb);
int unregister_netdevice_notifier(struct notifier_block *nb); int unregister_netdevice_notifier(struct notifier_block *nb);
...@@ -3494,6 +3496,19 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb, ...@@ -3494,6 +3496,19 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
netdev_features_t features); netdev_features_t features);
struct netdev_bonding_info {
ifslave slave;
ifbond master;
};
struct netdev_notifier_bonding_info {
struct netdev_notifier_info info; /* must be first */
struct netdev_bonding_info bonding_info;
};
void netdev_bonding_info_change(struct net_device *dev,
struct netdev_bonding_info *bonding_info);
static inline static inline
struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features) struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
{ {
......
...@@ -5355,6 +5355,26 @@ void netdev_upper_dev_unlink(struct net_device *dev, ...@@ -5355,6 +5355,26 @@ void netdev_upper_dev_unlink(struct net_device *dev,
} }
EXPORT_SYMBOL(netdev_upper_dev_unlink); EXPORT_SYMBOL(netdev_upper_dev_unlink);
/**
* netdev_bonding_info_change - Dispatch event about slave change
* @dev: device
* @netdev_bonding_info: info to dispatch
*
* Send NETDEV_BONDING_INFO to netdev notifiers with info.
* The caller must hold the RTNL lock.
*/
void netdev_bonding_info_change(struct net_device *dev,
struct netdev_bonding_info *bonding_info)
{
struct netdev_notifier_bonding_info info;
memcpy(&info.bonding_info, bonding_info,
sizeof(struct netdev_bonding_info));
call_netdevice_notifiers_info(NETDEV_BONDING_INFO, dev,
&info.info);
}
EXPORT_SYMBOL(netdev_bonding_info_change);
void netdev_adjacent_add_links(struct net_device *dev) void netdev_adjacent_add_links(struct net_device *dev)
{ {
struct netdev_adjacent *iter; struct netdev_adjacent *iter;
......
...@@ -3180,6 +3180,7 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi ...@@ -3180,6 +3180,7 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
case NETDEV_UNREGISTER_FINAL: case NETDEV_UNREGISTER_FINAL:
case NETDEV_RELEASE: case NETDEV_RELEASE:
case NETDEV_JOIN: case NETDEV_JOIN:
case NETDEV_BONDING_INFO:
break; break;
default: default:
rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL); rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment