summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-01-17 20:41:39 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-18 16:49:47 -0500
commit9520ed8fb8410dcb6babf751561a08f73ca03812 (patch)
treeee7e664f866902ca3befac6dc0294c755dfa3b2d /net
parentb22de490869da354116ea4cbbaa09dcbc260b2b4 (diff)
net: dsa: use cpu_switch instead of ds[0]
Now that the DSA Ethernet switches are true Linux devices, the CPU switch is not necessarily the first one. If its address is higher than the second switch on the same MDIO bus, its index will be 1, not 0. Avoid any confusion by using dst->cpu_switch instead of dst->ds[0]. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/dsa/dsa.c2
-rw-r--r--net/dsa/dsa2.c8
-rw-r--r--net/dsa/slave.c6
-rw-r--r--net/dsa/tag_brcm.c2
-rw-r--r--net/dsa/tag_qca.c2
-rw-r--r--net/dsa/tag_trailer.c2
6 files changed, 11 insertions, 11 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index b220609cfe6f..91f96e1bd2ec 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -868,7 +868,7 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
868 dsa_switch_destroy(ds); 868 dsa_switch_destroy(ds);
869 } 869 }
870 870
871 dsa_cpu_port_ethtool_restore(dst->ds[0]); 871 dsa_cpu_port_ethtool_restore(dst->cpu_switch);
872 872
873 dev_put(dst->master_netdev); 873 dev_put(dst->master_netdev);
874} 874}
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 020e072b4299..866222a8f9bf 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -377,8 +377,8 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
377 return err; 377 return err;
378 } 378 }
379 379
380 if (dst->ds[0]) { 380 if (dst->cpu_switch) {
381 err = dsa_cpu_port_ethtool_setup(dst->ds[0]); 381 err = dsa_cpu_port_ethtool_setup(dst->cpu_switch);
382 if (err) 382 if (err)
383 return err; 383 return err;
384 } 384 }
@@ -418,8 +418,8 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
418 dsa_ds_unapply(dst, ds); 418 dsa_ds_unapply(dst, ds);
419 } 419 }
420 420
421 if (dst->ds[0]) 421 if (dst->cpu_switch)
422 dsa_cpu_port_ethtool_restore(dst->ds[0]); 422 dsa_cpu_port_ethtool_restore(dst->cpu_switch);
423 423
424 pr_info("DSA: tree %d unapplied\n", dst->tree); 424 pr_info("DSA: tree %d unapplied\n", dst->tree);
425 dst->applied = false; 425 dst->applied = false;
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 0cdcaf526987..b8e58689a9a1 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -781,7 +781,7 @@ static void dsa_cpu_port_get_ethtool_stats(struct net_device *dev,
781 uint64_t *data) 781 uint64_t *data)
782{ 782{
783 struct dsa_switch_tree *dst = dev->dsa_ptr; 783 struct dsa_switch_tree *dst = dev->dsa_ptr;
784 struct dsa_switch *ds = dst->ds[0]; 784 struct dsa_switch *ds = dst->cpu_switch;
785 s8 cpu_port = dst->cpu_port; 785 s8 cpu_port = dst->cpu_port;
786 int count = 0; 786 int count = 0;
787 787
@@ -798,7 +798,7 @@ static void dsa_cpu_port_get_ethtool_stats(struct net_device *dev,
798static int dsa_cpu_port_get_sset_count(struct net_device *dev, int sset) 798static int dsa_cpu_port_get_sset_count(struct net_device *dev, int sset)
799{ 799{
800 struct dsa_switch_tree *dst = dev->dsa_ptr; 800 struct dsa_switch_tree *dst = dev->dsa_ptr;
801 struct dsa_switch *ds = dst->ds[0]; 801 struct dsa_switch *ds = dst->cpu_switch;
802 int count = 0; 802 int count = 0;
803 803
804 if (dst->master_ethtool_ops.get_sset_count) 804 if (dst->master_ethtool_ops.get_sset_count)
@@ -814,7 +814,7 @@ static void dsa_cpu_port_get_strings(struct net_device *dev,
814 uint32_t stringset, uint8_t *data) 814 uint32_t stringset, uint8_t *data)
815{ 815{
816 struct dsa_switch_tree *dst = dev->dsa_ptr; 816 struct dsa_switch_tree *dst = dev->dsa_ptr;
817 struct dsa_switch *ds = dst->ds[0]; 817 struct dsa_switch *ds = dst->cpu_switch;
818 s8 cpu_port = dst->cpu_port; 818 s8 cpu_port = dst->cpu_port;
819 int len = ETH_GSTRING_LEN; 819 int len = ETH_GSTRING_LEN;
820 int mcount = 0, count; 820 int mcount = 0, count;
diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
index 21bffde6e4bf..af82927674e0 100644
--- a/net/dsa/tag_brcm.c
+++ b/net/dsa/tag_brcm.c
@@ -102,7 +102,7 @@ static int brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
102 if (unlikely(dst == NULL)) 102 if (unlikely(dst == NULL))
103 goto out_drop; 103 goto out_drop;
104 104
105 ds = dst->ds[0]; 105 ds = dst->cpu_switch;
106 106
107 skb = skb_unshare(skb, GFP_ATOMIC); 107 skb = skb_unshare(skb, GFP_ATOMIC);
108 if (skb == NULL) 108 if (skb == NULL)
diff --git a/net/dsa/tag_qca.c b/net/dsa/tag_qca.c
index 0c90cacee7aa..736ca8e8c31e 100644
--- a/net/dsa/tag_qca.c
+++ b/net/dsa/tag_qca.c
@@ -104,7 +104,7 @@ static int qca_tag_rcv(struct sk_buff *skb, struct net_device *dev,
104 /* This protocol doesn't support cascading multiple switches so it's 104 /* This protocol doesn't support cascading multiple switches so it's
105 * safe to assume the switch is first in the tree 105 * safe to assume the switch is first in the tree
106 */ 106 */
107 ds = dst->ds[0]; 107 ds = dst->cpu_switch;
108 if (!ds) 108 if (!ds)
109 goto out_drop; 109 goto out_drop;
110 110
diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c
index 5e3903eb1afa..271128a2dc64 100644
--- a/net/dsa/tag_trailer.c
+++ b/net/dsa/tag_trailer.c
@@ -67,7 +67,7 @@ static int trailer_rcv(struct sk_buff *skb, struct net_device *dev,
67 67
68 if (unlikely(dst == NULL)) 68 if (unlikely(dst == NULL))
69 goto out_drop; 69 goto out_drop;
70 ds = dst->ds[0]; 70 ds = dst->cpu_switch;
71 71
72 skb = skb_unshare(skb, GFP_ATOMIC); 72 skb = skb_unshare(skb, GFP_ATOMIC);
73 if (skb == NULL) 73 if (skb == NULL)