mlxsw: Register port netdevices into net of core
authorJiri Pirko <jiri@mellanox.com>
Thu, 3 Oct 2019 09:49:33 +0000 (11:49 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 4 Oct 2019 18:10:56 +0000 (11:10 -0700)
When creating netdevices for ports, put them under network namespace
that the core/parent devlink belongs to.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/minimal.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
drivers/net/ethernet/mellanox/mlxsw/switchx2.c

index 471b0ca..cee16ad 100644 (file)
@@ -172,6 +172,7 @@ mlxsw_m_port_create(struct mlxsw_m *mlxsw_m, u8 local_port, u8 module)
        }
 
        SET_NETDEV_DEV(dev, mlxsw_m->bus_info->dev);
+       dev_net_set(dev, mlxsw_core_net(mlxsw_m->core));
        mlxsw_m_port = netdev_priv(dev);
        mlxsw_m_port->dev = dev;
        mlxsw_m_port->mlxsw_m = mlxsw_m;
index 250448a..a9ea9c7 100644 (file)
@@ -3635,6 +3635,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u8 local_port,
                goto err_alloc_etherdev;
        }
        SET_NETDEV_DEV(dev, mlxsw_sp->bus_info->dev);
+       dev_net_set(dev, mlxsw_sp_net(mlxsw_sp));
        mlxsw_sp_port = netdev_priv(dev);
        mlxsw_sp_port->dev = dev;
        mlxsw_sp_port->mlxsw_sp = mlxsw_sp;
index 1c14c05..a4d0939 100644 (file)
@@ -992,6 +992,7 @@ static int __mlxsw_sx_port_eth_create(struct mlxsw_sx *mlxsw_sx, u8 local_port,
        if (!dev)
                return -ENOMEM;
        SET_NETDEV_DEV(dev, mlxsw_sx->bus_info->dev);
+       dev_net_set(dev, mlxsw_core_net(mlxsw_sx->core));
        mlxsw_sx_port = netdev_priv(dev);
        mlxsw_sx_port->dev = dev;
        mlxsw_sx_port->mlxsw_sx = mlxsw_sx;