DSA overrides the master's ethtool ops so that we can inject its CPU
port's statistics. Because of that, we need to setup the ethtool ops
after the master's dsa_ptr pointer has been assigned, not before.
This patch setups the ethtool ops after dsa_ptr is assigned, and
restores them before it gets cleared.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
return err;
}
- err = dsa_cpu_port_ethtool_setup(dst->cpu_dp);
- if (err)
- return err;
-
/* If we use a tagging format that doesn't have an ethertype
* field, make sure that all packets from this point on get
* sent to the tag format's receive function.
*/
wmb();
dst->cpu_dp->netdev->dsa_ptr = dst;
+
+ err = dsa_cpu_port_ethtool_setup(dst->cpu_dp);
+ if (err)
+ return err;
+
dst->applied = true;
return 0;
if (!dst->applied)
return;
+ dsa_cpu_port_ethtool_restore(dst->cpu_dp);
+
dst->cpu_dp->netdev->dsa_ptr = NULL;
/* If we used a tagging format that doesn't have an ethertype
dsa_ds_unapply(dst, ds);
}
- dsa_cpu_port_ethtool_restore(dst->cpu_dp);
dst->cpu_dp = NULL;
pr_info("DSA: tree %d unapplied\n", dst->tree);
netdev_err(master, "[%d] : can't configure CPU and DSA ports\n",
index);
- ret = dsa_cpu_port_ethtool_setup(ds->dst->cpu_dp);
- if (ret)
- return ret;
-
return 0;
}
wmb();
dev->dsa_ptr = dst;
- return 0;
+ return dsa_cpu_port_ethtool_setup(dst->cpu_dp);
}
static int dsa_probe(struct platform_device *pdev)
{
int i;
+ dsa_cpu_port_ethtool_restore(dst->cpu_dp);
+
dst->cpu_dp->netdev->dsa_ptr = NULL;
/* If we used a tagging format that doesn't have an ethertype
dsa_switch_destroy(ds);
}
- dsa_cpu_port_ethtool_restore(dst->cpu_dp);
-
dev_put(dst->cpu_dp->netdev);
}