qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@hp.com>
To: Mark McLoughlin <markmc@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>, kvm <kvm@vger.kernel.org>
Subject: [Qemu-devel] Re: [PATCH 1/5][RFC] virtio-net: Allow setting the MAC address via set_config
Date: Fri, 09 Jan 2009 08:34:21 -0700	[thread overview]
Message-ID: <1231515261.7109.201.camel@lappy> (raw)
In-Reply-To: <1231501089.4481.76.camel@localhost.localdomain>

On Fri, 2009-01-09 at 11:38 +0000, Mark McLoughlin wrote:
> On Wed, 2009-01-07 at 10:37 -0700, Alex Williamson wrote:
> > virtio-net: Allow setting the MAC address via set_config
> 
> This will basically never happen with QEMU, right?
> 
> We always set the MAC address - even if not supplied on the command line
> - and the guest will never override that.

Right, we always give the guest a MAC, but why will the guest never
override it?  That seems like a big assumption.

> > +static void virtio_net_set_config(VirtIODevice *vdev, const uint8_t
> > *config)
> > +{
> > +    VirtIONet *n = to_virtio_net(vdev);
> > +    struct virtio_net_config netcfg;
> > +
> > +    memcpy(&netcfg, config, sizeof(netcfg));
> > +
> > +    if (memcmp(netcfg.mac, n->mac, 6)) {
> > +        memcpy(n->mac, netcfg.mac, 6);
> > +        snprintf(n->vc->info_str, sizeof(n->vc->info_str),
> > +                 "virtio macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
> > +                 n->mac[0], n->mac[1], n->mac[2],
> > +                 n->mac[3], n->mac[4], n->mac[5]);
> 
> There's qemu_format_nic_info_str() now.

Thanks, that will clean it up nicely.  Thanks,

Alex

-- 
Alex Williamson                             HP Open Source & Linux Org.

      reply	other threads:[~2009-01-09 15:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-07 17:37 [Qemu-devel] [PATCH 1/5][RFC] virtio-net: Allow setting the MAC address via set_config Alex Williamson
2009-01-09 11:38 ` [Qemu-devel] " Mark McLoughlin
2009-01-09 15:34   ` Alex Williamson [this message]

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=1231515261.7109.201.camel@lappy \
    --to=alex.williamson@hp.com \
    --cc=kvm@vger.kernel.org \
    --cc=markmc@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).