Commit 728c0208 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: ipv4: handle DSA enabled master network devices

The logic to configure a network interface for kernel IP
auto-configuration is very simplistic, and does not handle the case
where a device is stacked onto another such as with DSA. This causes the
kernel not to open and configure the master network device in a DSA
switch tree, and therefore slave network devices using this master
network devices as conduit device cannot be open.

This restriction comes from a check in net/dsa/slave.c, which is
basically checking the master netdev flags for IFF_UP and returns
-ENETDOWN if it is not the case.

Automatically bringing-up DSA master network devices allows DSA slave
network devices to be used as valid interfaces for e.g: NFS root booting
by allowing kernel IP autoconfiguration to succeed on these interfaces.

On the reverse path, make sure we do not attempt to close a DSA-enabled
device as this would implicitely prevent the slave DSA network device
from operating.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5bdc7380
...@@ -209,9 +209,9 @@ static int __init ic_open_devs(void) ...@@ -209,9 +209,9 @@ static int __init ic_open_devs(void)
last = &ic_first_dev; last = &ic_first_dev;
rtnl_lock(); rtnl_lock();
/* bring loopback device up first */ /* bring loopback and DSA master network devices up first */
for_each_netdev(&init_net, dev) { for_each_netdev(&init_net, dev) {
if (!(dev->flags & IFF_LOOPBACK)) if (!(dev->flags & IFF_LOOPBACK) && !netdev_uses_dsa(dev))
continue; continue;
if (dev_change_flags(dev, dev->flags | IFF_UP) < 0) if (dev_change_flags(dev, dev->flags | IFF_UP) < 0)
pr_err("IP-Config: Failed to open %s\n", dev->name); pr_err("IP-Config: Failed to open %s\n", dev->name);
...@@ -306,7 +306,7 @@ static void __init ic_close_devs(void) ...@@ -306,7 +306,7 @@ static void __init ic_close_devs(void)
while ((d = next)) { while ((d = next)) {
next = d->next; next = d->next;
dev = d->dev; dev = d->dev;
if (dev != ic_dev) { if (dev != ic_dev && !netdev_uses_dsa(dev)) {
DBG(("IP-Config: Downing %s\n", dev->name)); DBG(("IP-Config: Downing %s\n", dev->name));
dev_change_flags(dev, d->flags); dev_change_flags(dev, d->flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment