提交 7a66bbc9 编写于 作者: N Nicolas Dichtel 提交者: David S. Miller

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: NNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 abd2be00
...@@ -1538,7 +1538,7 @@ struct net_device { ...@@ -1538,7 +1538,7 @@ struct net_device {
netdev_features_t mpls_features; netdev_features_t mpls_features;
int ifindex; int ifindex;
int iflink; int group;
struct net_device_stats stats; struct net_device_stats stats;
...@@ -1741,7 +1741,6 @@ struct net_device { ...@@ -1741,7 +1741,6 @@ struct net_device {
#endif #endif
struct phy_device *phydev; struct phy_device *phydev;
struct lock_class_key *qdisc_tx_busylock; struct lock_class_key *qdisc_tx_busylock;
int group;
struct pm_qos_request pm_qos_req; struct pm_qos_request pm_qos_req;
}; };
#define to_net_dev(d) container_of(d, struct net_device, dev) #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) ...@@ -672,7 +672,7 @@ int dev_get_iflink(const struct net_device *dev)
if (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink) if (dev->netdev_ops && dev->netdev_ops->ndo_get_iflink)
return dev->netdev_ops->ndo_get_iflink(dev); return dev->netdev_ops->ndo_get_iflink(dev);
return dev->iflink; return dev->ifindex;
} }
EXPORT_SYMBOL(dev_get_iflink); EXPORT_SYMBOL(dev_get_iflink);
...@@ -6331,8 +6331,6 @@ int register_netdevice(struct net_device *dev) ...@@ -6331,8 +6331,6 @@ int register_netdevice(struct net_device *dev)
spin_lock_init(&dev->addr_list_lock); spin_lock_init(&dev->addr_list_lock);
netdev_set_addr_lockdep_class(dev); netdev_set_addr_lockdep_class(dev);
dev->iflink = -1;
ret = dev_get_valid_name(net, dev, dev->name); ret = dev_get_valid_name(net, dev, dev->name);
if (ret < 0) if (ret < 0)
goto out; goto out;
...@@ -6362,9 +6360,6 @@ int register_netdevice(struct net_device *dev) ...@@ -6362,9 +6360,6 @@ int register_netdevice(struct net_device *dev)
else if (__dev_get_by_index(net, dev->ifindex)) else if (__dev_get_by_index(net, dev->ifindex))
goto err_uninit; goto err_uninit;
if (dev_get_iflink(dev) == -1)
dev->iflink = dev->ifindex;
/* Transfer changeable features to wanted_features and enable /* Transfer changeable features to wanted_features and enable
* software offloads (GSO and GRO). * software offloads (GSO and GRO).
*/ */
...@@ -7077,12 +7072,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char ...@@ -7077,12 +7072,8 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
dev_net_set(dev, net); dev_net_set(dev, net);
/* If there is an ifindex conflict assign a new one */ /* If there is an ifindex conflict assign a new one */
if (__dev_get_by_index(net, dev->ifindex)) { if (__dev_get_by_index(net, dev->ifindex))
int iflink = (dev_get_iflink(dev) == dev->ifindex);
dev->ifindex = dev_new_index(net); dev->ifindex = dev_new_index(net);
if (iflink)
dev->iflink = dev->ifindex;
}
/* Send a netdev-add uevent to the new namespace */ /* Send a netdev-add uevent to the new namespace */
kobject_uevent(&dev->dev.kobj, KOBJ_ADD); kobject_uevent(&dev->dev.kobj, KOBJ_ADD);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册