提交 937c7df8 编写于 作者: F Florian Fainelli 提交者: David S. Miller

net: dsa: Pass dsa_port reference to ethtool setup/restore

We do not need to have a reference to a dsa_switch, instead we should
pass a reference to a CPU dsa_port, change that. This is a preliminary
change to better support multiple CPU ports.
Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: NVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1820dd06
...@@ -112,8 +112,9 @@ const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol) ...@@ -112,8 +112,9 @@ const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol)
return ops; return ops;
} }
int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds) int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp)
{ {
struct dsa_switch *ds = cpu_dp->ds;
struct net_device *master; struct net_device *master;
struct ethtool_ops *cpu_ops; struct ethtool_ops *cpu_ops;
...@@ -136,8 +137,9 @@ int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds) ...@@ -136,8 +137,9 @@ int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds)
return 0; return 0;
} }
void dsa_cpu_port_ethtool_restore(struct dsa_switch *ds) void dsa_cpu_port_ethtool_restore(struct dsa_port *cpu_dp)
{ {
struct dsa_switch *ds = cpu_dp->ds;
struct net_device *master; struct net_device *master;
master = ds->dst->master_netdev; master = ds->dst->master_netdev;
......
...@@ -444,7 +444,7 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst) ...@@ -444,7 +444,7 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
} }
if (dst->cpu_dp) { if (dst->cpu_dp) {
err = dsa_cpu_port_ethtool_setup(dst->cpu_dp->ds); err = dsa_cpu_port_ethtool_setup(dst->cpu_dp);
if (err) if (err)
return err; return err;
} }
...@@ -485,7 +485,7 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst) ...@@ -485,7 +485,7 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
} }
if (dst->cpu_dp) if (dst->cpu_dp)
dsa_cpu_port_ethtool_restore(dst->cpu_dp->ds); dsa_cpu_port_ethtool_restore(dst->cpu_dp);
pr_info("DSA: tree %d unapplied\n", dst->tree); pr_info("DSA: tree %d unapplied\n", dst->tree);
dst->applied = false; dst->applied = false;
......
...@@ -103,8 +103,8 @@ int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev, ...@@ -103,8 +103,8 @@ int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev,
struct dsa_port *dport, int port); struct dsa_port *dport, int port);
void dsa_cpu_dsa_destroy(struct dsa_port *dport); void dsa_cpu_dsa_destroy(struct dsa_port *dport);
const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol); const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol);
int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds); int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp);
void dsa_cpu_port_ethtool_restore(struct dsa_switch *ds); void dsa_cpu_port_ethtool_restore(struct dsa_port *cpu_dp);
/* legacy.c */ /* legacy.c */
int dsa_legacy_register(void); int dsa_legacy_register(void);
......
...@@ -205,7 +205,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent) ...@@ -205,7 +205,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
netdev_err(dst->master_netdev, "[%d] : can't configure CPU and DSA ports\n", netdev_err(dst->master_netdev, "[%d] : can't configure CPU and DSA ports\n",
index); index);
ret = dsa_cpu_port_ethtool_setup(ds); ret = dsa_cpu_port_ethtool_setup(ds->dst->cpu_dp);
if (ret) if (ret)
return ret; return ret;
...@@ -733,7 +733,7 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst) ...@@ -733,7 +733,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->cpu_dp->ds); dsa_cpu_port_ethtool_restore(dst->cpu_dp);
dev_put(dst->master_netdev); dev_put(dst->master_netdev);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册