qemu-stable
[Top][All Lists]
Advanced

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

Re: [PATCH v2] virtio-net: Set mac address to hardware if the peer is vd


From: Jason Wang
Subject: Re: [PATCH v2] virtio-net: Set mac address to hardware if the peer is vdpa
Date: Fri, 16 Oct 2020 10:17:34 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0


On 2020/9/25 下午11:13, Cindy Lu wrote:
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>
---
  hw/net/virtio-net.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index cb0d27084c..1f2c1643bf 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -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;


Applied.

Thanks





reply via email to

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