aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/dsa.h2
-rw-r--r--net/dsa/dsa.c6
-rw-r--r--net/dsa/dsa2.c7
3 files changed, 14 insertions, 1 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 20b3087ad193..52ab18bc2b0d 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -32,6 +32,8 @@ enum dsa_tag_protocol {
32#define DSA_MAX_SWITCHES 4 32#define DSA_MAX_SWITCHES 4
33#define DSA_MAX_PORTS 12 33#define DSA_MAX_PORTS 12
34 34
35#define DSA_RTABLE_NONE -1
36
35struct dsa_chip_data { 37struct dsa_chip_data {
36 /* 38 /*
37 * How to access the switch configuration registers. 39 * How to access the switch configuration registers.
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 766d2a525ada..7e68bc6bc853 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -774,11 +774,17 @@ static int dsa_of_probe(struct device *dev)
774 774
775 chip_index = -1; 775 chip_index = -1;
776 for_each_available_child_of_node(np, child) { 776 for_each_available_child_of_node(np, child) {
777 int i;
778
777 chip_index++; 779 chip_index++;
778 cd = &pd->chip[chip_index]; 780 cd = &pd->chip[chip_index];
779 781
780 cd->of_node = child; 782 cd->of_node = child;
781 783
784 /* Initialize the routing table */
785 for (i = 0; i < DSA_MAX_SWITCHES; ++i)
786 cd->rtable[i] = DSA_RTABLE_NONE;
787
782 /* When assigning the host device, increment its refcount */ 788 /* When assigning the host device, increment its refcount */
783 cd->host_dev = get_device(&mdio_bus->dev); 789 cd->host_dev = get_device(&mdio_bus->dev);
784 790
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 83b95fc4cede..78e4c0131c30 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -595,7 +595,7 @@ static int _dsa_register_switch(struct dsa_switch *ds, struct device_node *np)
595 struct device_node *ports = dsa_get_ports(ds, np); 595 struct device_node *ports = dsa_get_ports(ds, np);
596 struct dsa_switch_tree *dst; 596 struct dsa_switch_tree *dst;
597 u32 tree, index; 597 u32 tree, index;
598 int err; 598 int i, err;
599 599
600 err = dsa_parse_member(np, &tree, &index); 600 err = dsa_parse_member(np, &tree, &index);
601 if (err) 601 if (err)
@@ -622,6 +622,11 @@ static int _dsa_register_switch(struct dsa_switch *ds, struct device_node *np)
622 622
623 ds->dst = dst; 623 ds->dst = dst;
624 ds->index = index; 624 ds->index = index;
625
626 /* Initialize the routing table */
627 for (i = 0; i < DSA_MAX_SWITCHES; ++i)
628 ds->rtable[i] = DSA_RTABLE_NONE;
629
625 dsa_dst_add_ds(dst, ds, index); 630 dsa_dst_add_ds(dst, ds, index);
626 631
627 err = dsa_dst_complete(dst); 632 err = dsa_dst_complete(dst);