[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/4] Allow vif= to specify PCI address for each nic
This allows more then 32 nics. This can help with Windows finding nics at boot time. This allows changing config file: builder = "hvm" device_model_args_hvm = [ "-device", "pci-bridge,chassis_nr=2,msi=on,id=pciBridge5.0,multifunction=on,addr=0x15.0", "-device", "vmxnet3,id=nic3,netdev=net3,mac=00:0c:29:86:44:be,bus=pciBridge5.0,addr=0x4.0x0", "-netdev", "type=tap,id=net3,ifname=vif.3-emu,script=/etc/qemu-ifup,downscript=no", ] vif = [ ] to: builder = "hvm" device_model_args_hvm = [ "-device", "pci-bridge,chassis_nr=2,msi=on,id=pciBridge5.0,multifunction=on,addr=0x15.0", ] vif = [ "model=vmxnet3,bridge=xenbr0,mac=00:0c:29:86:44:a0,bus=pciBridge5.0,addr=0x4.0x0", ] which enables usage of xen-netback. Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx> CC: Don Slutz <dslutz@xxxxxxxxxxx> --- docs/misc/xl-network-configuration.markdown | 14 ++++++++++++++ tools/libxl/libxl_dm.c | 23 ++++++++++++++++++++--- tools/libxl/libxl_types.idl | 2 ++ tools/libxl/xl_cmdimpl.c | 4 ++++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/docs/misc/xl-network-configuration.markdown b/docs/misc/xl-network-configuration.markdown index 3c439d4..6a7f6db 100644 --- a/docs/misc/xl-network-configuration.markdown +++ b/docs/misc/xl-network-configuration.markdown @@ -60,6 +60,20 @@ strategy. Otherwise in general you should prefer to generate a random MAC and set the locally administered bit since this allows for more bits of randomness than using the Xen OUI. +### bus + +Specifies the name of the network bridge which this VIF should be +added to. The default is `xenbr0`. The bridge must be configured using +your distribution's network configuration tools. See the [wiki][net] +for guidance and examples. + +### addr + +Specifies the name of the network bridge which this VIF should be +added to. The default is `xenbr0`. The bridge must be configured using +your distribution's network configuration tools. See the [wiki][net] +for guidance and examples. + ### bridge Specifies the name of the network bridge which this VIF should be diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 8a8f972..2bf4dab 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -315,6 +315,16 @@ static int libxl__build_device_model_args_old(libxl__gc *gc, const char *ifname = libxl__device_nic_devname(gc, domid, nics[i].devid, LIBXL_NIC_TYPE_VIF_IOEMU); + if (nics[i].bus && nics[i].bus[0]) { + LOG(ERROR, + "bus= not supported by device_model_version=qemu-xen-traditional"); + return ERROR_INVAL; + } + if (nics[i].addr && nics[i].addr[0]) { + LOG(ERROR, + "addr= not supported by device_model_version=qemu-xen-traditional"); + return ERROR_INVAL; + } flexarray_vappend(dm_args, "-net", GCSPRINTF( @@ -747,11 +757,18 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, const char *ifname = libxl__device_nic_devname(gc, guest_domid, nics[i].devid, LIBXL_NIC_TYPE_VIF_IOEMU); + char * busp = ""; + char * addrp = ""; + + if (nics[i].bus && nics[i].bus[0]) + busp = libxl__sprintf(gc, ",bus=%s", nics[i].bus); + if (nics[i].addr && nics[i].addr[0]) + addrp = libxl__sprintf(gc, ",addr=%s", nics[i].addr); flexarray_append(dm_args, "-device"); - flexarray_append(dm_args, - libxl__sprintf(gc, "%s,id=nic%d,netdev=net%d,mac=%s", + flexarray_append(dm_args, GCSPRINTF( + "%s,id=nic%d,netdev=net%d,mac=%s%s%s", nics[i].model, nics[i].devid, - nics[i].devid, smac)); + nics[i].devid, smac, busp, addrp)); flexarray_append(dm_args, "-netdev"); flexarray_append(dm_args, GCSPRINTF( "type=tap,id=net%d,ifname=%s," diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index c7af74b..6d3b058 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -521,6 +521,8 @@ libxl_device_nic = Struct("device_nic", [ ("mtu", integer), ("model", string), ("mac", libxl_mac), + ("bus", string), + ("addr", string), ("ip", string), ("bridge", string), ("ifname", string), diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index b3fe0cd..c48d52a 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -961,6 +961,10 @@ static int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *to nic->mac[i] = val; oparg = endptr + 1; } + } else if (MATCH_OPTION("bus", token, oparg)) { + replace_string(&nic->bus, oparg); + } else if (MATCH_OPTION("addr", token, oparg)) { + replace_string(&nic->addr, oparg); } else if (MATCH_OPTION("bridge", token, oparg)) { replace_string(&nic->bridge, oparg); } else if (MATCH_OPTION("netdev", token, oparg)) { -- 1.8.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |