--- zzzz-none-000/linux-5.4.213/include/net/bonding.h 2022-09-15 10:04:56.000000000 +0000 +++ miami-7690-761/linux-5.4.213/include/net/bonding.h 2024-05-29 11:20:02.000000000 +0000 @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -86,6 +87,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; @@ -196,6 +199,22 @@ */ #define BOND_LINK_NOCHANGE -1 +/** + * mlo_bond_info - mlo_bond_info structure maintains members corresponding to wifi 7 + * @bond_mlo_xmit_netdev: Callback function to provide skb to wifi driver for xmit + * @bond_get_mlo_tx_netdev: Callback function to get link interface from wifi driver for transmit + * @bond_mlo_ctx: Private member for wifi driver + * @wdev: ieee80211_ptr for wifi VAP + * @bond_mlo_netdev_priv_destructor: Callback function to remove wiphy instance from wifi driver + */ +struct mlo_bond_info { + int (*bond_mlo_xmit_netdev)(struct sk_buff *skb, struct net_device *bond_dev); + struct net_device *(*bond_get_mlo_tx_netdev)(void *bond_mlo_ctx, void *dst); + void *bond_mlo_ctx; + struct wireless_dev *wdev; + void (*bond_mlo_netdev_priv_destructor)(struct net_device *bond_dev); +}; + /* * Here are the locking policies for the two bonding locks: * Get rcu_read_lock when reading or RTNL when writing slave list. @@ -243,6 +262,9 @@ #endif /* CONFIG_DEBUG_FS */ struct rtnl_link_stats64 bond_stats; struct lock_class_key stats_lock_key; + u32 id; + /* MLO mode info */ + struct mlo_bond_info mlo_info; }; #define bond_slave_get_rcu(dev) \ @@ -260,6 +282,19 @@ }; /** + * Returns False if the net_device is not MLO bond netdvice + * + */ +static inline bool bond_is_mlo_device(struct net_device *bond_dev) +{ + struct bonding *bond = netdev_priv(bond_dev); + if (BOND_MODE(bond) == BOND_MODE_MLO) + return true; + + return false; +} + +/** * Returns NULL if the net_device does not belong to any of the bond's slaves * * Caller must hold bond lock for read @@ -605,6 +640,12 @@ return addr; } +static inline struct mlo_bond_info *bond_get_mlo_priv(struct net_device *bond_dev) +{ + struct bonding *bond = netdev_priv(bond_dev); + return &bond->mlo_info; +} + struct bond_net { struct net *net; /* Associated network namespace */ struct list_head dev_list; @@ -617,14 +658,17 @@ int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave); void bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev); int bond_create(struct net *net, const char *name); +extern struct net_device *bond_create_mlo(struct net *net, const char *name, struct mlo_bond_info *mlo_info); +extern void *bond_get_mlo_ctx(struct net_device *bond_dev); +extern bool bond_destroy_mlo(struct net_device *bond_dev); int bond_create_sysfs(struct bond_net *net); void bond_destroy_sysfs(struct bond_net *net); void bond_prepare_sysfs_group(struct bonding *bond); int bond_sysfs_slave_add(struct slave *slave); void bond_sysfs_slave_del(struct slave *slave); -int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, +extern int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev, struct netlink_ext_ack *extack); -int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); +extern int bond_release(struct net_device *bond_dev, struct net_device *slave_dev); u32 bond_xmit_hash(struct bonding *bond, struct sk_buff *skb); int bond_set_carrier(struct bonding *bond); void bond_select_active_slave(struct bonding *bond); @@ -646,6 +690,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_work_init_all(struct bonding *bond); #ifdef CONFIG_PROC_FS @@ -757,4 +806,17 @@ 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 */