Commit 21357b61 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski

net: mscc: ocelot: rename aggr_count to num_ports_in_lag

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: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 528d3f19
...@@ -1298,8 +1298,8 @@ static void ocelot_set_aggr_pgids(struct ocelot *ocelot) ...@@ -1298,8 +1298,8 @@ static void ocelot_set_aggr_pgids(struct ocelot *ocelot)
/* Now, set PGIDs for each active LAG */ /* Now, set PGIDs for each active LAG */
for (lag = 0; lag < ocelot->num_phys_ports; lag++) { for (lag = 0; lag < ocelot->num_phys_ports; lag++) {
struct net_device *bond = ocelot->ports[lag]->bond; struct net_device *bond = ocelot->ports[lag]->bond;
int num_ports_in_lag = 0;
unsigned long bond_mask; unsigned long bond_mask;
int aggr_count = 0;
u8 aggr_idx[16]; u8 aggr_idx[16];
if (!bond || (visited & BIT(lag))) if (!bond || (visited & BIT(lag)))
...@@ -1311,8 +1311,7 @@ static void ocelot_set_aggr_pgids(struct ocelot *ocelot) ...@@ -1311,8 +1311,7 @@ static void ocelot_set_aggr_pgids(struct ocelot *ocelot)
// Destination mask // Destination mask
ocelot_write_rix(ocelot, bond_mask, ocelot_write_rix(ocelot, bond_mask,
ANA_PGID_PGID, port); ANA_PGID_PGID, port);
aggr_idx[aggr_count] = port; aggr_idx[num_ports_in_lag++] = port;
aggr_count++;
} }
for_each_aggr_pgid(ocelot, i) { for_each_aggr_pgid(ocelot, i) {
...@@ -1320,7 +1319,7 @@ static void ocelot_set_aggr_pgids(struct ocelot *ocelot) ...@@ -1320,7 +1319,7 @@ static void ocelot_set_aggr_pgids(struct ocelot *ocelot)
ac = ocelot_read_rix(ocelot, ANA_PGID_PGID, i); ac = ocelot_read_rix(ocelot, ANA_PGID_PGID, i);
ac &= ~bond_mask; 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); ocelot_write_rix(ocelot, ac, ANA_PGID_PGID, i);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment