From: Jason Wang <jasowang@redhat.com>
To: Cindy Lu <lulu@redhat.com>, mst@redhat.com, qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: Re: [PATCH v2] virtio-net: Add check for mac address while peer is vdpa
Date: Mon, 26 Oct 2020 11:19:49 +0800 [thread overview]
Message-ID: <1bd85488-7186-d869-9bc2-2536d23c1e78@redhat.com> (raw)
In-Reply-To: <462e6df3-8a34-9cfb-0696-49481aba4d46@redhat.com>
On 2020/10/26 上午10:43, Jason Wang wrote:
>
> On 2020/10/23 下午5:15, Cindy Lu wrote:
>> Sometime vdpa get an all 0 mac address from the hardware, this will
>> cause the traffic down
>> So we add the check for this part.
>> if we get an 0 mac address we will use the default mac address instead
>>
>> Signed-off-by: Cindy Lu <lulu@redhat.com>
>> ---
>> hw/net/virtio-net.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
>> index 9179013ac4..f1648fc47d 100644
>> --- a/hw/net/virtio-net.c
>> +++ b/hw/net/virtio-net.c
>> @@ -126,6 +126,7 @@ static void virtio_net_get_config(VirtIODevice
>> *vdev, uint8_t *config)
>> VirtIONet *n = VIRTIO_NET(vdev);
>> struct virtio_net_config netcfg;
>> NetClientState *nc = qemu_get_queue(n->nic);
>> + static const MACAddr zero = { .a = { 0, 0, 0, 0, 0, 0 } };
>> int ret = 0;
>> memset(&netcfg, 0 , sizeof(struct virtio_net_config));
>> @@ -151,7 +152,11 @@ static void virtio_net_get_config(VirtIODevice
>> *vdev, uint8_t *config)
>> ret = vhost_net_get_config(get_vhost_net(nc->peer),
>> (uint8_t *)&netcfg,
>> n->config_size);
>> if (ret != -1) {
>> - memcpy(config, &netcfg, n->config_size);
>> + if (memcmp(&netcfg.mac, &zero, sizeof(zero)) != 0) {
>> + memcpy(config, &netcfg, n->config_size);
>> + } else {
>> + error_report("Get an all zero mac address from
>> hardware");
>> + }
>> }
>> }
>> }
>
>
> Applied.
>
> Thanks
>
>
Speak too fast. Some questions:
1) Any reason that you do such check or get_config() instead of doing it
once in device initalization
2) the indentation looks wrong
3) There's no need for an error here since we can workaround it
Thanks
next prev parent reply other threads:[~2020-10-26 3:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-23 9:15 [PATCH v2] virtio-net: Add check for mac address while peer is vdpa Cindy Lu
2020-10-26 2:43 ` Jason Wang
2020-10-26 3:19 ` Jason Wang [this message]
2020-10-26 4:41 ` Cindy Lu
2020-10-27 2:42 ` Jason Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1bd85488-7186-d869-9bc2-2536d23c1e78@redhat.com \
--to=jasowang@redhat.com \
--cc=lulu@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).