macvlan.c (23289a37e2b127dfc4de1313fba15bb4c9f0cd5b) macvlan.c (81adee47dfb608df3ad0b91d230fb3cef75f0060)
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 *

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

499 if (!real_dev)
500 return -ENODEV;
501
502 *num_tx_queues = real_dev->num_tx_queues;
503 *real_num_tx_queues = real_dev->real_num_tx_queues;
504 return 0;
505}
506
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 *

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

499 if (!real_dev)
500 return -ENODEV;
501
502 *num_tx_queues = real_dev->num_tx_queues;
503 *real_num_tx_queues = real_dev->real_num_tx_queues;
504 return 0;
505}
506
507static int macvlan_newlink(struct net_device *dev,
507static int macvlan_newlink(struct net *src_net, struct net_device *dev,
508 struct nlattr *tb[], struct nlattr *data[])
509{
510 struct macvlan_dev *vlan = netdev_priv(dev);
511 struct macvlan_port *port;
512 struct net_device *lowerdev;
513 int err;
514
515 if (!tb[IFLA_LINK])
516 return -EINVAL;
517
508 struct nlattr *tb[], struct nlattr *data[])
509{
510 struct macvlan_dev *vlan = netdev_priv(dev);
511 struct macvlan_port *port;
512 struct net_device *lowerdev;
513 int err;
514
515 if (!tb[IFLA_LINK])
516 return -EINVAL;
517
518 lowerdev = __dev_get_by_index(dev_net(dev), nla_get_u32(tb[IFLA_LINK]));
518 lowerdev = __dev_get_by_index(src_net, nla_get_u32(tb[IFLA_LINK]));
519 if (lowerdev == NULL)
520 return -ENODEV;
521
522 /* When creating macvlans on top of other macvlans - use
523 * the real device as the lowerdev.
524 */
525 if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) {
526 struct macvlan_dev *lowervlan = netdev_priv(lowerdev);

--- 118 unchanged lines hidden ---
519 if (lowerdev == NULL)
520 return -ENODEV;
521
522 /* When creating macvlans on top of other macvlans - use
523 * the real device as the lowerdev.
524 */
525 if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops) {
526 struct macvlan_dev *lowervlan = netdev_priv(lowerdev);

--- 118 unchanged lines hidden ---