aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bonding.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding/bonding.h')
-rw-r--r--drivers/net/bonding/bonding.h43
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 2b0fdec695f7..b8bdd0acc8f3 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -188,8 +188,9 @@ struct slave {
188 struct net_device *dev; /* first - useful for panic debug */ 188 struct net_device *dev; /* first - useful for panic debug */
189 struct bonding *bond; /* our master */ 189 struct bonding *bond; /* our master */
190 int delay; 190 int delay;
191 unsigned long jiffies; 191 /* all three in jiffies */
192 unsigned long last_arp_rx; 192 unsigned long last_link_up;
193 unsigned long last_rx;
193 unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS]; 194 unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS];
194 s8 link; /* one of BOND_LINK_XXXX */ 195 s8 link; /* one of BOND_LINK_XXXX */
195 s8 new_link; 196 s8 new_link;
@@ -265,6 +266,11 @@ struct bonding {
265#define bond_slave_get_rtnl(dev) \ 266#define bond_slave_get_rtnl(dev) \
266 ((struct slave *) rtnl_dereference(dev->rx_handler_data)) 267 ((struct slave *) rtnl_dereference(dev->rx_handler_data))
267 268
269struct bond_vlan_tag {
270 __be16 vlan_proto;
271 unsigned short vlan_id;
272};
273
268/** 274/**
269 * Returns NULL if the net_device does not belong to any of the bond's slaves 275 * Returns NULL if the net_device does not belong to any of the bond's slaves
270 * 276 *
@@ -292,7 +298,7 @@ static inline void bond_set_active_slave(struct slave *slave)
292{ 298{
293 if (slave->backup) { 299 if (slave->backup) {
294 slave->backup = 0; 300 slave->backup = 0;
295 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL); 301 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
296 } 302 }
297} 303}
298 304
@@ -300,7 +306,7 @@ static inline void bond_set_backup_slave(struct slave *slave)
300{ 306{
301 if (!slave->backup) { 307 if (!slave->backup) {
302 slave->backup = 1; 308 slave->backup = 1;
303 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL); 309 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
304 } 310 }
305} 311}
306 312
@@ -312,7 +318,7 @@ static inline void bond_set_slave_state(struct slave *slave,
312 318
313 slave->backup = slave_state; 319 slave->backup = slave_state;
314 if (notify) { 320 if (notify) {
315 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL); 321 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
316 slave->should_notify = 0; 322 slave->should_notify = 0;
317 } else { 323 } else {
318 if (slave->should_notify) 324 if (slave->should_notify)
@@ -342,7 +348,7 @@ static inline void bond_slave_state_notify(struct bonding *bond)
342 348
343 bond_for_each_slave(bond, tmp, iter) { 349 bond_for_each_slave(bond, tmp, iter) {
344 if (tmp->should_notify) { 350 if (tmp->should_notify) {
345 rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_KERNEL); 351 rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_ATOMIC);
346 tmp->should_notify = 0; 352 tmp->should_notify = 0;
347 } 353 }
348 } 354 }
@@ -374,6 +380,11 @@ static inline bool bond_is_active_slave(struct slave *slave)
374#define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP) 380#define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP)
375#define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \ 381#define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \
376 BOND_ARP_VALIDATE_BACKUP) 382 BOND_ARP_VALIDATE_BACKUP)
383#define BOND_ARP_FILTER (BOND_ARP_VALIDATE_ALL + 1)
384#define BOND_ARP_FILTER_ACTIVE (BOND_ARP_VALIDATE_ACTIVE | \
385 BOND_ARP_FILTER)
386#define BOND_ARP_FILTER_BACKUP (BOND_ARP_VALIDATE_BACKUP | \
387 BOND_ARP_FILTER)
377 388
378#define BOND_SLAVE_NOTIFY_NOW true 389#define BOND_SLAVE_NOTIFY_NOW true
379#define BOND_SLAVE_NOTIFY_LATER false 390#define BOND_SLAVE_NOTIFY_LATER false
@@ -384,6 +395,12 @@ static inline int slave_do_arp_validate(struct bonding *bond,
384 return bond->params.arp_validate & (1 << bond_slave_state(slave)); 395 return bond->params.arp_validate & (1 << bond_slave_state(slave));
385} 396}
386 397
398static inline int slave_do_arp_validate_only(struct bonding *bond,
399 struct slave *slave)
400{
401 return bond->params.arp_validate & BOND_ARP_FILTER;
402}
403
387/* Get the oldest arp which we've received on this slave for bond's 404/* Get the oldest arp which we've received on this slave for bond's
388 * arp_targets. 405 * arp_targets.
389 */ 406 */
@@ -403,14 +420,10 @@ static inline unsigned long slave_oldest_target_arp_rx(struct bonding *bond,
403static inline unsigned long slave_last_rx(struct bonding *bond, 420static inline unsigned long slave_last_rx(struct bonding *bond,
404 struct slave *slave) 421 struct slave *slave)
405{ 422{
406 if (slave_do_arp_validate(bond, slave)) { 423 if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL)
407 if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL) 424 return slave_oldest_target_arp_rx(bond, slave);
408 return slave_oldest_target_arp_rx(bond, slave);
409 else
410 return slave->last_arp_rx;
411 }
412 425
413 return slave->dev->last_rx; 426 return slave->last_rx;
414} 427}
415 428
416#ifdef CONFIG_NET_POLL_CONTROLLER 429#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -487,8 +500,6 @@ void bond_sysfs_slave_del(struct slave *slave);
487int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev); 500int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev);
488int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); 501int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);
489int bond_xmit_hash(struct bonding *bond, struct sk_buff *skb, int count); 502int bond_xmit_hash(struct bonding *bond, struct sk_buff *skb, int count);
490int bond_parse_parm(const char *mode_arg, const struct bond_parm_tbl *tbl);
491int bond_parm_tbl_lookup(int mode, const struct bond_parm_tbl *tbl);
492void bond_select_active_slave(struct bonding *bond); 503void bond_select_active_slave(struct bonding *bond);
493void bond_change_active_slave(struct bonding *bond, struct slave *new_active); 504void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
494void bond_create_debugfs(void); 505void bond_create_debugfs(void);
@@ -501,8 +512,6 @@ void bond_setup(struct net_device *bond_dev);
501unsigned int bond_get_num_tx_queues(void); 512unsigned int bond_get_num_tx_queues(void);
502int bond_netlink_init(void); 513int bond_netlink_init(void);
503void bond_netlink_fini(void); 514void bond_netlink_fini(void);
504int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target);
505int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target);
506struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond); 515struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond);
507struct net_device *bond_option_active_slave_get(struct bonding *bond); 516struct net_device *bond_option_active_slave_get(struct bonding *bond);
508const char *bond_slave_link_status(s8 link); 517const char *bond_slave_link_status(s8 link);