qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cindy Lu <lulu@redhat.com>
Cc: eperezma@redhat.com, jasowang@redhat.com, amorenoz@redhat.com,
	qemu-devel@nongnu.org, Sean Mooney <smooney@redhat.com>
Subject: Re: [PATCH v5 1/1] virtio-net: Add check for mac address while peer is vdpa
Date: Sun, 28 Feb 2021 15:39:50 -0500	[thread overview]
Message-ID: <20210228153905-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20210225141203-mutt-send-email-mst@kernel.org>

On Thu, Feb 25, 2021 at 02:14:39PM -0500, Michael S. Tsirkin wrote:
> On Fri, Feb 26, 2021 at 12:55:06AM +0800, Cindy Lu wrote:
> > While peer is vdpa, sometime qemu get an all zero mac address from the hardware,
> > This is not a legal value. Add the check for this.if we get an zero mac address.
> > qemu will use the default mac address or the mac address from qemu cmdline
> > 
> > Signed-off-by: Cindy Lu <lulu@redhat.com>
> 
> I guess I will have to rewrite the comments and commit log :(
> 
> It is all saying what does the patch do. We want it to rather
> give motivation.
> 
> Sean could you please comment on whether this patch fixes your
> config?

ping. if I'm to try and merge this work around it's critical
that someone with access to hardware confirm it actually works.


> > ---
> >  hw/net/virtio-net.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> > index 9179013ac4..8f36ca5066 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,6 +152,15 @@ 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) {
> > +            /*
> > +             * Here is a work around, the 0 mac address is not a legal value.
> > +             * if we got this from hardware, qemu will use the mac address
> > +             * saved in VirtIONet->mac.
> > +             */
> > +            if (memcmp(&netcfg.mac, &zero, sizeof(zero)) == 0) {
> > +                info_report("Get an all zero mac address from hardware");
> > +                memcpy(netcfg.mac, n->mac, ETH_ALEN);
> > +            }
> >              memcpy(config, &netcfg, n->config_size);
> >          }
> >      }
> > -- 
> > 2.21.3



  reply	other threads:[~2021-02-28 21:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25 16:55 [PATCH v5 0/1] virtio-net: Add check for mac address while peer is vdpa Cindy Lu
2021-02-25 16:55 ` [PATCH v5 1/1] " Cindy Lu
2021-02-25 19:14   ` Michael S. Tsirkin
2021-02-28 20:39     ` Michael S. Tsirkin [this message]
2021-03-01  1:36       ` Cindy Lu
2021-03-01  7:47         ` Adrian Moreno
2021-03-01 13:04     ` Sean Mooney

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=20210228153905-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=amorenoz@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lulu@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=smooney@redhat.com \
    /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).