Skip to content

Commit

Permalink
net/mlx5: E-Switch, Read PF mac address
Browse files Browse the repository at this point in the history
[ Upstream commit bbc8222 ]

External controller PF's MAC address is not read from the device during
vport setup. Fail to read this results in showing all zeros to user
while the factory programmed MAC is a valid value.

$ devlink port show eth1 -jp
{
    "port": {
        "pci/0000:03:00.0/196608": {
            "type": "eth",
            "netdev": "eth1",
            "flavour": "pcipf",
            "controller": 1,
            "pfnum": 0,
            "splittable": false,
            "function": {
                "hw_addr": "00:00:00:00:00:00"
            }
        }
    }
}

Hence, read it when enabling a vport.

After the fix,

$ devlink port show eth1 -jp
{
    "port": {
        "pci/0000:03:00.0/196608": {
            "type": "eth",
            "netdev": "eth1",
            "flavour": "pcipf",
            "controller": 1,
            "pfnum": 0,
            "splittable": false,
            "function": {
                "hw_addr": "98:03:9b:a0:60:11"
            }
        }
    }
}

Fixes: f099fde ("net/mlx5: E-switch, Support querying port function mac address")
Signed-off-by: Bodong Wang <bodong@nvidia.com>
Signed-off-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: Alaa Hleihel <alaa@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
paravmellanox authored and gregkh committed Jun 23, 2021
1 parent 1666c18 commit 648a07c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
Expand Up @@ -1308,6 +1308,12 @@ int mlx5_esw_vport_enable(struct mlx5_eswitch *esw, u16 vport_num,
goto err_vhca_mapping;
}

/* External controller host PF has factory programmed MAC.
* Read it from the device.
*/
if (mlx5_core_is_ecpf(esw->dev) && vport_num == MLX5_VPORT_PF)
mlx5_query_nic_vport_mac_address(esw->dev, vport_num, true, vport->info.mac);

esw_vport_change_handle_locked(vport);

esw->enabled_vports++;
Expand Down

0 comments on commit 648a07c

Please sign in to comment.