From: Jason Wang <jasowang@redhat.com>
To: Cindy Lu <lulu@redhat.com>
Cc: mst@redhat.com, qemu-devel@nongnu.org,
Jonathon Jongsma <jjongsma@redhat.com>
Subject: Re: [PATCH 2/3] virtio_net: Add the check for vdpa mac address
Date: Tue, 6 Aug 2024 11:08:32 +0800 [thread overview]
Message-ID: <CACGkMEvXE_8HzAtuNWS13Y12B9=10WCsAj490xCe4Up01=06tg@mail.gmail.com> (raw)
In-Reply-To: <20240806005814.51651-2-lulu@redhat.com>
On Tue, Aug 6, 2024 at 8:58 AM Cindy Lu <lulu@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 <lulu@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
next prev parent reply other threads:[~2024-08-06 3:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 0:58 [PATCH 1/3] virtio_net: Add the check for vdpa's mac address Cindy Lu
2024-08-06 0:58 ` [PATCH 2/3] virtio_net: Add the check for vdpa " Cindy Lu
2024-08-06 3:08 ` Jason Wang [this message]
2024-08-06 0:58 ` [PATCH 3/3] virtio_net: remove the unnecessary check in get_config Cindy Lu
2024-08-06 3:09 ` Jason Wang
2024-08-06 9:47 ` Cindy Lu
2024-08-06 3:06 ` [PATCH 1/3] virtio_net: Add the check for vdpa's mac address Jason Wang
2024-08-06 9:43 ` Cindy Lu
2024-08-06 11:12 ` Yan Vugenfirer
2024-08-09 9:14 ` Cindy Lu
2024-08-07 2:35 ` Jason Wang
2024-08-09 9:14 ` Cindy Lu
2024-08-06 13:30 ` Michael S. Tsirkin
2024-08-09 9:15 ` Cindy Lu
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='CACGkMEvXE_8HzAtuNWS13Y12B9=10WCsAj490xCe4Up01=06tg@mail.gmail.com' \
--to=jasowang@redhat.com \
--cc=jjongsma@redhat.com \
--cc=lulu@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@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).