diff options
author | Cindy Lu | 2020-09-25 17:13:33 +0200 |
---|---|---|
committer | Jason Wang | 2020-11-11 09:52:23 +0100 |
commit | e87936ea299d8204e496b5ff19ffdca46c21610e (patch) | |
tree | 36f7a14d4b46a21b528c9329a373925b5fa2aa28 /hw/net/virtio-net.c | |
parent | Update version for v5.2.0-rc1 release (diff) | |
download | qemu-e87936ea299d8204e496b5ff19ffdca46c21610e.tar.gz qemu-e87936ea299d8204e496b5ff19ffdca46c21610e.tar.xz qemu-e87936ea299d8204e496b5ff19ffdca46c21610e.zip |
virtio-net: Set mac address to hardware if the peer is vdpa
If the peer's type is vdpa, we need to set the mac address to hardware
in virtio_net_device_realize,
Signed-off-by: Cindy Lu <lulu@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/net/virtio-net.c')
-rw-r--r-- | hw/net/virtio-net.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 277289d56e..9179013ac4 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3395,6 +3395,12 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) nc = qemu_get_queue(n->nic); nc->rxfilter_notify_enabled = 1; + if (nc->peer && nc->peer->info->type == NET_CLIENT_DRIVER_VHOST_VDPA) { + struct virtio_net_config netcfg = {}; + memcpy(&netcfg.mac, &n->nic_conf.macaddr, ETH_ALEN); + vhost_net_set_config(get_vhost_net(nc->peer), + (uint8_t *)&netcfg, 0, ETH_ALEN, VHOST_SET_CONFIG_TYPE_MASTER); + } QTAILQ_INIT(&n->rsc_chains); n->qdev = dev; |