qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v4 33/47] hw/m68k/q800: use qemu_find_nic_info()


From: Thomas Huth
Subject: Re: [PATCH v4 33/47] hw/m68k/q800: use qemu_find_nic_info()
Date: Thu, 1 Feb 2024 11:30:13 +0100
User-agent: Mozilla Thunderbird

On 31/01/2024 15.18, David Woodhouse wrote:
On Wed, 2024-01-31 at 13:18 +0100, Thomas Huth wrote:

@@ -386,14 +382,21 @@ static void q800_machine_init(MachineState
*machine)
         * 08:00:07 Apple
         * (Q800 use the last one)
         */
-    nd_table[0].macaddr.a[0] = 0x08;
-    nd_table[0].macaddr.a[1] = 0x00;
-    nd_table[0].macaddr.a[2] = 0x07;
-
        object_initialize_child(OBJECT(machine), "dp8393x", &m-
dp8393x,
                                TYPE_DP8393X);
        dev = DEVICE(&m->dp8393x);
-    qdev_set_nic_properties(dev, &nd_table[0]);
+    nd = qemu_find_nic_info(TYPE_DP8393X, true, "dp83932");
+    if (nd) {
+        qdev_set_nic_properties(dev, nd);
+        memcpy(mac.a, nd->macaddr.a, sizeof(mac.a));
+    } else {
+        qemu_macaddr_default_if_unset(&mac);
+    }
+    mac.a[0] = 0x08;
+    mac.a[1] = 0x00;
+    mac.a[2] = 0x07;

Don't we have to change nd->macaddr.a[0 to 2] with this hard-coded
MAC-prefix, too?

I don't think so.

We either get the MAC address from 'nd' if that exists, or generate a
new MAC address with qemu_macaddr_default_if_unset().

Then we override the OUI in the actual device. We don't care about 'nd'
any more at that point.

I just double-checked, and yes, you're right, so:

Reviewed-by: Thomas Huth <thuth@redhat.com>




reply via email to

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