]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
mlxsw: minimal: Initialize base_mac
authorJiri Pirko <jiri@mellanox.com>
Tue, 12 Mar 2019 08:40:42 +0000 (08:40 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Mar 2019 21:55:16 +0000 (14:55 -0700)
Currently base_mac is not initialized which causes wrong reporting of
zeroed parent_id to userspace. Fix this by initializing base_mac
properly.

Fixes: c100e47caa8e ("mlxsw: minimal: Add ethtool support")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/minimal.c

index 68bee9572a1b015067dab62c0e1b29903a29ddb4..00c390024350d9b47570ec718e51c78faa4b6cb4 100644 (file)
@@ -34,6 +34,18 @@ struct mlxsw_m_port {
        u8 module;
 };
 
+static int mlxsw_m_base_mac_get(struct mlxsw_m *mlxsw_m)
+{
+       char spad_pl[MLXSW_REG_SPAD_LEN] = {0};
+       int err;
+
+       err = mlxsw_reg_query(mlxsw_m->core, MLXSW_REG(spad), spad_pl);
+       if (err)
+               return err;
+       mlxsw_reg_spad_base_mac_memcpy_from(spad_pl, mlxsw_m->base_mac);
+       return 0;
+}
+
 static int mlxsw_m_port_dummy_open_stop(struct net_device *dev)
 {
        return 0;
@@ -314,6 +326,12 @@ static int mlxsw_m_init(struct mlxsw_core *mlxsw_core,
        mlxsw_m->core = mlxsw_core;
        mlxsw_m->bus_info = mlxsw_bus_info;
 
+       err = mlxsw_m_base_mac_get(mlxsw_m);
+       if (err) {
+               dev_err(mlxsw_m->bus_info->dev, "Failed to get base mac\n");
+               return err;
+       }
+
        err = mlxsw_m_ports_create(mlxsw_m);
        if (err) {
                dev_err(mlxsw_m->bus_info->dev, "Failed to create ports\n");