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 <th...@redhat.com>