mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
75 lines
2.1 KiB
Diff
75 lines
2.1 KiB
Diff
--- a/drivers/net/bonding/bond_main.c
|
|
+++ b/drivers/net/bonding/bond_main.c
|
|
@@ -247,6 +247,7 @@ static const struct flow_dissector_key f
|
|
};
|
|
|
|
static struct flow_dissector flow_keys_bonding __read_mostly;
|
|
+static unsigned long bond_id_mask = 0xFFFFFFF0;
|
|
|
|
/*-------------------------- Forward declarations ---------------------------*/
|
|
|
|
@@ -301,6 +302,20 @@ netdev_tx_t bond_dev_queue_xmit(struct b
|
|
return dev_queue_xmit(skb);
|
|
}
|
|
|
|
+int bond_get_id(struct net_device *bond_dev)
|
|
+{
|
|
+ struct bonding *bond;
|
|
+
|
|
+ if (!((bond_dev->priv_flags & IFF_BONDING) &&
|
|
+ (bond_dev->flags & IFF_MASTER)))
|
|
+ return -EINVAL;
|
|
+
|
|
+ bond = netdev_priv(bond_dev);
|
|
+
|
|
+ return bond->id;
|
|
+}
|
|
+EXPORT_SYMBOL(bond_get_id);
|
|
+
|
|
/*---------------------------------- VLAN -----------------------------------*/
|
|
|
|
/* In the following 2 functions, bond_vlan_rx_add_vid and bond_vlan_rx_kill_vid,
|
|
@@ -4870,6 +4885,9 @@ static void bond_destructor(struct net_d
|
|
struct bonding *bond = netdev_priv(bond_dev);
|
|
if (bond->wq)
|
|
destroy_workqueue(bond->wq);
|
|
+
|
|
+ if (bond->id != (~0U))
|
|
+ clear_bit(bond->id, &bond_id_mask);
|
|
}
|
|
|
|
void bond_setup(struct net_device *bond_dev)
|
|
@@ -5442,6 +5460,14 @@ int bond_create(struct net *net, const c
|
|
bond_work_init_all(bond);
|
|
|
|
rtnl_unlock();
|
|
+
|
|
+ bond = netdev_priv(bond_dev);
|
|
+ bond->id = ~0U;
|
|
+ if (bond_id_mask != (~0UL)) {
|
|
+ bond->id = (u32)ffz(bond_id_mask);
|
|
+ set_bit(bond->id, &bond_id_mask);
|
|
+ }
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
--- a/include/net/bonding.h
|
|
+++ b/include/net/bonding.h
|
|
@@ -257,6 +257,7 @@ struct bonding {
|
|
/* protecting ipsec_list */
|
|
spinlock_t ipsec_lock;
|
|
#endif /* CONFIG_XFRM_OFFLOAD */
|
|
+ u32 id;
|
|
};
|
|
|
|
#define bond_slave_get_rcu(dev) \
|
|
@@ -629,6 +630,7 @@ struct bond_net {
|
|
|
|
int bond_arp_rcv(const struct sk_buff *skb, struct bonding *bond, struct slave *slave);
|
|
netdev_tx_t bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
|
|
+int bond_get_id(struct net_device *bond_dev);
|
|
int bond_create(struct net *net, const char *name);
|
|
int bond_create_sysfs(struct bond_net *net);
|
|
void bond_destroy_sysfs(struct bond_net *net);
|