public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set
@ 2024-08-27 16:02 Dragos Tatulea
  2024-08-27 20:43 ` Nelson, Shannon
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Dragos Tatulea @ 2024-08-27 16:02 UTC (permalink / raw)
  To: Dragos Tatulea, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
	Eugenio Pérez
  Cc: si-wei.liu, Jiri Pirko, virtualization, linux-kernel

When the vdpa device is configured without a specific MAC
address, the vport MAC address is used. However, this
address can be 0 which prevents the driver from properly
configuring the MPFS and breaks steering.

The solution is to simply generate a random MAC address
when no MAC is set on the nic vport.

Now it's possible to create a vdpa device without a
MAC address and run qemu with this device without needing
to configure an explicit MAC address.

Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index fa78e8288ebb..1c26139d02fe 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -3824,6 +3824,9 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
 		err = mlx5_query_nic_vport_mac_address(mdev, 0, 0, config->mac);
 		if (err)
 			goto err_alloc;
+
+		if (is_zero_ether_addr(config->mac))
+			eth_random_addr(config->mac);
 	}
 
 	if (!is_zero_ether_addr(config->mac)) {
-- 
2.45.1


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

end of thread, other threads:[~2024-09-02  9:56 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27 16:02 [PATCH] vdpa/mlx5: Use random MAC address when no nic vport MAC set Dragos Tatulea
2024-08-27 20:43 ` Nelson, Shannon
2024-08-28  1:50 ` Jason Wang
2024-08-28  9:00   ` Cindy Lu
2024-08-28  9:37     ` Dragos Tatulea
2024-08-29  9:05       ` Cindy Lu
2024-08-29 10:00         ` Dragos Tatulea
2024-08-29 19:03           ` Dragos Tatulea
2024-08-30  9:29             ` Cindy Lu
2024-08-30  9:43               ` Dragos Tatulea
2024-09-01 18:49               ` Michael S. Tsirkin
2024-09-02  9:55                 ` Cindy Lu
2024-08-30  9:12           ` Cindy Lu
2024-08-30 13:52             ` Dragos Tatulea
2024-08-30 14:46               ` Dragos Tatulea
2024-09-02  8:40                 ` Cindy Lu
2024-09-02  8:53                   ` Dragos Tatulea
2024-09-02  9:05                     ` Cindy Lu
2024-09-02  9:10                     ` Dragos Tatulea
2024-08-28  5:54 ` Si-Wei Liu
2024-08-28  7:53   ` Dragos Tatulea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox