Lines Matching defs:bond

50 #define BOND_MODE(bond) ((bond)->params.mode)
53 #define bond_slave_list(bond) (&(bond)->dev->adj_list.lower)
55 #define bond_has_slaves(bond) !list_empty(bond_slave_list(bond))
58 #define bond_first_slave(bond) \
59 (bond_has_slaves(bond) ? \
60 netdev_adjacent_get_private(bond_slave_list(bond)->next) : \
62 #define bond_last_slave(bond) \
63 (bond_has_slaves(bond) ? \
64 netdev_adjacent_get_private(bond_slave_list(bond)->prev) : \
68 #define bond_first_slave_rcu(bond) \
69 netdev_lower_get_first_private_rcu(bond->dev)
71 #define bond_is_first_slave(bond, pos) (pos == bond_first_slave(bond))
72 #define bond_is_last_slave(bond, pos) (pos == bond_last_slave(bond))
76 * @bond: the bond holding this list
82 #define bond_for_each_slave(bond, pos, iter) \
83 netdev_for_each_lower_private((bond)->dev, pos, iter)
86 #define bond_for_each_slave_rcu(bond, pos, iter) \
87 netdev_for_each_lower_private_rcu((bond)->dev, pos, iter)
157 struct bonding *bond; /* our master */
277 * Returns NULL if the net_device does not belong to any of the bond's slaves
279 * Caller must hold bond lock for read
281 static inline struct slave *bond_get_slave_by_dev(struct bonding *bond,
284 return netdev_lower_dev_get_private(bond->dev, slave_dev);
289 return slave->bond;
292 static inline bool bond_should_override_tx_queue(struct bonding *bond)
294 return BOND_MODE(bond) == BOND_MODE_ACTIVEBACKUP ||
295 BOND_MODE(bond) == BOND_MODE_ROUNDROBIN;
298 static inline bool bond_is_lb(const struct bonding *bond)
300 return BOND_MODE(bond) == BOND_MODE_TLB ||
301 BOND_MODE(bond) == BOND_MODE_ALB;
304 static inline bool bond_needs_speed_duplex(const struct bonding *bond)
306 return BOND_MODE(bond) == BOND_MODE_8023AD || bond_is_lb(bond);
309 static inline bool bond_is_nondyn_tlb(const struct bonding *bond)
311 return (bond_is_lb(bond) && bond->params.tlb_dynamic_lb == 0);
314 static inline bool bond_mode_can_use_xmit_hash(const struct bonding *bond)
316 return (BOND_MODE(bond) == BOND_MODE_8023AD ||
317 BOND_MODE(bond) == BOND_MODE_XOR ||
318 BOND_MODE(bond) == BOND_MODE_TLB ||
319 BOND_MODE(bond) == BOND_MODE_ALB);
322 static inline bool bond_mode_uses_xmit_hash(const struct bonding *bond)
324 return (BOND_MODE(bond) == BOND_MODE_8023AD ||
325 BOND_MODE(bond) == BOND_MODE_XOR ||
326 bond_is_nondyn_tlb(bond));
341 static inline bool bond_uses_primary(struct bonding *bond)
343 return bond_mode_uses_primary(BOND_MODE(bond));
346 static inline struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond)
348 struct slave *slave = rcu_dereference(bond->curr_active_slave);
350 return bond_uses_primary(bond) && slave ? slave->dev : NULL;
395 static inline void bond_slave_state_change(struct bonding *bond)
400 bond_for_each_slave(bond, tmp, iter) {
408 static inline void bond_slave_state_notify(struct bonding *bond)
413 bond_for_each_slave(bond, tmp, iter) {
485 static inline int slave_do_arp_validate(struct bonding *bond,
488 return bond->params.arp_validate & (1 << bond_slave_state(slave));
491 static inline int slave_do_arp_validate_only(struct bonding *bond)
493 return bond->params.arp_validate & BOND_ARP_FILTER;
501 /* Get the oldest arp which we've received on this slave for bond's
504 static inline unsigned long slave_oldest_target_arp_rx(struct bonding *bond,
510 for (; (i < BOND_MAX_ARP_TARGETS) && bond->params.arp_targets[i]; i++)
517 static inline unsigned long slave_last_rx(struct bonding *bond,
520 if (bond->params.arp_all_targets == BOND_ARP_TARGETS_ALL)
521 return slave_oldest_target_arp_rx(bond, slave);
544 if (!bond_is_lb(slave->bond))
546 if (!slave->bond->params.all_slaves_active)
592 static inline void bond_slave_link_notify(struct bonding *bond)
597 bond_for_each_slave(bond, tmp, iter) {
630 int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave);
631 netdev_tx_t bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
635 void bond_prepare_sysfs_group(struct bonding *bond);
641 u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb);
642 int bond_set_carrier(struct bonding *bond);
643 void bond_select_active_slave(struct bonding *bond);
644 void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
647 void bond_debug_register(struct bonding *bond);
648 void bond_debug_unregister(struct bonding *bond);
649 void bond_debug_reregister(struct bonding *bond);
655 struct net_device *bond_option_active_slave_get_rcu(struct bonding *bond);
660 int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave);
661 void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay);
662 void bond_work_init_all(struct bonding *bond);
665 void bond_create_proc_entry(struct bonding *bond);
666 void bond_remove_proc_entry(struct bonding *bond);
670 static inline void bond_create_proc_entry(struct bonding *bond)
674 static inline void bond_remove_proc_entry(struct bonding *bond)
687 static inline struct slave *bond_slave_has_mac(struct bonding *bond,
693 bond_for_each_slave(bond, tmp, iter)
701 static inline bool bond_slave_has_mac_rcu(struct bonding *bond, const u8 *mac)
706 bond_for_each_slave_rcu(bond, tmp, iter)