summaryrefslogtreecommitdiff
path: root/net/dsa/legacy.c
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-10-26 11:22:57 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-28 00:00:09 +0900
commit057cad2c59d73b0c4a6638546f3099d6fb444094 (patch)
treed5e2c457e3000a1f2e699dac1668320c4a2f66f2 /net/dsa/legacy.c
parent02bc6e546e858b209c3ebe380a13a73b333b1b3f (diff)
downloadlinux-next-057cad2c59d73b0c4a6638546f3099d6fb444094.tar.gz
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/legacy.c')
-rw-r--r--net/dsa/legacy.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index fa543c4a6061..9fd5b3adab1e 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -101,6 +101,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,
struct dsa_chip_data *cd = ds->cd;
bool valid_name_found = false;
int index = ds->index;
+ struct dsa_port *dp;
int i, ret;
/*
@@ -109,6 +110,8 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,
for (i = 0; i < ds->num_ports; i++) {
char *name;
+ dp = &ds->ports[i];
+
name = cd->port_names[i];
if (name == NULL)
continue;
@@ -122,10 +125,13 @@ static int dsa_switch_setup_one(struct dsa_switch *ds,
dst->cpu_dp = &ds->ports[i];
dst->cpu_dp->master = master;
ds->cpu_port_mask |= 1 << i;
+ dp->type = DSA_PORT_TYPE_CPU;
} else if (!strcmp(name, "dsa")) {
ds->dsa_port_mask |= 1 << i;
+ dp->type = DSA_PORT_TYPE_DSA;
} else {
ds->enabled_port_mask |= 1 << i;
+ dp->type = DSA_PORT_TYPE_USER;
}
valid_name_found = true;
}