virtio-net: Set mac address to hardware if the peer is vdpa
PATCH v2 1/1 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 <[email protected]>
--- hw/net/virtio-net.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/net/virtio-net.c +6 -0
@@ -3399,6 +3399,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;
Signature · 1 line
2.21.3
Jason Wang
AppliedQuoted 15 lines · Cindy Lu
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 <[email protected]>--- hw/net/virtio-net.c | 6 ++++++ 1 file changed, 6 insertions(+)hw/net/virtio-net.c +0
-0@@ -3399,6 +3399,12 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) nc =qemu_get_queue (n->nic); nc->rxfilter_notify_enabled =1 ;
hw/net/virtio-net.c static void virtio_net_device_realize(DeviceState *dev, Error **errp) · line 3410
Quoted 10 lines
hw/net/virtio-net.c +6
-0+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;
Applied.
Thanks