[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1350308008-17189-2-git-send-email-giometti@linux.it>
Date: Mon, 15 Oct 2012 15:33:26 +0200
From: Rodolfo Giometti <giometti@...ux.it>
To: netdev@...r.kernel.org
Cc: Lennert Buytenhek <buytenh@...tstofly.org>,
Rodolfo Giometti <giometti@...ux.it>
Subject: [PATCH] net dsa: add new option "master_netdev_autoup"
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@...ux.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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists