From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LLJMy-0005bK-S3 for qemu-devel@nongnu.org; Fri, 09 Jan 2009 10:33:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LLJMx-0005Z9-Jd for qemu-devel@nongnu.org; Fri, 09 Jan 2009 10:33:55 -0500 Received: from [199.232.76.173] (port=43605 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LLJMx-0005Yx-GS for qemu-devel@nongnu.org; Fri, 09 Jan 2009 10:33:55 -0500 Received: from g4t0014.houston.hp.com ([15.201.24.17]:27070) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LLJMx-0000yv-3N for qemu-devel@nongnu.org; Fri, 09 Jan 2009 10:33:55 -0500 From: Alex Williamson In-Reply-To: <1231501089.4481.76.camel@localhost.localdomain> References: <1231349856.7109.80.camel@lappy> <1231501089.4481.76.camel@localhost.localdomain> Content-Type: text/plain Date: Fri, 09 Jan 2009 08:34:21 -0700 Message-Id: <1231515261.7109.201.camel@lappy> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/5][RFC] virtio-net: Allow setting the MAC address via set_config Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark McLoughlin Cc: qemu-devel , kvm 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.