Skip to content

Commit 0cfec58

Browse files
vivienJakub Kicinski
authored andcommitted
net: dsa: use ports list to setup multiple master devices
Now that we have a potential list of CPU ports, make use of it instead of only configuring the master device of an unique CPU port. Signed-off-by: Vivien Didelot <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 764b7e6 commit 0cfec58

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

net/dsa/dsa2.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -493,19 +493,27 @@ static void dsa_tree_teardown_switches(struct dsa_switch_tree *dst)
493493

494494
static int dsa_tree_setup_master(struct dsa_switch_tree *dst)
495495
{
496-
struct dsa_port *cpu_dp = dst->cpu_dp;
497-
struct net_device *master = cpu_dp->master;
496+
struct dsa_port *dp;
497+
int err;
498498

499-
/* DSA currently supports a single pair of CPU port and master device */
500-
return dsa_master_setup(master, cpu_dp);
499+
list_for_each_entry(dp, &dst->ports, list) {
500+
if (dsa_port_is_cpu(dp)) {
501+
err = dsa_master_setup(dp->master, dp);
502+
if (err)
503+
return err;
504+
}
505+
}
506+
507+
return 0;
501508
}
502509

503510
static void dsa_tree_teardown_master(struct dsa_switch_tree *dst)
504511
{
505-
struct dsa_port *cpu_dp = dst->cpu_dp;
506-
struct net_device *master = cpu_dp->master;
512+
struct dsa_port *dp;
507513

508-
return dsa_master_teardown(master);
514+
list_for_each_entry(dp, &dst->ports, list)
515+
if (dsa_port_is_cpu(dp))
516+
dsa_master_teardown(dp->master);
509517
}
510518

511519
static int dsa_tree_setup(struct dsa_switch_tree *dst)

0 commit comments

Comments
 (0)