net: dsa: define port types
Introduce an enumerated type for ports, which will be way more explicit to identify a port type instead of digging into switch port masks. A port can be of type CPU, DSA, user, or unused by default. This is a static parsed information that cannot be changed at runtime. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
02bc6e546e
commit
057cad2c59
@@ -185,6 +185,7 @@ static int dsa_ds_complete(struct dsa_switch_tree *dst, struct dsa_switch *ds)
|
||||
return err;
|
||||
|
||||
ds->dsa_port_mask |= BIT(index);
|
||||
port->type = DSA_PORT_TYPE_DSA;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -504,6 +505,7 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
|
||||
* net/dsa/dsa.c::dsa_switch_setup_one does.
|
||||
*/
|
||||
ds->cpu_port_mask |= BIT(index);
|
||||
port->type = DSA_PORT_TYPE_CPU;
|
||||
|
||||
tag_protocol = ds->ops->get_tag_protocol(ds);
|
||||
tag_ops = dsa_resolve_tag_protocol(tag_protocol);
|
||||
@@ -543,6 +545,7 @@ static int dsa_ds_parse(struct dsa_switch_tree *dst, struct dsa_switch *ds)
|
||||
* net/dsa/dsa.c::dsa_switch_setup_one does.
|
||||
*/
|
||||
ds->enabled_port_mask |= BIT(index);
|
||||
port->type = DSA_PORT_TYPE_USER;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user