aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa2.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2016-06-07 19:32:42 -0400
committerDavid S. Miller <davem@davemloft.net>2016-06-08 14:23:42 -0400
commit0c73c523cf737b5d446705392e0e14ee0411a351 (patch)
tree153ba2b1b3dd0f85c6d6a22e75bc5096bf25249f /net/dsa/dsa2.c
parentaf42192c47c41ec132bda736a78d6d5e0d2999a9 (diff)
net: dsa: Initialize CPU port ethtool ops per tree
Now that we can properly support multiple distinct trees in the system, using a global variable: dsa_cpu_port_ethtool_ops is getting clobbered as soon as the second switch tree gets probed, and we don't want that. We need to move this to be dynamically allocated, and since we can't really be comparing addresses anymore to determine first time initialization versus any other times, just move this to dsa.c and dsa2.c where the remainder of the dst/ds initialization happens. The operations teardown restores the master netdev's ethtool_ops to its original ethtool_ops pointer (typically within the Ethernet driver) Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/dsa2.c')
-rw-r--r--net/dsa/dsa2.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 4e0f3c268103..83b95fc4cede 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -394,6 +394,10 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
394 return err; 394 return err;
395 } 395 }
396 396
397 err = dsa_cpu_port_ethtool_setup(dst->ds[0]);
398 if (err)
399 return err;
400
397 /* If we use a tagging format that doesn't have an ethertype 401 /* If we use a tagging format that doesn't have an ethertype
398 * field, make sure that all packets from this point on get 402 * field, make sure that all packets from this point on get
399 * sent to the tag format's receive function. 403 * sent to the tag format's receive function.
@@ -429,6 +433,8 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
429 dsa_ds_unapply(dst, ds); 433 dsa_ds_unapply(dst, ds);
430 } 434 }
431 435
436 dsa_cpu_port_ethtool_restore(dst->ds[0]);
437
432 pr_info("DSA: tree %d unapplied\n", dst->tree); 438 pr_info("DSA: tree %d unapplied\n", dst->tree);
433 dst->applied = false; 439 dst->applied = false;
434} 440}