Skip to content

Commit

Permalink
net: mscc: ocelot: rename aggr_count to num_ports_in_lag
Browse files Browse the repository at this point in the history
It makes it a bit easier to read and understand the code that deals with
balancing the 16 aggregation codes among the ports in a certain LAG.

Signed-off-by: Vladimir Oltean <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
vladimiroltean authored and kuba-moo committed Feb 6, 2021
1 parent 528d3f1 commit 21357b6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions drivers/net/ethernet/mscc/ocelot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1298,8 +1298,8 @@ static void ocelot_set_aggr_pgids(struct ocelot *ocelot)
/* Now, set PGIDs for each active LAG */
for (lag = 0; lag < ocelot->num_phys_ports; lag++) {
struct net_device *bond = ocelot->ports[lag]->bond;
int num_ports_in_lag = 0;
unsigned long bond_mask;
int aggr_count = 0;
u8 aggr_idx[16];

if (!bond || (visited & BIT(lag)))
Expand All @@ -1311,16 +1311,15 @@ static void ocelot_set_aggr_pgids(struct ocelot *ocelot)
// Destination mask
ocelot_write_rix(ocelot, bond_mask,
ANA_PGID_PGID, port);
aggr_idx[aggr_count] = port;
aggr_count++;
aggr_idx[num_ports_in_lag++] = port;
}

for_each_aggr_pgid(ocelot, i) {
u32 ac;

ac = ocelot_read_rix(ocelot, ANA_PGID_PGID, i);
ac &= ~bond_mask;
ac |= BIT(aggr_idx[i % aggr_count]);
ac |= BIT(aggr_idx[i % num_ports_in_lag]);
ocelot_write_rix(ocelot, ac, ANA_PGID_PGID, i);
}

Expand Down

0 comments on commit 21357b6

Please sign in to comment.