summaryrefslogtreecommitdiff
path: root/net/dsa/dsa2.c
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-10-26 18:22:57 +0300
committerDavid S. Miller <davem@davemloft.net>2017-10-27 18:00:09 +0300
commit057cad2c59d73b0c4a6638546f3099d6fb444094 (patch)
treed5e2c457e3000a1f2e699dac1668320c4a2f66f2 /net/dsa/dsa2.c
parent02bc6e546e858b209c3ebe380a13a73b333b1b3f (diff)
downloadlinux-057cad2c59d73b0c4a6638546f3099d6fb444094.tar.xz
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>
Diffstat (limited to 'net/dsa/dsa2.c')
-rw-r--r--net/dsa/dsa2.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index d43c59c91058..dd6f35b92937 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -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;
}
}