aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/slave.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-04-02 14:05:02 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-02 14:05:02 -0400
commite4a924f5768c55002c02ceba9b9f86824c35f956 (patch)
treeae8db8c41d5950644db9d4f5e609f228df958e57 /net/dsa/slave.c
parentcrypto: algif - explicitly mark end of data (diff)
parentveth: set iflink to the peer veth (diff)
downloadlinux-dev-e4a924f5768c55002c02ceba9b9f86824c35f956.tar.xz
linux-dev-e4a924f5768c55002c02ceba9b9f86824c35f956.zip
Merge branch 'netdev_iflink_remove'
Nicolas Dichtel says: ==================== Remove iflink field from the net_device structure The first goal of this series was to advertise the veth peer via the IFLA_LINK attribute, but iflink was not ready for network namespaces. The iflink of an interface should be set to its ifindex for a physical interface and to another value (0 if not relevant) for a virtual interface. This was not the case for some interfaces, like vxlan, bond, or bridge for example. There is also a risk, if the targeted interface moves to another netns, that the ifindex changes without updating corresponding iflink fields (eg. vlan). Moving the management of this property into virtual interface drivers allows to better handle this last case because most of virtual interface drivers have a pointer to the link netdevice. Anyway, dev->iflink value was always a copy of some internal data of the virtual interface driver, thus let's use these internal data directly. So, this series removes the iflink field and let the drivers manage it. Only the last patch was present in the v1, but I fully rework it. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/slave.c')
-rw-r--r--net/dsa/slave.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 3597724ec3d8..827cda560a55 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -55,13 +55,11 @@ void dsa_slave_mii_bus_init(struct dsa_switch *ds)
/* slave device handling ****************************************************/
-static int dsa_slave_init(struct net_device *dev)
+static int dsa_slave_get_iflink(const struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
- dev->iflink = p->parent->dst->master_netdev->ifindex;
-
- return 0;
+ return p->parent->dst->master_netdev->ifindex;
}
static inline bool dsa_port_is_bridged(struct dsa_slave_priv *p)
@@ -664,7 +662,6 @@ static const struct ethtool_ops dsa_slave_ethtool_ops = {
};
static const struct net_device_ops dsa_slave_netdev_ops = {
- .ndo_init = dsa_slave_init,
.ndo_open = dsa_slave_open,
.ndo_stop = dsa_slave_close,
.ndo_start_xmit = dsa_slave_xmit,
@@ -675,6 +672,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
.ndo_fdb_del = dsa_slave_fdb_del,
.ndo_fdb_dump = dsa_slave_fdb_dump,
.ndo_do_ioctl = dsa_slave_ioctl,
+ .ndo_get_iflink = dsa_slave_get_iflink,
};
static const struct swdev_ops dsa_slave_swdev_ops = {