mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
net: remove iflink field from struct net_device
Now that all users of iflink have the ndo_get_iflink handler available, it's possible to remove this field. By default, dev_get_iflink() returns the ifindex of the interface. Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
abd2be00d4
commit
7a66bbc96c
2 changed files with 3 additions and 13 deletions
|
@ -1538,7 +1538,7 @@ struct net_device {
|
|||
netdev_features_t mpls_features;
|
||||
|
||||
int ifindex;
|
||||
int iflink;
|
||||
int group;
|
||||
|
||||
struct net_device_stats stats;
|
||||
|
||||
|
@ -1741,7 +1741,6 @@ struct net_device {
|
|||
#endif
|
||||
struct phy_device *phydev;
|
||||
struct lock_class_key *qdisc_tx_busylock;
|
||||
int group;
|
||||
struct pm_qos_request pm_qos_req;
|
||||
};
|
||||
#define to_net_dev(d) container_of(d, struct net_device, dev)
|
||||
|
|
|
@ -672,7 +672,7 @@ int dev_get_iflink(const struct net_device *dev)
|
|||
if (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink)
|
||||
return dev->netdev_ops->ndo_get_iflink(dev);
|
||||
|
||||
return dev->iflink;
|
||||
return dev->ifindex;
|
||||
}
|
||||
EXPORT_SYMBOL(dev_get_iflink);
|
||||
|
||||
|
@ -6331,8 +6331,6 @@ int register_netdevice(struct net_device *dev)
|
|||
spin_lock_init(&dev->addr_list_lock);
|
||||
netdev_set_addr_lockdep_class(dev);
|
||||
|
||||
dev->iflink = -1;
|
||||
|
||||
ret = dev_get_valid_name(net, dev, dev->name);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
@ -6362,9 +6360,6 @@ int register_netdevice(struct net_device *dev)
|
|||
else if (__dev_get_by_index(net, dev->ifindex))
|
||||
goto err_uninit;
|
||||
|
||||
if (dev_get_iflink(dev) == -1)
|
||||
dev->iflink = dev->ifindex;
|
||||
|
||||
/* Transfer changeable features to wanted_features and enable
|
||||
* software offloads (GSO and GRO).
|
||||
*/
|
||||
|
@ -7077,12 +7072,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
|
|||
dev_net_set(dev, net);
|
||||
|
||||
/* If there is an ifindex conflict assign a new one */
|
||||
if (__dev_get_by_index(net, dev->ifindex)) {
|
||||
int iflink = (dev_get_iflink(dev) == dev->ifindex);
|
||||
if (__dev_get_by_index(net, dev->ifindex))
|
||||
dev->ifindex = dev_new_index(net);
|
||||
if (iflink)
|
||||
dev->iflink = dev->ifindex;
|
||||
}
|
||||
|
||||
/* Send a netdev-add uevent to the new namespace */
|
||||
kobject_uevent(&dev->dev.kobj, KOBJ_ADD);
|
||||
|
|
Loading…
Reference in a new issue