[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230122100526.2302556-4-lvivier@redhat.com>
Date: Sun, 22 Jan 2023 11:05:25 +0100
From: Laurent Vivier <lvivier@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: "Michael S. Tsirkin" <mst@...hat.com>,
Parav Pandit <parav@...dia.com>,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
Eli Cohen <elic@...dia.com>, Jason Wang <jasowang@...hat.com>,
Gautam Dawar <gautam.dawar@...inx.com>,
Cindy Lu <lulu@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Eugenio PĂ©rez <eperezma@...hat.com>
Subject: [PATCH 3/4] vdpa_sim_net: don't always set VIRTIO_NET_F_MAC
if vdpa dev command doesn't set a MAC address, don't report
VIRTIO_NET_F_MAC.
As vdpa_sim_net sets VIRTIO_NET_F_MAC without setting the MAC address,
virtio-net doesn't set a random one and the address appears to be the
zero MAC address.
Signed-off-by: Laurent Vivier <lvivier@...hat.com>
---
drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim_net.c b/drivers/vdpa/vdpa_sim/vdpa_sim_net.c
index 584b975a98a7..28e858659b85 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim_net.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim_net.c
@@ -257,6 +257,12 @@ static int vdpasim_net_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
dev_attr.work_fn = vdpasim_net_work;
dev_attr.buffer_size = PAGE_SIZE;
+ /* if vdpa dev doesn't provide a MAC address,
+ * don't report we have one
+ */
+ if (!(config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MACADDR)))
+ dev_attr.supported_features &= ~(1ULL << VIRTIO_NET_F_MAC);
+
simdev = vdpasim_create(&dev_attr, config);
if (IS_ERR(simdev))
return PTR_ERR(simdev);
--
2.39.0
Powered by blists - more mailing lists