Lines Matching refs:bond
51 #define BOND_MODE(bond) ((bond)->params.mode)
54 #define bond_slave_list(bond) (&(bond)->dev->adj_list.lower)
56 #define bond_has_slaves(bond) !list_empty(bond_slave_list(bond))
59 #define bond_first_slave(bond) \
60 (bond_has_slaves(bond) ? \
61 netdev_adjacent_get_private(bond_slave_list(bond)->next) : \
63 #define bond_last_slave(bond) \
64 (bond_has_slaves(bond) ? \
65 netdev_adjacent_get_private(bond_slave_list(bond)->prev) : \
69 #define bond_first_slave_rcu(bond) \
70 netdev_lower_get_first_private_rcu(bond->dev)
72 #define bond_is_first_slave(bond, pos) (pos == bond_first_slave(bond))
73 #define bond_is_last_slave(bond, pos) (pos == bond_last_slave(bond))
77 * @bond: the bond holding this list
83 #define bond_for_each_slave(bond, pos, iter) \
84 netdev_for_each_lower_private((bond)->dev, pos, iter)
87 #define bond_for_each_slave_rcu(bond, pos, iter) \
88 netdev_for_each_lower_private_rcu((bond)->dev, pos, iter)
158 struct bonding *bond; /* our master */
281 * Returns NULL if the net_device does not belong to any of the bond's slaves
283 * Caller must hold bond lock for read
285 static inline struct slave *bond_get_slave_by_dev(struct bonding *bond,
288 return netdev_lower_dev_get_private(bond->dev, slave_dev);
293 return slave->bond;
296 static inline bool bond_should_override_tx_queue(struct bonding *bond)
298 return BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP ||
299 BOND_MODE(bond) == BOND_MODE_ROUNDROBIN;
302 static inline bool bond_is_lb(const struct bonding *bond)
304 return BOND_MODE(bond) == BOND_MODE_TLB ||
305 BOND_MODE(bond) == BOND_MODE_ALB;
308 static inline bool bond_needs_speed_duplex(const struct bonding *bond)
310 return BOND_MODE(bond) == BOND_MODE_8023AD || bond_is_lb(bond);
313 static inline bool bond_is_nondyn_tlb(const struct bonding *bond)
315 return (bond_is_lb(bond) && bond->params.tlb_dynamic_lb == 0);
318 static inline bool bond_mode_can_use_xmit_hash(const struct bonding *bond)
320 return (BOND_MODE(bond) == BOND_MODE_8023AD ||
321 BOND_MODE(bond) == BOND_MODE_XOR ||
322 BOND_MODE(bond) == BOND_MODE_TLB ||
323 BOND_MODE(bond) == BOND_MODE_ALB);
326 static inline bool bond_mode_uses_xmit_hash(const struct bonding *bond)
328 return (BOND_MODE(bond) == BOND_MODE_8023AD ||
329 BOND_MODE(bond) == BOND_MODE_XOR ||
330 bond_is_nondyn_tlb(bond));
345 static inline bool bond_uses_primary(struct bonding *bond)
347 return bond_mode_uses_primary(BOND_MODE(bond));
350 static inline struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond)
352 struct slave *slave = rcu_dereference_rtnl(bond->curr_active_slave);
354 return bond_uses_primary(bond) && slave ? slave->dev : NULL;
399 static inline void bond_slave_state_change(struct bonding *bond)
404 bond_for_each_slave(bond, tmp, iter) {
412 static inline void bond_slave_state_notify(struct bonding *bond)
417 bond_for_each_slave(bond, tmp, iter) {
489 static inline int slave_do_arp_validate(struct bonding *bond,
492 return bond->params.arp_validate & (1 << bond_slave_state(slave));
495 static inline int slave_do_arp_validate_only(struct bonding *bond)
497 return bond->params.arp_validate & BOND_ARP_FILTER;
514 /* Get the oldest arp which we've received on this slave for bond's
517 static inline unsigned long slave_oldest_target_arp_rx(struct bonding *bond,
523 for (; (i < BOND_MAX_ARP_TARGETS) && bond->params.arp_targets[i]; i++)
530 static inline unsigned long slave_last_rx(struct bonding *bond,
533 if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL)
534 return slave_oldest_target_arp_rx(bond, slave);
567 if (!bond_is_lb(slave->bond))
569 if (!slave->bond->params.all_slaves_active)
615 static inline void bond_slave_link_notify(struct bonding *bond)
620 bond_for_each_slave(bond, tmp, iter) {
653 int bond_rcv_validate(const struct sk_buff *skb, struct bonding *bond, struct slave *slave);
654 netdev_tx_t bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
658 void bond_prepare_sysfs_group(struct bonding *bond);
665 u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb);
666 int bond_set_carrier(struct bonding *bond);
667 void bond_select_active_slave(struct bonding *bond);
668 void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
671 void bond_debug_register(struct bonding *bond);
672 void bond_debug_unregister(struct bonding *bond);
673 void bond_debug_reregister(struct bonding *bond);
679 struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond);
684 int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave);
685 void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay);
686 void bond_work_init_all(struct bonding *bond);
689 void bond_create_proc_entry(struct bonding *bond);
690 void bond_remove_proc_entry(struct bonding *bond);
694 static inline void bond_create_proc_entry(struct bonding *bond)
698 static inline void bond_remove_proc_entry(struct bonding *bond)
711 static inline struct slave *bond_slave_has_mac(struct bonding *bond,
717 bond_for_each_slave(bond, tmp, iter)
725 static inline bool bond_slave_has_mac_rcu(struct bonding *bond, const u8 *mac)
730 bond_for_each_slave_rcu(bond, tmp, iter)