[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210116005943.219479-13-olteanv@gmail.com>
Date: Sat, 16 Jan 2021 02:59:41 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: netdev <netdev@...r.kernel.org>,
Microchip Linux Driver Support <UNGLinuxDriver@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Claudiu Manoil <claudiu.manoil@....com>,
Tobias Waldekranz <tobias@...dekranz.com>,
Maxim Kochetkov <fido_max@...ox.ru>
Subject: [PATCH v2 net-next 12/14] net: mscc: ocelot: rename aggr_count to num_ports_in_lag
From: Vladimir Oltean <vladimir.oltean@....com>
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 <vladimir.oltean@....com>
---
Changes in v2:
None.
drivers/net/ethernet/mscc/ocelot.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index fa2ebfbb33eb..78a468d39e9b 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -1244,8 +1244,8 @@ static int ocelot_set_aggr_pgids(struct ocelot *ocelot)
/* Now, set PGIDs for each LAG */
for (lag = 0; lag < ocelot->num_phys_ports; lag++) {
+ int num_ports_in_lag = 0;
unsigned long bond_mask;
- int aggr_count = 0;
u8 aggr_idx[16];
if (!bonds[lag])
@@ -1257,8 +1257,7 @@ static int 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) {
@@ -1266,7 +1265,7 @@ static int ocelot_set_aggr_pgids(struct ocelot *ocelot)
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);
}
--
2.25.1
Powered by blists - more mailing lists