From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH 1/5][RFC] virtio-net: Allow setting the MAC address via set_config Date: Fri, 09 Jan 2009 08:34:21 -0700 Message-ID: <1231515261.7109.201.camel@lappy> References: <1231349856.7109.80.camel@lappy> <1231501089.4481.76.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: kvm , qemu-devel To: Mark McLoughlin Return-path: Received: from g4t0014.houston.hp.com ([15.201.24.17]:27068 "EHLO g4t0014.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750856AbZAIPdx (ORCPT ); Fri, 9 Jan 2009 10:33:53 -0500 In-Reply-To: <1231501089.4481.76.camel@localhost.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: 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.