--- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -210,6 +210,7 @@ atomic_t netpoll_block_tx = ATOMIC_INIT( #endif unsigned int bond_net_id __read_mostly; +static unsigned long bond_id_mask = 0xFFFFFFF0; /* QCA NSS ECM bonding support */ static const struct flow_dissector_key flow_keys_bonding_keys[] = { { @@ -5872,6 +5873,11 @@ static void bond_destructor(struct net_d if (bond->wq) destroy_workqueue(bond->wq); + /* QCA NSS ECM bonding support - Start */ + if (bond->id != (~0U)) + clear_bit(bond->id, &bond_id_mask); + /* QCA NSS ECM bonding support - End */ + free_percpu(bond->rr_tx_counter); } @@ -6421,6 +6427,13 @@ int bond_create(struct net *net, const c bond_work_init_all(bond); + /* QCA NSS ECM bonding support - Start */ + bond->id = ~0U; + if (bond_id_mask != (~0UL)) { + bond->id = (u32)ffz(bond_id_mask); + set_bit(bond->id, &bond_id_mask); + } + /* QCA NSS ECM bonding support - End */ out: rtnl_unlock(); return res; --- a/include/net/bonding.h +++ b/include/net/bonding.h @@ -261,6 +261,7 @@ struct bonding { spinlock_t ipsec_lock; #endif /* CONFIG_XFRM_OFFLOAD */ struct bpf_prog *xdp_prog; + u32 id;/* QCA NSS ECM bonding support */ }; #define bond_slave_get_rcu(dev) \