netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] vdpa/mlx5: update mlx_features with driver state check
@ 2025-11-05  8:01 Cindy Lu
  2025-11-05  8:01 ` [PATCH 2/2] vdpa/mlx5: update MAC address handling in mlx5_vdpa_set_attr() Cindy Lu
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Cindy Lu @ 2025-11-05  8:01 UTC (permalink / raw)
  To: lulu, dtatulea, mst, jasowang, netdev, virtualization,
	linux-kernel

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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-11-06  7:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-05  8:01 [PATCH 1/2] vdpa/mlx5: update mlx_features with driver state check Cindy Lu
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

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).