From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: andrew@lunn.ch, vivien.didelot@savoirfairelinux.com,
john@phrozen.org, Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH 1/3] net: dsa: Pass dsa_port reference to ethtool setup/restore
Date: Fri, 2 Jun 2017 12:31:21 -0700 [thread overview]
Message-ID: <20170602193123.23930-2-f.fainelli@gmail.com> (raw)
In-Reply-To: <20170602193123.23930-1-f.fainelli@gmail.com>
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: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa.c | 6 ++++--
net/dsa/dsa2.c | 4 ++--
net/dsa/dsa_priv.h | 4 ++--
net/dsa/legacy.c | 4 ++--
4 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 402459e73f33..fdc448b30e56 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -112,8 +112,9 @@ const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol)
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 ethtool_ops *cpu_ops;
@@ -136,8 +137,9 @@ int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds)
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;
master = ds->dst->master_netdev;
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 21b44a9828f6..7f9bf1456a65 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -444,7 +444,7 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
}
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)
return err;
}
@@ -485,7 +485,7 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
}
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);
dst->applied = false;
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index db2a7b9edfb8..66ee248796c8 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -103,8 +103,8 @@ int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev,
struct dsa_port *dport, int port);
void dsa_cpu_dsa_destroy(struct dsa_port *dport);
const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol);
-int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds);
-void dsa_cpu_port_ethtool_restore(struct dsa_switch *ds);
+int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp);
+void dsa_cpu_port_ethtool_restore(struct dsa_port *cpu_dp);
/* legacy.c */
int dsa_legacy_register(void);
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index d70a1a788d17..d534d8f4b9cf 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -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",
index);
- ret = dsa_cpu_port_ethtool_setup(ds);
+ ret = dsa_cpu_port_ethtool_setup(ds->dst->cpu_dp);
if (ret)
return ret;
@@ -733,7 +733,7 @@ static void dsa_remove_dst(struct dsa_switch_tree *dst)
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);
}
--
2.9.3
next prev parent reply other threads:[~2017-06-02 19:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-02 19:31 [PATCH 0/3] net: dsa: Cleanups before multi-CPU port Florian Fainelli
2017-06-02 19:31 ` Florian Fainelli [this message]
2017-06-02 19:32 ` [PATCH 1/3] net: dsa: Pass dsa_port reference to ethtool setup/restore Vivien Didelot
2017-06-02 19:31 ` [PATCH 2/3] net: dsa: Consistently use dsa_port for dsa_*_port_{apply,unapply} Florian Fainelli
2017-06-02 19:32 ` Vivien Didelot
2017-06-02 19:31 ` [PATCH 3/3] net: dsa: Initialize all CPU and enabled ports masks in dsa_ds_parse() Florian Fainelli
2017-06-02 19:33 ` Vivien Didelot
2017-06-05 0:06 ` [PATCH 0/3] net: dsa: Cleanups before multi-CPU port David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170602193123.23930-2-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=john@phrozen.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@savoirfairelinux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).