Skip to content

Commit

Permalink
net: dsa: use ports list for routing table setup
Browse files Browse the repository at this point in the history
Use the new ports list instead of accessing the dsa_switch array
of ports when iterating over DSA ports of a switch to set up the
routing table.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
  • Loading branch information
vivien authored and Jakub Kicinski committed Oct 22, 2019
1 parent fb35c60 commit 86bfb2c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions net/dsa/dsa2.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,16 @@ static bool dsa_port_setup_routing_table(struct dsa_port *dp)

static bool dsa_switch_setup_routing_table(struct dsa_switch *ds)
{
struct dsa_switch_tree *dst = ds->dst;
bool complete = true;
struct dsa_port *dp;
int i;

for (i = 0; i < DSA_MAX_SWITCHES; i++)
ds->rtable[i] = DSA_RTABLE_NONE;

for (i = 0; i < ds->num_ports; i++) {
dp = &ds->ports[i];

if (dsa_port_is_dsa(dp)) {
list_for_each_entry(dp, &dst->ports, list) {
if (dp->ds == ds && dsa_port_is_dsa(dp)) {
complete = dsa_port_setup_routing_table(dp);
if (!complete)
break;
Expand Down

0 comments on commit 86bfb2c

Please sign in to comment.