summaryrefslogtreecommitdiffstats
path: root/include/net/bonding.h
diff options
context:
space:
mode:
authorMoni Shoua <monis@mellanox.com>2015-02-03 09:48:31 -0500
committerDavid S. Miller <davem@davemloft.net>2015-02-04 19:14:24 -0500
commit69e6113343cfe983511904ffca0d7a1466460b67 (patch)
treeaf67707b31a322a8a418081cd491900ec8109c84 /include/net/bonding.h
parent69a2338e05995b10225b2a131f7540d1305980e4 (diff)
net/bonding: Notify state change on slaves
Use notifier chain to dispatch an event upon a change in slave state. Event is dispatched with slave specific info. Signed-off-by: Moni Shoua <monis@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/bonding.h')
-rw-r--r--include/net/bonding.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/bonding.h b/include/net/bonding.h
index d1367ec74933..4e17095ad46a 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -150,6 +150,12 @@ struct bond_parm_tbl {
150 int mode; 150 int mode;
151}; 151};
152 152
153struct netdev_notify_work {
154 struct delayed_work work;
155 struct slave *slave;
156 struct net_device *dev;
157};
158
153struct slave { 159struct slave {
154 struct net_device *dev; /* first - useful for panic debug */ 160 struct net_device *dev; /* first - useful for panic debug */
155 struct bonding *bond; /* our master */ 161 struct bonding *bond; /* our master */
@@ -243,6 +249,8 @@ struct bonding {
243#define bond_slave_get_rtnl(dev) \ 249#define bond_slave_get_rtnl(dev) \
244 ((struct slave *) rtnl_dereference(dev->rx_handler_data)) 250 ((struct slave *) rtnl_dereference(dev->rx_handler_data))
245 251
252void bond_queue_slave_event(struct slave *slave);
253
246struct bond_vlan_tag { 254struct bond_vlan_tag {
247 __be16 vlan_proto; 255 __be16 vlan_proto;
248 unsigned short vlan_id; 256 unsigned short vlan_id;
@@ -315,6 +323,7 @@ static inline void bond_set_active_slave(struct slave *slave)
315{ 323{
316 if (slave->backup) { 324 if (slave->backup) {
317 slave->backup = 0; 325 slave->backup = 0;
326 bond_queue_slave_event(slave);
318 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); 327 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
319 } 328 }
320} 329}
@@ -323,6 +332,7 @@ static inline void bond_set_backup_slave(struct slave *slave)
323{ 332{
324 if (!slave->backup) { 333 if (!slave->backup) {
325 slave->backup = 1; 334 slave->backup = 1;
335 bond_queue_slave_event(slave);
326 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); 336 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
327 } 337 }
328} 338}
@@ -336,6 +346,7 @@ static inline void bond_set_slave_state(struct slave *slave,
336 slave->backup = slave_state; 346 slave->backup = slave_state;
337 if (notify) { 347 if (notify) {
338 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC); 348 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
349 bond_queue_slave_event(slave);
339 slave->should_notify = 0; 350 slave->should_notify = 0;
340 } else { 351 } else {
341 if (slave->should_notify) 352 if (slave->should_notify)
@@ -493,6 +504,7 @@ static inline bool bond_is_slave_inactive(struct slave *slave)
493static inline void bond_set_slave_link_state(struct slave *slave, int state) 504static inline void bond_set_slave_link_state(struct slave *slave, int state)
494{ 505{
495 slave->link = state; 506 slave->link = state;
507 bond_queue_slave_event(slave);
496} 508}
497 509
498static inline __be32 bond_confirm_addr(struct net_device *dev, __be32 dst, __be32 local) 510static inline __be32 bond_confirm_addr(struct net_device *dev, __be32 dst, __be32 local)