diff options
Diffstat (limited to 'drivers/net/bonding/bonding.h')
-rw-r--r-- | drivers/net/bonding/bonding.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 486e532f77e4..3fb73cc8c34a 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -144,6 +144,7 @@ struct bond_params { | |||
144 | u8 num_peer_notif; | 144 | u8 num_peer_notif; |
145 | int arp_interval; | 145 | int arp_interval; |
146 | int arp_validate; | 146 | int arp_validate; |
147 | int arp_all_targets; | ||
147 | int use_carrier; | 148 | int use_carrier; |
148 | int fail_over_mac; | 149 | int fail_over_mac; |
149 | int updelay; | 150 | int updelay; |
@@ -179,6 +180,7 @@ struct slave { | |||
179 | int delay; | 180 | int delay; |
180 | unsigned long jiffies; | 181 | unsigned long jiffies; |
181 | unsigned long last_arp_rx; | 182 | unsigned long last_arp_rx; |
183 | unsigned long target_last_arp_rx[BOND_MAX_ARP_TARGETS]; | ||
182 | s8 link; /* one of BOND_LINK_XXXX */ | 184 | s8 link; /* one of BOND_LINK_XXXX */ |
183 | s8 new_link; | 185 | s8 new_link; |
184 | u8 backup:1, /* indicates backup slave. Value corresponds with | 186 | u8 backup:1, /* indicates backup slave. Value corresponds with |
@@ -322,6 +324,9 @@ static inline bool bond_is_active_slave(struct slave *slave) | |||
322 | #define BOND_FOM_ACTIVE 1 | 324 | #define BOND_FOM_ACTIVE 1 |
323 | #define BOND_FOM_FOLLOW 2 | 325 | #define BOND_FOM_FOLLOW 2 |
324 | 326 | ||
327 | #define BOND_ARP_TARGETS_ANY 0 | ||
328 | #define BOND_ARP_TARGETS_ALL 1 | ||
329 | |||
325 | #define BOND_ARP_VALIDATE_NONE 0 | 330 | #define BOND_ARP_VALIDATE_NONE 0 |
326 | #define BOND_ARP_VALIDATE_ACTIVE (1 << BOND_STATE_ACTIVE) | 331 | #define BOND_ARP_VALIDATE_ACTIVE (1 << BOND_STATE_ACTIVE) |
327 | #define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP) | 332 | #define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP) |
@@ -334,11 +339,31 @@ static inline int slave_do_arp_validate(struct bonding *bond, | |||
334 | return bond->params.arp_validate & (1 << bond_slave_state(slave)); | 339 | return bond->params.arp_validate & (1 << bond_slave_state(slave)); |
335 | } | 340 | } |
336 | 341 | ||
342 | /* Get the oldest arp which we've received on this slave for bond's | ||
343 | * arp_targets. | ||
344 | */ | ||
345 | static inline unsigned long slave_oldest_target_arp_rx(struct bonding *bond, | ||
346 | struct slave *slave) | ||
347 | { | ||
348 | int i = 1; | ||
349 | unsigned long ret = slave->target_last_arp_rx[0]; | ||
350 | |||
351 | for (; (i < BOND_MAX_ARP_TARGETS) && bond->params.arp_targets[i]; i++) | ||
352 | if (time_before(slave->target_last_arp_rx[i], ret)) | ||
353 | ret = slave->target_last_arp_rx[i]; | ||
354 | |||
355 | return ret; | ||
356 | } | ||
357 | |||
337 | static inline unsigned long slave_last_rx(struct bonding *bond, | 358 | static inline unsigned long slave_last_rx(struct bonding *bond, |
338 | struct slave *slave) | 359 | struct slave *slave) |
339 | { | 360 | { |
340 | if (slave_do_arp_validate(bond, slave)) | 361 | if (slave_do_arp_validate(bond, slave)) { |
341 | return slave->last_arp_rx; | 362 | if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL) |
363 | return slave_oldest_target_arp_rx(bond, slave); | ||
364 | else | ||
365 | return slave->last_arp_rx; | ||
366 | } | ||
342 | 367 | ||
343 | return slave->dev->last_rx; | 368 | return slave->dev->last_rx; |
344 | } | 369 | } |
@@ -486,6 +511,7 @@ extern const struct bond_parm_tbl bond_lacp_tbl[]; | |||
486 | extern const struct bond_parm_tbl bond_mode_tbl[]; | 511 | extern const struct bond_parm_tbl bond_mode_tbl[]; |
487 | extern const struct bond_parm_tbl xmit_hashtype_tbl[]; | 512 | extern const struct bond_parm_tbl xmit_hashtype_tbl[]; |
488 | extern const struct bond_parm_tbl arp_validate_tbl[]; | 513 | extern const struct bond_parm_tbl arp_validate_tbl[]; |
514 | extern const struct bond_parm_tbl arp_all_targets_tbl[]; | ||
489 | extern const struct bond_parm_tbl fail_over_mac_tbl[]; | 515 | extern const struct bond_parm_tbl fail_over_mac_tbl[]; |
490 | extern const struct bond_parm_tbl pri_reselect_tbl[]; | 516 | extern const struct bond_parm_tbl pri_reselect_tbl[]; |
491 | extern struct bond_parm_tbl ad_select_tbl[]; | 517 | extern struct bond_parm_tbl ad_select_tbl[]; |