--- zzzz-none-000/linux-4.4.271/include/net/bonding.h 2021-06-03 06:22:09.000000000 +0000 +++ maple-fsgw-759/linux-4.4.271/include/net/bonding.h 2023-12-20 10:37:36.000000000 +0000 @@ -29,6 +29,7 @@ #include #include #include +#include #define BOND_MAX_ARP_TARGETS 16 @@ -89,6 +90,8 @@ #define bond_for_each_slave_rcu(bond, pos, iter) \ netdev_for_each_lower_private_rcu((bond)->dev, pos, iter) +extern struct bond_cb __rcu *bond_cb; + #ifdef CONFIG_NET_POLL_CONTROLLER extern atomic_t netpoll_block_tx; @@ -230,6 +233,7 @@ u32 rr_tx_counter; struct ad_bond_info ad_info; struct alb_bond_info alb_info; + struct l2da_bond_info l2da_info; struct bond_params params; struct workqueue_struct *wq; struct delayed_work mii_work; @@ -243,7 +247,22 @@ struct dentry *debug_dir; #endif /* CONFIG_DEBUG_FS */ struct rtnl_link_stats64 bond_stats; + u32 id; +}; + +#pragma pack(1) +struct arp_pkt { + __be16 hw_addr_space; + __be16 prot_addr_space; + u8 hw_addr_len; + u8 prot_addr_len; + __be16 op_code; + u8 mac_src[ETH_ALEN]; /* sender hardware address */ + __be32 ip_src; /* sender IP address */ + u8 mac_dst[ETH_ALEN]; /* target hardware address */ + __be32 ip_dst; /* target IP address */ }; +#pragma pack() #define bond_slave_get_rcu(dev) \ ((struct slave *) rcu_dereference(dev->rx_handler_data)) @@ -286,6 +305,11 @@ BOND_MODE(bond) == BOND_MODE_ALB; } +static inline bool bond_is_l2da(const struct bonding *bond) +{ + return bond->params.mode == BOND_MODE_L2DA; +} + static inline bool bond_is_nondyn_tlb(const struct bonding *bond) { return (BOND_MODE(bond) == BOND_MODE_TLB) && @@ -571,6 +595,11 @@ int level); int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave); void bond_slave_arr_work_rearm(struct bonding *bond, unsigned long delay); +uint32_t bond_xmit_hash_without_skb(uint8_t *src_mac, uint8_t *dst_mac, + void *psrc, void *pdst, uint16_t protocol, + struct net_device *bond_dev, + __be16 *layer4hdr); +void bond_notify_l2da(uint8_t *slave_mac_addr); #ifdef CONFIG_PROC_FS void bond_create_proc_entry(struct bonding *bond); @@ -681,4 +710,16 @@ dev_kfree_skb_any(skb); } +struct bond_cb { + void (*bond_cb_link_up)(struct net_device *slave); + void (*bond_cb_link_down)(struct net_device *slave); + void (*bond_cb_enslave)(struct net_device *slave); + void (*bond_cb_release)(struct net_device *slave); + void (*bond_cb_delete_by_slave)(struct net_device *slave); + void (*bond_cb_delete_by_mac)(uint8_t *mac_addr); +}; + +extern int bond_register_cb(struct bond_cb *cb); +extern void bond_unregister_cb(void); +extern int bond_get_id(struct net_device *bond_dev); #endif /* _NET_BONDING_H */