qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] virtio_net: remove the unnecessary check in get_config


From: Cindy Lu
Subject: [PATCH 3/3] virtio_net: remove the unnecessary check in get_config
Date: Tue, 6 Aug 2024 08:58:03 +0800

The vdpa device with MAC address 0 should not boot.
So remove the check here

Signed-off-by: Cindy Lu <lulu@redhat.com>
---
 hw/net/virtio-net.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index c144ae2e78..8a7c743ad3 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -142,7 +142,6 @@ static void virtio_net_get_config(VirtIODevice *vdev, 
uint8_t *config)
     VirtIONet *n = VIRTIO_NET(vdev);
     struct virtio_net_config netcfg;
     NetClientState *nc = qemu_get_queue(n->nic);
-    static const MACAddr zero = { .a = { 0, 0, 0, 0, 0, 0 } };
 
     int ret = 0;
     memset(&netcfg, 0 , sizeof(struct virtio_net_config));
@@ -170,18 +169,6 @@ static void virtio_net_get_config(VirtIODevice *vdev, 
uint8_t *config)
         if (ret == -1) {
             return;
         }
-
-        /*
-         * Some NIC/kernel combinations present 0 as the mac address.  As that
-         * is not a legal address, try to proceed with the address from the
-         * QEMU command line in the hope that the address has been configured
-         * correctly elsewhere - just not reported by the device.
-         */
-        if (memcmp(&netcfg.mac, &zero, sizeof(zero)) == 0) {
-            info_report("Zero hardware mac address detected. Ignoring.");
-            memcpy(netcfg.mac, n->mac, ETH_ALEN);
-        }
-
         netcfg.status |= virtio_tswap16(vdev,
                                         n->status & VIRTIO_NET_S_ANNOUNCE);
         memcpy(config, &netcfg, n->config_size);
-- 
2.45.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]