From: Ian Campbell Subject: Re: [PATCH] libxl: use preferred syntax for network device creation with upstream qemu Date: Thu, 26 May 2011 09:00:30 +0100 Message-ID: <1306396830.775.13.camel@zakaz.uk.xensource.com> References: <6b1fe0cba8a2f0bcc127.1306311646@cosworth.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Markus Armbruster Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Wed, 2011-05-25 at 15:59 +0100, Markus Armbruster wrote: > Ian Campbell writes: > > > # HG changeset patch > > # User Ian Campbell > > # Date 1306311631 -3600 > > # Node ID 6b1fe0cba8a2f0bcc1274c8e777da5b6c198b45d > > # Parent 8258c5a0ba35de937597e2c516bc88f8ebe1be35 > > libxl: use preferred syntax for network device creation with upstream qemu > > > > Markus Armbruster points out in > > on qemu-devel that this is the prefered syntax going forward. Using it avoid > > needlessly instantiating a qemu "vlan" and instead creates a simply host end > > point and device. > > > > Signed-off-by: Ian Campbell > > Cc: Markus Armbruster > > I figure this is a good idea. Thanks for confirming. > Important optimizations like GSO or vhost-net aren't feasible with > -net's VLANs (no relation to IEEE 802.1Q) . That's why -netdev got > added[*]. VLANs are still around for backward compatibility. I hope we > can get rid of them eventually. > > > diff -r 8258c5a0ba35 -r 6b1fe0cba8a2 tools/libxl/libxl_dm.c > > --- a/tools/libxl/libxl_dm.c Tue May 24 16:28:07 2011 +0100 > > +++ b/tools/libxl/libxl_dm.c Wed May 25 09:20:31 2011 +0100 > > @@ -336,11 +336,11 @@ static char ** libxl__build_device_model > > } else { > > ifname = vifs[i].ifname; > > } > > - flexarray_append(dm_args, "-net"); > > - flexarray_append(dm_args, libxl__sprintf(gc, "nic,vlan=%d,macaddr=%s,model=%s", > > - vifs[i].devid, smac, vifs[i].model)); > > - flexarray_append(dm_args, "-net"); > > - flexarray_append(dm_args, libxl__sprintf(gc, "tap,vlan=%d,ifname=%s,script=%s", > > + flexarray_append(dm_args, "-device"); > > + flexarray_append(dm_args, libxl__sprintf(gc, "%s,netdev=net%d,mac=%s", > > + vifs[i].model, vifs[i].devid, smac)); > > You can name the device with "id=WHATEVER". IDs are handy when you need > to refer to a device, e.g. for hot-unplug with device_del. Sure, I just couldn't think of a better name than net. > > + flexarray_append(dm_args, "-netdev"); > > + flexarray_append(dm_args, libxl__sprintf(gc, "type=tap,id=net%d,ifname=%s,script=%s", > > vifs[i].devid, ifname, libxl_tapif_script(gc))); > > ioemu_vifs++; > > } > > > > More info on conversion to -device syntax in docs/qdev-device-use.txt. > It's a bit stale, patch for updating it is on qemu-devel. Thanks for the reference. Looks like I need to consider a similar update for disk devices too. > > [*] http://lists.gnu.org/archive/html/qemu-devel/2009-10/msg00858.html