aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa2.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dsa/dsa2.c')
-rw-r--r--net/dsa/dsa2.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 52af8401af07..56e46090526b 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -490,8 +490,6 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
490 enum dsa_tag_protocol tag_protocol; 490 enum dsa_tag_protocol tag_protocol;
491 struct net_device *ethernet_dev; 491 struct net_device *ethernet_dev;
492 struct device_node *ethernet; 492 struct device_node *ethernet;
493 struct dsa_port *p;
494 unsigned int i;
495 493
496 if (port->dn) { 494 if (port->dn) {
497 ethernet = of_parse_phandle(port->dn, "ethernet", 0); 495 ethernet = of_parse_phandle(port->dn, "ethernet", 0);
@@ -509,15 +507,6 @@ static int dsa_cpu_parse(struct dsa_port *port, u32 index,
509 if (!dst->cpu_dp) { 507 if (!dst->cpu_dp) {
510 dst->cpu_dp = port; 508 dst->cpu_dp = port;
511 dst->cpu_dp->netdev = ethernet_dev; 509 dst->cpu_dp->netdev = ethernet_dev;
512
513 for (i = 0; i < ds->num_ports; i++) {
514 p = &ds->ports[i];
515 if (!dsa_port_is_valid(p) ||
516 i == index)
517 continue;
518
519 p->cpu_dp = port;
520 }
521 } 510 }
522 511
523 tag_protocol = ds->ops->get_tag_protocol(ds); 512 tag_protocol = ds->ops->get_tag_protocol(ds);
@@ -572,7 +561,9 @@ static int dsa_ds_parse(struct dsa_switch_tree *dst, struct dsa_switch *ds)
572static int dsa_dst_parse(struct dsa_switch_tree *dst) 561static int dsa_dst_parse(struct dsa_switch_tree *dst)
573{ 562{
574 struct dsa_switch *ds; 563 struct dsa_switch *ds;
564 struct dsa_port *dp;
575 u32 index; 565 u32 index;
566 int port;
576 int err; 567 int err;
577 568
578 for (index = 0; index < DSA_MAX_SWITCHES; index++) { 569 for (index = 0; index < DSA_MAX_SWITCHES; index++) {
@@ -590,6 +581,23 @@ static int dsa_dst_parse(struct dsa_switch_tree *dst)
590 return -EINVAL; 581 return -EINVAL;
591 } 582 }
592 583
584 /* Assign the default CPU port to all ports of the fabric */
585 for (index = 0; index < DSA_MAX_SWITCHES; index++) {
586 ds = dst->ds[index];
587 if (!ds)
588 continue;
589
590 for (port = 0; port < ds->num_ports; port++) {
591 dp = &ds->ports[port];
592 if (!dsa_port_is_valid(dp) ||
593 dsa_port_is_dsa(dp) ||
594 dsa_port_is_cpu(dp))
595 continue;
596
597 dp->cpu_dp = dst->cpu_dp;
598 }
599 }
600
593 pr_info("DSA: tree %d parsed\n", dst->tree); 601 pr_info("DSA: tree %d parsed\n", dst->tree);
594 602
595 return 0; 603 return 0;