On Mon, Nov 30, 2020 at 08:22:01PM +0100, Eric Dumazet wrote: > And ? > > A bonding device can absolutely maintain a private list, ready for > bonding ndo_get_stats() use, regardless > of register/unregister logic. > > bond_for_each_slave() is simply a macro, you can replace it by something else.
Also, coming to take the comment at face value. Can it really? How? Freeing a net_device at unregister time happens after an RCU grace period. So whatever the bonding driver does to keep a private list of slave devices, those pointers need to be under RCU protection. And that doesn't help with the sleepable context that we're looking for.