macvlan.c (15c6ff3bc0ff3464a8c7efcdea09c86454571622) macvlan.c (7cd43db77eed83ce9c2086edb402748256e05f14)
1/*
2 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
8 *

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

759
760 if (vlan->mode == MACVLAN_MODE_PASSTHRU) {
761 if (port->count)
762 return -EINVAL;
763 port->passthru = true;
764 memcpy(dev->dev_addr, lowerdev->dev_addr, ETH_ALEN);
765 }
766
1/*
2 * Copyright (c) 2007 Patrick McHardy <kaber@trash.net>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
8 *

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

759
760 if (vlan->mode == MACVLAN_MODE_PASSTHRU) {
761 if (port->count)
762 return -EINVAL;
763 port->passthru = true;
764 memcpy(dev->dev_addr, lowerdev->dev_addr, ETH_ALEN);
765 }
766
767 err = netdev_upper_dev_link(lowerdev, dev);
768 if (err)
769 goto destroy_port;
770
767 port->count += 1;
768 err = register_netdevice(dev);
769 if (err < 0)
771 port->count += 1;
772 err = register_netdevice(dev);
773 if (err < 0)
770 goto destroy_port;
774 goto upper_dev_unlink;
771
772 list_add_tail(&vlan->list, &port->vlans);
773 netif_stacked_transfer_operstate(lowerdev, dev);
774
775 return 0;
776
775
776 list_add_tail(&vlan->list, &port->vlans);
777 netif_stacked_transfer_operstate(lowerdev, dev);
778
779 return 0;
780
781upper_dev_unlink:
782 netdev_upper_dev_unlink(lowerdev, dev);
777destroy_port:
778 port->count -= 1;
779 if (!port->count)
780 macvlan_port_destroy(lowerdev);
781
782 return err;
783}
784EXPORT_SYMBOL_GPL(macvlan_common_newlink);

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

792}
793
794void macvlan_dellink(struct net_device *dev, struct list_head *head)
795{
796 struct macvlan_dev *vlan = netdev_priv(dev);
797
798 list_del(&vlan->list);
799 unregister_netdevice_queue(dev, head);
783destroy_port:
784 port->count -= 1;
785 if (!port->count)
786 macvlan_port_destroy(lowerdev);
787
788 return err;
789}
790EXPORT_SYMBOL_GPL(macvlan_common_newlink);

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

798}
799
800void macvlan_dellink(struct net_device *dev, struct list_head *head)
801{
802 struct macvlan_dev *vlan = netdev_priv(dev);
803
804 list_del(&vlan->list);
805 unregister_netdevice_queue(dev, head);
806 netdev_upper_dev_unlink(vlan->lowerdev, dev);
800}
801EXPORT_SYMBOL_GPL(macvlan_dellink);
802
803static int macvlan_changelink(struct net_device *dev,
804 struct nlattr *tb[], struct nlattr *data[])
805{
806 struct macvlan_dev *vlan = netdev_priv(dev);
807 if (data && data[IFLA_MACVLAN_MODE])

--- 136 unchanged lines hidden ---
807}
808EXPORT_SYMBOL_GPL(macvlan_dellink);
809
810static int macvlan_changelink(struct net_device *dev,
811 struct nlattr *tb[], struct nlattr *data[])
812{
813 struct macvlan_dev *vlan = netdev_priv(dev);
814 if (data && data[IFLA_MACVLAN_MODE])

--- 136 unchanged lines hidden ---