netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cindy Lu <lulu@redhat.com>
To: lulu@redhat.com, dtatulea@nvidia.com, mst@redhat.com,
	jasowang@redhat.com, netdev@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] vdpa/mlx5: update mlx_features with driver state check
Date: Wed,  5 Nov 2025 16:01:41 +0800	[thread overview]
Message-ID: <20251105080151.1115698-1-lulu@redhat.com> (raw)

Add logic in mlx5_vdpa_set_attr() to ensure the VIRTIO_NET_F_MAC
feature bit is properly set only when the device is not yet in
the DRIVER_OK (running) state.

This makes the MAC address visible in the output of:

 vdpa dev config show -jp

when the device is created without an initial MAC address.

Signed-off-by: Cindy Lu <lulu@redhat.com>
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index 82034efb74fc..e38aa3a335fc 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -4057,6 +4057,12 @@ static int mlx5_vdpa_set_attr(struct vdpa_mgmt_dev *v_mdev, struct vdpa_device *
 	ndev = to_mlx5_vdpa_ndev(mvdev);
 	mdev = mvdev->mdev;
 	config = &ndev->config;
+	if (!(ndev->mvdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) {
+		ndev->mvdev.mlx_features |= BIT_ULL(VIRTIO_NET_F_MAC);
+	} else {
+		mlx5_vdpa_warn(mvdev, "device running, skip updating MAC\n");
+		return err;
+	}
 
 	down_write(&ndev->reslock);
 	if (add_config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MACADDR)) {
-- 
2.45.0


             reply	other threads:[~2025-11-05  8:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05  8:01 Cindy Lu [this message]
2025-11-05  8:01 ` [PATCH 2/2] vdpa/mlx5: update MAC address handling in mlx5_vdpa_set_attr() Cindy Lu
2025-11-05 10:12   ` Dragos Tatulea
2025-11-06  7:47     ` Cindy Lu
2025-11-06  4:10   ` Jason Wang
2025-11-06  7:58     ` Cindy Lu
2025-11-05 10:02 ` [PATCH 1/2] vdpa/mlx5: update mlx_features with driver state check Dragos Tatulea
2025-11-06  7:32   ` Cindy Lu
2025-11-06  4:07 ` Jason Wang
2025-11-06  7:44   ` Cindy Lu

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=20251105080151.1115698-1-lulu@redhat.com \
    --to=lulu@redhat.com \
    --cc=dtatulea@nvidia.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /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).