summaryrefslogtreecommitdiffstats
path: root/net/dsa/master.c
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-09-29 17:19:20 -0400
committerDavid S. Miller <davem@davemloft.net>2017-09-30 23:15:07 -0400
commit2f657a600409f1961d67642fe384a9d4be71d36a (patch)
treeff755adac80edd80aa72ab7323e15dd77ee03ebc /net/dsa/master.c
parent3e41f93b358a8800194b87995ad076fc50919719 (diff)
net: dsa: change dsa_ptr for a dsa_port
With DSA, a master net device (CPU facing interface) has a dsa_ptr pointer to which hangs a dsa_switch_tree. This is not correct because a master interface is wired to a dedicated switch port, and because we can theoretically have several master interfaces pointing to several CPU ports of the same switch fabric. Change the master interface's dsa_ptr for the CPU dsa_port pointer. This is a step towards supporting multiple CPU ports. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/master.c')
-rw-r--r--net/dsa/master.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/net/dsa/master.c b/net/dsa/master.c
index ef15d35f1574..5f3f57e372e0 100644
--- a/net/dsa/master.c
+++ b/net/dsa/master.c
@@ -16,8 +16,7 @@ static void dsa_master_get_ethtool_stats(struct net_device *dev,
16 struct ethtool_stats *stats, 16 struct ethtool_stats *stats,
17 uint64_t *data) 17 uint64_t *data)
18{ 18{
19 struct dsa_switch_tree *dst = dev->dsa_ptr; 19 struct dsa_port *cpu_dp = dev->dsa_ptr;
20 struct dsa_port *cpu_dp = dst->cpu_dp;
21 const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops; 20 const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops;
22 struct dsa_switch *ds = cpu_dp->ds; 21 struct dsa_switch *ds = cpu_dp->ds;
23 int port = cpu_dp->index; 22 int port = cpu_dp->index;
@@ -34,8 +33,7 @@ static void dsa_master_get_ethtool_stats(struct net_device *dev,
34 33
35static int dsa_master_get_sset_count(struct net_device *dev, int sset) 34static int dsa_master_get_sset_count(struct net_device *dev, int sset)
36{ 35{
37 struct dsa_switch_tree *dst = dev->dsa_ptr; 36 struct dsa_port *cpu_dp = dev->dsa_ptr;
38 struct dsa_port *cpu_dp = dst->cpu_dp;
39 const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops; 37 const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops;
40 struct dsa_switch *ds = cpu_dp->ds; 38 struct dsa_switch *ds = cpu_dp->ds;
41 int count = 0; 39 int count = 0;
@@ -52,8 +50,7 @@ static int dsa_master_get_sset_count(struct net_device *dev, int sset)
52static void dsa_master_get_strings(struct net_device *dev, uint32_t stringset, 50static void dsa_master_get_strings(struct net_device *dev, uint32_t stringset,
53 uint8_t *data) 51 uint8_t *data)
54{ 52{
55 struct dsa_switch_tree *dst = dev->dsa_ptr; 53 struct dsa_port *cpu_dp = dev->dsa_ptr;
56 struct dsa_port *cpu_dp = dst->cpu_dp;
57 const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops; 54 const struct ethtool_ops *ops = cpu_dp->orig_ethtool_ops;
58 struct dsa_switch *ds = cpu_dp->ds; 55 struct dsa_switch *ds = cpu_dp->ds;
59 int port = cpu_dp->index; 56 int port = cpu_dp->index;
@@ -90,8 +87,7 @@ static void dsa_master_get_strings(struct net_device *dev, uint32_t stringset,
90 87
91int dsa_master_ethtool_setup(struct net_device *dev) 88int dsa_master_ethtool_setup(struct net_device *dev)
92{ 89{
93 struct dsa_switch_tree *dst = dev->dsa_ptr; 90 struct dsa_port *cpu_dp = dev->dsa_ptr;
94 struct dsa_port *cpu_dp = dst->cpu_dp;
95 struct dsa_switch *ds = cpu_dp->ds; 91 struct dsa_switch *ds = cpu_dp->ds;
96 struct ethtool_ops *ops; 92 struct ethtool_ops *ops;
97 93
@@ -114,8 +110,7 @@ int dsa_master_ethtool_setup(struct net_device *dev)
114 110
115void dsa_master_ethtool_restore(struct net_device *dev) 111void dsa_master_ethtool_restore(struct net_device *dev)
116{ 112{
117 struct dsa_switch_tree *dst = dev->dsa_ptr; 113 struct dsa_port *cpu_dp = dev->dsa_ptr;
118 struct dsa_port *cpu_dp = dst->cpu_dp;
119 114
120 dev->ethtool_ops = cpu_dp->orig_ethtool_ops; 115 dev->ethtool_ops = cpu_dp->orig_ethtool_ops;
121 cpu_dp->orig_ethtool_ops = NULL; 116 cpu_dp->orig_ethtool_ops = NULL;