netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Parav Pandit <parav@nvidia.com>, Bodong Wang <bodong@nvidia.com>,
	Alaa Hleihel <alaa@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: [net 3/8] net/mlx5: E-Switch, Read PF mac address
Date: Wed, 16 Jun 2021 15:40:10 -0700	[thread overview]
Message-ID: <20210616224015.14393-4-saeed@kernel.org> (raw)
In-Reply-To: <20210616224015.14393-1-saeed@kernel.org>

From: Parav Pandit <parav@nvidia.com>

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: f099fde16db3 ("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>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index b88705a3a1a8..97e6cb6f13c1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -1054,6 +1054,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++;
-- 
2.31.1


  parent reply	other threads:[~2021-06-16 22:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 22:40 [pull request][net 0/8] mlx5 fixes 2021-06-16 Saeed Mahameed
2021-06-16 22:40 ` [net 1/8] net/mlx5: Fix error path for set HCA defaults Saeed Mahameed
2021-06-17 18:40   ` patchwork-bot+netdevbpf
2021-06-16 22:40 ` [net 2/8] net/mlx5: Check that driver was probed prior attaching the device Saeed Mahameed
2021-06-16 22:40 ` Saeed Mahameed [this message]
2021-06-16 22:40 ` [net 4/8] net/mlx5: E-Switch, Allow setting GUID for host PF vport Saeed Mahameed
2021-06-16 22:40 ` [net 5/8] net/mlx5: SF_DEV, remove SF device on invalid state Saeed Mahameed
2021-06-16 22:40 ` [net 6/8] net/mlx5: DR, Fix STEv1 incorrect L3 decapsulation padding Saeed Mahameed
2021-06-16 22:40 ` [net 7/8] net/mlx5e: Don't create devices during unload flow Saeed Mahameed
2021-06-16 22:40 ` [net 8/8] net/mlx5: Reset mkey index on creation Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210616224015.14393-4-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=alaa@nvidia.com \
    --cc=bodong@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=parav@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).