slave.c (b7b14ec1ebef35d22f3f4087816468f22c987f75) slave.c (cc1d5bda17c8eb4cd195f05a5558ed63df057fce)
1/*
2 * net/dsa/slave.c - Slave device handling
3 * Copyright (c) 2008-2009 Marvell Semiconductor
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 1394 unchanged lines hidden (view full) ---

1403 dsa_port_bridge_leave(dp, info->upper_dev);
1404 err = NOTIFY_OK;
1405 }
1406 }
1407
1408 return err;
1409}
1410
1/*
2 * net/dsa/slave.c - Slave device handling
3 * Copyright (c) 2008-2009 Marvell Semiconductor
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 1394 unchanged lines hidden (view full) ---

1403 dsa_port_bridge_leave(dp, info->upper_dev);
1404 err = NOTIFY_OK;
1405 }
1406 }
1407
1408 return err;
1409}
1410
1411static int dsa_slave_upper_vlan_check(struct net_device *dev,
1412 struct netdev_notifier_changeupper_info *
1413 info)
1414{
1415 struct netlink_ext_ack *ext_ack;
1416 struct net_device *slave;
1417 struct dsa_port *dp;
1418
1419 ext_ack = netdev_notifier_info_to_extack(&info->info);
1420
1421 if (!is_vlan_dev(dev))
1422 return NOTIFY_DONE;
1423
1424 slave = vlan_dev_real_dev(dev);
1425 if (!dsa_slave_dev_check(slave))
1426 return NOTIFY_DONE;
1427
1428 dp = dsa_slave_to_port(slave);
1429 if (!dp->bridge_dev)
1430 return NOTIFY_DONE;
1431
1432 /* Deny enslaving a VLAN device into a VLAN-aware bridge */
1433 if (br_vlan_enabled(dp->bridge_dev) &&
1434 netif_is_bridge_master(info->upper_dev) && info->linking) {
1435 NL_SET_ERR_MSG_MOD(ext_ack,
1436 "Cannot enslave VLAN device into VLAN aware bridge");
1437 return notifier_from_errno(-EINVAL);
1438 }
1439
1440 return NOTIFY_DONE;
1441}
1442
1411static int dsa_slave_netdevice_event(struct notifier_block *nb,
1412 unsigned long event, void *ptr)
1413{
1414 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1415
1443static int dsa_slave_netdevice_event(struct notifier_block *nb,
1444 unsigned long event, void *ptr)
1445{
1446 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1447
1416 if (!dsa_slave_dev_check(dev))
1417 return NOTIFY_DONE;
1448 if (event == NETDEV_CHANGEUPPER) {
1449 if (!dsa_slave_dev_check(dev))
1450 return dsa_slave_upper_vlan_check(dev, ptr);
1418
1451
1419 if (event == NETDEV_CHANGEUPPER)
1420 return dsa_slave_changeupper(dev, ptr);
1452 return dsa_slave_changeupper(dev, ptr);
1453 }
1421
1422 return NOTIFY_DONE;
1423}
1424
1425struct dsa_switchdev_event_work {
1426 struct work_struct work;
1427 struct switchdev_notifier_fdb_info fdb_info;
1428 struct net_device *dev;

--- 198 unchanged lines hidden ---
1454
1455 return NOTIFY_DONE;
1456}
1457
1458struct dsa_switchdev_event_work {
1459 struct work_struct work;
1460 struct switchdev_notifier_fdb_info fdb_info;
1461 struct net_device *dev;

--- 198 unchanged lines hidden ---