WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] libxl: use preferred syntax for network device c

To: Markus Armbruster <armbru@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libxl: use preferred syntax for network device creation with upstream qemu
From: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Date: Thu, 26 May 2011 09:53:05 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 26 May 2011 01:55:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <m3ei3lzxal.fsf@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <6b1fe0cba8a2f0bcc127.1306311646@xxxxxxxxxxxxxxxxxxxxxxxxx> <m38vtun7wh.fsf@xxxxxxxxxxxxxxxxxxxxx> <1306396830.775.13.camel@xxxxxxxxxxxxxxxxxxxxxx> <m3ei3lzxal.fsf@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, 2011-05-26 at 09:22 +0100, Markus Armbruster wrote:
> Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx> writes:
> 
> > On Wed, 2011-05-25 at 15:59 +0100, Markus Armbruster wrote:
> >> Ian Campbell <ian.campbell@xxxxxxxxxx> writes:

> >> 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<n>.
> 
> Sorry, I wasn't writing clearly, let me retry.  You're naming the host
> part of the NIC, created with -netdev.  You can also name the guest
> part, created with -device.

Oh, I see, thanks. Make sense to call it nic<n> then I guess.

# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1306399775 -3600
# Node ID 7cb3b0b7f45d6272ef2c67dffd293aaf984c2ecc
# Parent  33cb7fe0d6d9f81292005e5671ebef7889c1d1ba
libxl: use preferred syntax for network device creation with upstream qemu

Markus Armbruster points out in <m3r582pzc1.fsf@xxxxxxxxxxxxxxxxxxxxx>
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 <ian.campbell@xxxxxxxxxx>
Cc: Markus Armbruster <armbru@xxxxxxxxxx>

diff -r 33cb7fe0d6d9 -r 7cb3b0b7f45d tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Wed May 25 11:15:45 2011 +0100
+++ b/tools/libxl/libxl_dm.c    Thu May 26 09:49:35 2011 +0100
@@ -336,12 +336,16 @@ 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",
-                            vifs[i].devid, ifname, libxl_tapif_script(gc)));
+                flexarray_append(dm_args, "-device");
+                flexarray_append(dm_args,
+                                 libxl__sprintf(gc, 
"%s,id=nic%d,netdev=net%d,mac=%s",
+                                                vifs[i].model, vifs[i].devid,
+                                                vifs[i].devid, smac));
+                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++;
             }
         }



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel