summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-12-06 02:01:34 +0300
committerDavid S. Miller <davem@davemloft.net>2017-12-06 02:01:34 +0300
commit8bf543810021ca8aebbec19237b68714f97f7f2c (patch)
treead4d590c6c4bb4e58712ddb02e84d81426b48b02 /include
parent9382a5067ea503069a0bd250d5488a85ce9c9c36 (diff)
parent07073c79bf878988d8d0da94869fa5f9d1aa5005 (diff)
downloadlinux-8bf543810021ca8aebbec19237b68714f97f7f2c.tar.xz
Merge branch 'dsa-use-per-port-upstream-port'
Vivien Didelot says: ==================== net: dsa: use per-port upstream port An upstream port is a local switch port used to reach a CPU port. DSA still considers a unique CPU port in the whole switch fabric and thus return a unique upstream port for a given switch. This is wrong in a multiple CPU ports environment. We are now switching to using the dedicated CPU port assigned to each port in order to get rid of the deprecated unique tree CPU port. This patchset makes the dsa_upstream_port() helper take a port argument and goes one step closer complete support for multiple CPU ports. Changes in v2: - reverse-christmas-tree-fy variables ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/dsa.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 8198efcc8ced..d29feccaefab 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -307,10 +307,13 @@ static inline unsigned int dsa_towards_port(struct dsa_switch *ds, int device,
}
/* Return the local port used to reach the dedicated CPU port */
-static inline u8 dsa_upstream_port(struct dsa_switch *ds)
+static inline unsigned int dsa_upstream_port(struct dsa_switch *ds, int port)
{
- struct dsa_switch_tree *dst = ds->dst;
- struct dsa_port *cpu_dp = dst->cpu_dp;
+ const struct dsa_port *dp = dsa_to_port(ds, port);
+ const struct dsa_port *cpu_dp = dp->cpu_dp;
+
+ if (!cpu_dp)
+ return port;
return dsa_towards_port(ds, cpu_dp->ds->index, cpu_dp->index);
}