On Tue, Aug 6, 2024 at 8:58 AM Cindy Lu <l...@redhat.com> wrote: > > When using a VDPA device, this is another acceptable situations > The hardware MAC address is not 0, and the MAC address in the QEMU command > line is 0. > This is also acceptable > > Signed-off-by: Cindy Lu <l...@redhat.com> > --- > hw/net/virtio-net.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index 7f51bd0dd3..c144ae2e78 100644 > --- a/hw/net/virtio-net.c > +++ b/hw/net/virtio-net.c > @@ -3592,11 +3592,22 @@ static bool virtio_net_check_vdpa_mac(NetClientState > *nc, VirtIONet *n, MACAddr > * 1.The hardware MAC address is the same as the QEMU command line MAC > * address, and both of them are not 0. > */ > - > + /* > + * 2.The hardware MAC address is not 0, > + * and the MAC address in the QEMU command line is 0. > + * In this situation, the hardware MAC address will overwrite > + * the QEMU command line address.
This seems to break libvirt assumption? Adding Jonathon. > + */ > if (memcmp(&hwcfg.mac, &zero, sizeof(MACAddr)) != 0) { > if ((memcmp(&hwcfg.mac, cmdline_mac, sizeof(MACAddr)) == 0)) { > return true; > } > + if (memcmp(cmdline_mac, &zero, sizeof(MACAddr)) == 0) { > + /* overwrite the mac address with hardware address*/ > + memcpy(&n->mac[0], &hwcfg.mac, sizeof(n->mac)); > + memcpy(&n->nic_conf.macaddr, &hwcfg.mac, > sizeof(n->mac)); > + return true; > + } > } > error_setg(errp, "vDPA device's mac != the mac address from qemu > cmdline" > "Please check the the vdpa device's setting."); > -- > 2.45.0 > Thanks