On Wed, Dec 02, 2020 at 12:07, Vladimir Oltean <olte...@gmail.com> wrote: > On Wed, Dec 02, 2020 at 10:13:54AM +0100, Tobias Waldekranz wrote: >> + >> + /* Link aggregates */ >> + struct { >> + struct dsa_lag *pool; >> + unsigned long *busy; >> + unsigned int num; > > Can we get rid of the busy array and just look at the refcounts?
We can, but it is typically 4/8B that makes iterating over used LAGs, finding the first free LAG etc. much easier. > Can we also get rid of the "num" variable? It can be computed but it requires traversing the entire dst port list every time, as you can see in dsa_tree_setup_lags. We need to hoist the lowest supported num up from the ds level to the dst.