From: Rodolfo Giometti <giometti@linux.it>
To: netdev@vger.kernel.org
Cc: Lennert Buytenhek <buytenh@wantstofly.org>,
Rodolfo Giometti <giometti@linux.it>
Subject: [PATCH] net dsa: add new option "master_netdev_autoup"
Date: Mon, 15 Oct 2012 15:33:26 +0200 [thread overview]
Message-ID: <1350308008-17189-2-git-send-email-giometti@linux.it> (raw)
In-Reply-To: <1350308008-17189-1-git-send-email-giometti@linux.it>
By using this option the user can decide if the master device should
be turned on when one of the slave devices is opened.
This functionality is needed if RootFS over NFS is used throught the
DSA.
Signed-off-by: Rodolfo Giometti <giometti@linux.it>
---
include/net/dsa.h | 8 ++++++++
net/dsa/slave.c | 7 ++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index ff07a86..bd3c8b8 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -63,6 +63,14 @@ struct dsa_platform_data {
struct device *netdev;
/*
+ * Enable the auto-up of the master device when a slave is
+ * open.
+ * This functionality is needed if RootFS over NFS is used
+ * throught the DSA.
+ */
+ unsigned long master_netdev_autoup:1;
+
+ /*
* Info structs describing each of the switch chips
* connected via this network interface.
*/
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 4286964..6e9e4546 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -66,9 +66,14 @@ static int dsa_slave_open(struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct net_device *master = p->parent->dst->master_netdev;
+ struct dsa_platform_data *pd = p->parent->dst->pd;
int err;
- if (!(master->flags & IFF_UP))
+ if (pd->master_netdev_autoup)
+ err = dev_open(master);
+ else
+ err = !(master->flags & IFF_UP);
+ if (err)
return -ENETDOWN;
if (!ether_addr_equal(dev->dev_addr, master->dev_addr)) {
--
1.7.9.5
next prev parent reply other threads:[~2012-10-15 13:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-15 13:33 [PATCH] net dsa: add per port phy address mapping Rodolfo Giometti
2012-10-15 13:33 ` Rodolfo Giometti [this message]
2012-10-16 8:03 ` [PATCH] net dsa: add new option "master_netdev_autoup" Lennert Buytenhek
2012-10-15 13:33 ` [PATCH] net dsa: add TX timestamping support Rodolfo Giometti
2012-10-15 13:33 ` [PATCH] net dsa: add phy's interrupts management Rodolfo Giometti
2012-10-16 8:03 ` Lennert Buytenhek
2012-10-16 8:02 ` [PATCH] net dsa: add per port phy address mapping Lennert Buytenhek
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=1350308008-17189-2-git-send-email-giometti@linux.it \
--to=giometti@linux.it \
--cc=buytenh@wantstofly.org \
--cc=netdev@vger.kernel.org \
/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).