mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
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>
This commit is contained in:
parent
b22de49086
commit
9520ed8fb8
6 changed files with 11 additions and 11 deletions
|
@ -868,7 +868,7 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
|
||||||
dsa_switch_destroy(ds);
|
dsa_switch_destroy(ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
dsa_cpu_port_ethtool_restore(dst->ds[0]);
|
dsa_cpu_port_ethtool_restore(dst->cpu_switch);
|
||||||
|
|
||||||
dev_put(dst->master_netdev);
|
dev_put(dst->master_netdev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,8 +377,8 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst->ds[0]) {
|
if (dst->cpu_switch) {
|
||||||
err = dsa_cpu_port_ethtool_setup(dst->ds[0]);
|
err = dsa_cpu_port_ethtool_setup(dst->cpu_switch);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -418,8 +418,8 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
|
||||||
dsa_ds_unapply(dst, ds);
|
dsa_ds_unapply(dst, ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst->ds[0])
|
if (dst->cpu_switch)
|
||||||
dsa_cpu_port_ethtool_restore(dst->ds[0]);
|
dsa_cpu_port_ethtool_restore(dst->cpu_switch);
|
||||||
|
|
||||||
pr_info("DSA: tree %d unapplied\n", dst->tree);
|
pr_info("DSA: tree %d unapplied\n", dst->tree);
|
||||||
dst->applied = false;
|
dst->applied = false;
|
||||||
|
|
|
@ -781,7 +781,7 @@ static void dsa_cpu_port_get_ethtool_stats(struct net_device *dev,
|
||||||
uint64_t *data)
|
uint64_t *data)
|
||||||
{
|
{
|
||||||
struct dsa_switch_tree *dst = dev->dsa_ptr;
|
struct dsa_switch_tree *dst = dev->dsa_ptr;
|
||||||
struct dsa_switch *ds = dst->ds[0];
|
struct dsa_switch *ds = dst->cpu_switch;
|
||||||
s8 cpu_port = dst->cpu_port;
|
s8 cpu_port = dst->cpu_port;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
@ -798,7 +798,7 @@ static void dsa_cpu_port_get_ethtool_stats(struct net_device *dev,
|
||||||
static int dsa_cpu_port_get_sset_count(struct net_device *dev, int sset)
|
static int dsa_cpu_port_get_sset_count(struct net_device *dev, int sset)
|
||||||
{
|
{
|
||||||
struct dsa_switch_tree *dst = dev->dsa_ptr;
|
struct dsa_switch_tree *dst = dev->dsa_ptr;
|
||||||
struct dsa_switch *ds = dst->ds[0];
|
struct dsa_switch *ds = dst->cpu_switch;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (dst->master_ethtool_ops.get_sset_count)
|
if (dst->master_ethtool_ops.get_sset_count)
|
||||||
|
@ -814,7 +814,7 @@ static void dsa_cpu_port_get_strings(struct net_device *dev,
|
||||||
uint32_t stringset, uint8_t *data)
|
uint32_t stringset, uint8_t *data)
|
||||||
{
|
{
|
||||||
struct dsa_switch_tree *dst = dev->dsa_ptr;
|
struct dsa_switch_tree *dst = dev->dsa_ptr;
|
||||||
struct dsa_switch *ds = dst->ds[0];
|
struct dsa_switch *ds = dst->cpu_switch;
|
||||||
s8 cpu_port = dst->cpu_port;
|
s8 cpu_port = dst->cpu_port;
|
||||||
int len = ETH_GSTRING_LEN;
|
int len = ETH_GSTRING_LEN;
|
||||||
int mcount = 0, count;
|
int mcount = 0, count;
|
||||||
|
|
|
@ -102,7 +102,7 @@ static int brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||||
if (unlikely(dst == NULL))
|
if (unlikely(dst == NULL))
|
||||||
goto out_drop;
|
goto out_drop;
|
||||||
|
|
||||||
ds = dst->ds[0];
|
ds = dst->cpu_switch;
|
||||||
|
|
||||||
skb = skb_unshare(skb, GFP_ATOMIC);
|
skb = skb_unshare(skb, GFP_ATOMIC);
|
||||||
if (skb == NULL)
|
if (skb == NULL)
|
||||||
|
|
|
@ -104,7 +104,7 @@ static int qca_tag_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||||
/* This protocol doesn't support cascading multiple switches so it's
|
/* This protocol doesn't support cascading multiple switches so it's
|
||||||
* safe to assume the switch is first in the tree
|
* safe to assume the switch is first in the tree
|
||||||
*/
|
*/
|
||||||
ds = dst->ds[0];
|
ds = dst->cpu_switch;
|
||||||
if (!ds)
|
if (!ds)
|
||||||
goto out_drop;
|
goto out_drop;
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ static int trailer_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||||
|
|
||||||
if (unlikely(dst == NULL))
|
if (unlikely(dst == NULL))
|
||||||
goto out_drop;
|
goto out_drop;
|
||||||
ds = dst->ds[0];
|
ds = dst->cpu_switch;
|
||||||
|
|
||||||
skb = skb_unshare(skb, GFP_ATOMIC);
|
skb = skb_unshare(skb, GFP_ATOMIC);
|
||||||
if (skb == NULL)
|
if (skb == NULL)
|
||||||
|
|
Loading…
Reference in a new issue