summaryrefslogtreecommitdiff
path: root/net/dsa/dsa2.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2017-06-13 13:27:21 -0700
committerDavid S. Miller <davem@davemloft.net>2017-06-13 16:35:03 -0400
commita29342e739115211615acc33616e547b2d3e0663 (patch)
tree6502be7ffce35898757e7b7cfac6c4fd87852a0f /net/dsa/dsa2.c
parent67dbb9d433447e358de7d293f15318bb5db9529b (diff)
net: dsa: Associate slave network device with CPU port
In preparation for supporting multiple CPU ports with DSA, have the dsa_port structure know which CPU it is associated with. This will be important in order to make sure the correct CPU is used for transmission of the frames. If not for functional reasons, for performance (e.g: load balancing) and forwarding decisions. Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/dsa2.c')
-rw-r--r--net/dsa/dsa2.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index ab48c4f989da..52af8401af07 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -490,6 +490,8 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
enum dsa_tag_protocol tag_protocol;
struct net_device *ethernet_dev;
struct device_node *ethernet;
+ struct dsa_port *p;
+ unsigned int i;
if (port->dn) {
ethernet = of_parse_phandle(port->dn, "ethernet", 0);
@@ -507,6 +509,15 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
if (!dst->cpu_dp) {
dst->cpu_dp = port;
dst->cpu_dp->netdev = ethernet_dev;
+
+ for (i = 0; i < ds->num_ports; i++) {
+ p = &ds->ports[i];
+ if (!dsa_port_is_valid(p) ||
+ i == index)
+ continue;
+
+ p->cpu_dp = port;
+ }
}
tag_protocol = ds->ops->get_tag_protocol(ds);