|
|
ed5979 |
From 3f55d12df35552ae948587a62d6f9015664adc13 Mon Sep 17 00:00:00 2001
|
|
|
ed5979 |
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
|
|
|
ed5979 |
Date: Wed, 21 Dec 2022 12:50:12 +0100
|
|
|
ed5979 |
Subject: [PATCH 1/9] virtio_net: Modify virtio_net_get_config to early return
|
|
|
ed5979 |
MIME-Version: 1.0
|
|
|
ed5979 |
Content-Type: text/plain; charset=UTF-8
|
|
|
ed5979 |
Content-Transfer-Encoding: 8bit
|
|
|
ed5979 |
|
|
|
ed5979 |
RH-Author: Eugenio Pérez <eperezma@redhat.com>
|
|
|
ed5979 |
RH-MergeRequest: 137: vDPA net SVQ guest announce support
|
|
|
ed5979 |
RH-Bugzilla: 2141088
|
|
|
ed5979 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
ed5979 |
RH-Acked-by: Cindy Lu <lulu@redhat.com>
|
|
|
ed5979 |
RH-Acked-by: Jason Wang <jasowang@redhat.com>
|
|
|
ed5979 |
RH-Commit: [1/4] 4f5e79afd54e157f32e6fff56ae33e2b71492525 (eperezmartin/qemu-kvm)
|
|
|
ed5979 |
|
|
|
ed5979 |
Next patches introduce more code on vhost-vdpa branch, with already have
|
|
|
ed5979 |
too much indentation.
|
|
|
ed5979 |
|
|
|
ed5979 |
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
|
|
ed5979 |
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
|
|
|
ed5979 |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
ed5979 |
Acked-by: Jason Wang <jasowang@redhat.com>
|
|
|
ed5979 |
Message-Id: <20221221115015.1400889-2-eperezma@redhat.com>
|
|
|
ed5979 |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
ed5979 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
ed5979 |
(cherry picked from commit ebc141a62508dc91901373c1a19fe7e2cf560dfb)
|
|
|
ed5979 |
---
|
|
|
ed5979 |
hw/net/virtio-net.c | 28 +++++++++++++++-------------
|
|
|
ed5979 |
1 file changed, 15 insertions(+), 13 deletions(-)
|
|
|
ed5979 |
|
|
|
ed5979 |
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
|
|
|
ed5979 |
index ec974f7a76..5935e55653 100644
|
|
|
ed5979 |
--- a/hw/net/virtio-net.c
|
|
|
ed5979 |
+++ b/hw/net/virtio-net.c
|
|
|
ed5979 |
@@ -168,20 +168,22 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
|
|
|
ed5979 |
if (nc->peer && nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_VDPA) {
|
|
|
ed5979 |
ret = vhost_net_get_config(get_vhost_net(nc->peer), (uint8_t *)&netcfg,
|
|
|
ed5979 |
n->config_size);
|
|
|
ed5979 |
- if (ret != -1) {
|
|
|
ed5979 |
- /*
|
|
|
ed5979 |
- * Some NIC/kernel combinations present 0 as the mac address. As
|
|
|
ed5979 |
- * that is not a legal address, try to proceed with the
|
|
|
ed5979 |
- * address from the QEMU command line in the hope that the
|
|
|
ed5979 |
- * address has been configured correctly elsewhere - just not
|
|
|
ed5979 |
- * reported by the device.
|
|
|
ed5979 |
- */
|
|
|
ed5979 |
- if (memcmp(&netcfg.mac, &zero, sizeof(zero)) == 0) {
|
|
|
ed5979 |
- info_report("Zero hardware mac address detected. Ignoring.");
|
|
|
ed5979 |
- memcpy(netcfg.mac, n->mac, ETH_ALEN);
|
|
|
ed5979 |
- }
|
|
|
ed5979 |
- memcpy(config, &netcfg, n->config_size);
|
|
|
ed5979 |
+ if (ret == -1) {
|
|
|
ed5979 |
+ return;
|
|
|
ed5979 |
}
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ /*
|
|
|
ed5979 |
+ * Some NIC/kernel combinations present 0 as the mac address. As that
|
|
|
ed5979 |
+ * is not a legal address, try to proceed with the address from the
|
|
|
ed5979 |
+ * QEMU command line in the hope that the address has been configured
|
|
|
ed5979 |
+ * correctly elsewhere - just not reported by the device.
|
|
|
ed5979 |
+ */
|
|
|
ed5979 |
+ if (memcmp(&netcfg.mac, &zero, sizeof(zero)) == 0) {
|
|
|
ed5979 |
+ info_report("Zero hardware mac address detected. Ignoring.");
|
|
|
ed5979 |
+ memcpy(netcfg.mac, n->mac, ETH_ALEN);
|
|
|
ed5979 |
+ }
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ memcpy(config, &netcfg, n->config_size);
|
|
|
ed5979 |
}
|
|
|
ed5979 |
}
|
|
|
ed5979 |
|
|
|
ed5979 |
--
|
|
|
ed5979 |
2.31.1
|
|
|
ed5979 |
|