Commit 0cfec588 authored by Vivien Didelot's avatar Vivien Didelot Committed by Jakub Kicinski

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: default avatarVivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
parent 764b7e62
......@@ -493,19 +493,27 @@ static void dsa_tree_teardown_switches(struct dsa_switch_tree *dst)
static int dsa_tree_setup_master(struct dsa_switch_tree *dst)
{
struct dsa_port *cpu_dp = dst->cpu_dp;
struct net_device *master = cpu_dp->master;
struct dsa_port *dp;
int err;
/* DSA currently supports a single pair of CPU port and master device */
return dsa_master_setup(master, cpu_dp);
list_for_each_entry(dp, &dst->ports, list) {
if (dsa_port_is_cpu(dp)) {
err = dsa_master_setup(dp->master, dp);
if (err)
return err;
}
}
return 0;
}
static void dsa_tree_teardown_master(struct dsa_switch_tree *dst)
{
struct dsa_port *cpu_dp = dst->cpu_dp;
struct net_device *master = cpu_dp->master;
struct dsa_port *dp;
return dsa_master_teardown(master);
list_for_each_entry(dp, &dst->ports, list)
if (dsa_port_is_cpu(dp))
dsa_master_teardown(dp->master);
}
static int dsa_tree_setup(struct dsa_switch_tree *dst)
......
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