qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH 1/5][RFC] virtio-net: Allow setting the MAC addr


From: Alex Williamson
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

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 via email to

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