Skip to content

Commit 728c020

Browse files
ffainellidavem330
authored andcommitted
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: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5bdc738 commit 728c020

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/ipv4/ipconfig.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ static int __init ic_open_devs(void)
209209
last = &ic_first_dev;
210210
rtnl_lock();
211211

212-
/* bring loopback device up first */
212+
/* bring loopback and DSA master network devices up first */
213213
for_each_netdev(&init_net, dev) {
214-
if (!(dev->flags & IFF_LOOPBACK))
214+
if (!(dev->flags & IFF_LOOPBACK) && !netdev_uses_dsa(dev))
215215
continue;
216216
if (dev_change_flags(dev, dev->flags | IFF_UP) < 0)
217217
pr_err("IP-Config: Failed to open %s\n", dev->name);
@@ -306,7 +306,7 @@ static void __init ic_close_devs(void)
306306
while ((d = next)) {
307307
next = d->next;
308308
dev = d->dev;
309-
if (dev != ic_dev) {
309+
if (dev != ic_dev && !netdev_uses_dsa(dev)) {
310310
DBG(("IP-Config: Downing %s\n", dev->name));
311311
dev_change_flags(dev, d->flags);
312312
}

0 commit comments

Comments
 (0)