From nobody Wed Dec 17 21:47:01 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526284708705841.1567610503273; Mon, 14 May 2018 00:58:28 -0700 (PDT) Received: from localhost ([::1]:48777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fI8NH-0000Wt-QM for importer@patchew.org; Mon, 14 May 2018 03:58:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fI8L9-0007mi-QV for qemu-devel@nongnu.org; Mon, 14 May 2018 03:56:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fI8L7-0004Pp-IE for qemu-devel@nongnu.org; Mon, 14 May 2018 03:56:15 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38830 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fI8L7-0004Pf-BZ for qemu-devel@nongnu.org; Mon, 14 May 2018 03:56:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA27D406E897; Mon, 14 May 2018 07:56:12 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-146.pek2.redhat.com [10.72.12.146]) by smtp.corp.redhat.com (Postfix) with ESMTP id 399CCAB3F8; Mon, 14 May 2018 07:56:09 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Mon, 14 May 2018 15:55:58 +0800 Message-Id: <1526284560-20266-3-git-send-email-jasowang@redhat.com> In-Reply-To: <1526284560-20266-1-git-send-email-jasowang@redhat.com> References: <1526284560-20266-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 14 May 2018 07:56:12 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 14 May 2018 07:56:12 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jasowang@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 2/4] net: Remove the deprecated "vlan" parameter X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth It's been marked as deprecated since QEMU v2.9.0, so that should have been enough time for everybody to either just drop unnecessary "vlan=3D0" parameters, to switch to the modern -device + -netdev syntax for connecting guest NICs with host network backends, or to switch to the "hubport" netdev in case hubs are really wanted instead. Buglink: https://bugs.launchpad.net/qemu/+bug/658904 Signed-off-by: Thomas Huth Reviewed-by: Stefan Hajnoczi Signed-off-by: Jason Wang --- docs/qdev-device-use.txt | 3 -- hw/core/qdev-properties-system.c | 80 ------------------------------------= ---- include/hw/qdev-properties.h | 3 -- include/net/net.h | 1 - net/net.c | 12 ++---- qapi/net.json | 15 ++++---- qemu-doc.texi | 9 ----- qemu-options.hx | 29 ++++++--------- 8 files changed, 22 insertions(+), 130 deletions(-) diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt index 8f188d1..98229b3 100644 --- a/docs/qdev-device-use.txt +++ b/docs/qdev-device-use.txt @@ -277,9 +277,6 @@ devices and ne2k_isa are. =20 Some PCI devices aren't available with -net nic, e.g. i82558a. =20 -To connect to a VLAN instead of an ordinary host part, replace -netdev=3DNET-ID by vlan=3DVLAN. - =3D=3D=3D Graphics Devices =3D=3D=3D =20 Host and guest part of graphics devices have always been separate. diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 1d3ba72..8b22fb5 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -321,86 +321,6 @@ const PropertyInfo qdev_prop_netdev =3D { .set =3D set_netdev, }; =20 -/* --- vlan --- */ - -static int print_vlan(DeviceState *dev, Property *prop, char *dest, size_t= len) -{ - NetClientState **ptr =3D qdev_get_prop_ptr(dev, prop); - - if (*ptr) { - int id; - if (!net_hub_id_for_client(*ptr, &id)) { - return snprintf(dest, len, "%d", id); - } - } - - return snprintf(dest, len, ""); -} - -static void get_vlan(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) -{ - DeviceState *dev =3D DEVICE(obj); - Property *prop =3D opaque; - NetClientState **ptr =3D qdev_get_prop_ptr(dev, prop); - int32_t id =3D -1; - - if (*ptr) { - int hub_id; - if (!net_hub_id_for_client(*ptr, &hub_id)) { - id =3D hub_id; - } - } - - visit_type_int32(v, name, &id, errp); -} - -static void set_vlan(Object *obj, Visitor *v, const char *name, void *opaq= ue, - Error **errp) -{ - DeviceState *dev =3D DEVICE(obj); - Property *prop =3D opaque; - NICPeers *peers_ptr =3D qdev_get_prop_ptr(dev, prop); - NetClientState **ptr =3D &peers_ptr->ncs[0]; - Error *local_err =3D NULL; - int32_t id; - NetClientState *hubport; - - if (dev->realized) { - qdev_prop_set_after_realize(dev, name, errp); - return; - } - - visit_type_int32(v, name, &id, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } - if (id =3D=3D -1) { - *ptr =3D NULL; - return; - } - if (*ptr) { - error_set_from_qdev_prop_error(errp, -EINVAL, dev, prop, name); - return; - } - - hubport =3D net_hub_port_find(id); - if (!hubport) { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - name, prop->info->name); - return; - } - *ptr =3D hubport; -} - -const PropertyInfo qdev_prop_vlan =3D { - .name =3D "int32", - .description =3D "Integer VLAN id to connect to", - .print =3D print_vlan, - .get =3D get_vlan, - .set =3D set_vlan, -}; =20 void qdev_prop_set_drive(DeviceState *dev, const char *name, BlockBackend *value, Error **errp) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index b2ad8e9..4f60cc8 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -29,7 +29,6 @@ extern const PropertyInfo qdev_prop_bios_chs_trans; extern const PropertyInfo qdev_prop_fdc_drive_type; extern const PropertyInfo qdev_prop_drive; extern const PropertyInfo qdev_prop_netdev; -extern const PropertyInfo qdev_prop_vlan; extern const PropertyInfo qdev_prop_pci_devfn; extern const PropertyInfo qdev_prop_blocksize; extern const PropertyInfo qdev_prop_pci_host_devaddr; @@ -195,8 +194,6 @@ extern const PropertyInfo qdev_prop_off_auto_pcibar; DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*) #define DEFINE_PROP_NETDEV(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, NICPeers) -#define DEFINE_PROP_VLAN(_n, _s, _f) \ - DEFINE_PROP(_n, _s, _f, qdev_prop_vlan, NICPeers) #define DEFINE_PROP_DRIVE(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockBackend *) #define DEFINE_PROP_MACADDR(_n, _s, _f) \ diff --git a/include/net/net.h b/include/net/net.h index 1f7341e..1425960 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -37,7 +37,6 @@ typedef struct NICConf { =20 #define DEFINE_NIC_PROPERTIES(_state, _conf) \ DEFINE_PROP_MACADDR("mac", _state, _conf.macaddr), \ - DEFINE_PROP_VLAN("vlan", _state, _conf.peers), \ DEFINE_PROP_NETDEV("netdev", _state, _conf.peers) =20 =20 diff --git a/net/net.c b/net/net.c index 65457b7..efb9eaf 100644 --- a/net/net.c +++ b/net/net.c @@ -965,7 +965,6 @@ static int net_client_init1(const void *object, bool is= _netdev, Error **errp) const Netdev *netdev; const char *name; NetClientState *peer =3D NULL; - static bool vlan_warned; =20 if (is_netdev) { netdev =3D object; @@ -1036,15 +1035,10 @@ static int net_client_init1(const void *object, boo= l is_netdev, Error **errp) return -1; } =20 - /* Do not add to a vlan if it's a nic with a netdev=3D parameter. = */ + /* Do not add to a hub if it's a nic with a netdev=3D parameter. */ if (netdev->type !=3D NET_CLIENT_DRIVER_NIC || !opts->u.nic.has_netdev) { - peer =3D net_hub_add_port(net->has_vlan ? net->vlan : 0, NULL,= NULL); - } - - if (net->has_vlan && !vlan_warned) { - error_report("'vlan' is deprecated. Please use 'netdev' instea= d."); - vlan_warned =3D true; + peer =3D net_hub_add_port(0, NULL, NULL); } } =20 @@ -1365,7 +1359,7 @@ void qmp_set_link(const char *name, bool up, Error **= errp) * If the peer is a HUBPORT or a backend, we do not change the * link status. * - * This behavior is compatible with qemu vlans where there could be + * This behavior is compatible with qemu hubs where there could be * multiple clients that can still communicate with each other in * disconnected mode. For now maintain this compatibility. */ diff --git a/qapi/net.json b/qapi/net.json index 9117c56..b4fe4b6 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -209,7 +209,7 @@ ## # @NetdevTapOptions: # -# Connect the host TAP network interface name to the VLAN. +# Used to configure a host TAP network interface backend. # # @ifname: interface name # @@ -267,8 +267,8 @@ ## # @NetdevSocketOptions: # -# Connect the VLAN to a remote VLAN in another QEMU virtual machine using = a TCP -# socket connection. +# Socket netdevs are used to establish a network connection to another +# QEMU virtual machine via a TCP socket. # # @fd: file descriptor of an already opened socket # @@ -296,7 +296,7 @@ ## # @NetdevL2TPv3Options: # -# Connect the VLAN to Ethernet over L2TPv3 Static tunnel +# Configure an Ethernet over L2TPv3 tunnel. # # @src: source address # @@ -352,7 +352,7 @@ ## # @NetdevVdeOptions: # -# Connect the VLAN to a vde switch running on the host. +# Connect to a vde switch running on the host. # # @sock: socket path # @@ -490,8 +490,6 @@ # # Captures the configuration of a network device; legacy. # -# @vlan: vlan number -# # @id: identifier for monitor commands # # @name: identifier for monitor commands, ignored if @id is present @@ -499,10 +497,11 @@ # @opts: device type specific properties (legacy) # # Since: 1.2 +# +# 'vlan' - removed with 2.12 ## { 'struct': 'NetLegacy', 'data': { - '*vlan': 'int32', '*id': 'str', '*name': 'str', 'opts': 'NetLegacyOptions' } } diff --git a/qemu-doc.texi b/qemu-doc.texi index 0ed0f19..9216848 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2855,15 +2855,6 @@ with ``-device ...,netdev=3Dx''), or ``-nic user,smb= =3D/some/dir'' (for embedded NICs). The new syntax allows different settings to be provided per NIC. =20 -@subsection -net vlan (since 2.9.0) - -The ``-net vlan=3DNN'' argument was mostly used to attach separate -network backends to different virtual NICs. This is the default -behavior for ``-netdev'' and ``-nic''. You can connect multiple -``-netdev'' and ``-nic'' devices to the same network using the -"hubport" network backend, created with ``-netdev hubport,hubid=3DNN,...'' -and ``-nic hubport,hubid=3DNN''. - @subsection -drive cyls=3D...,heads=3D...,secs=3D...,trans=3D... (since 2.= 10.0) =20 The drive geometry arguments are replaced by the the geometry arguments diff --git a/qemu-options.hx b/qemu-options.hx index c611766..3588b04 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2003,7 +2003,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, " configure a vhost-user network, backed by a chardev '= dev'\n" #endif "-netdev hubport,id=3Dstr,hubid=3Dn[,netdev=3Dnd]\n" - " configure a hub port on QEMU VLAN 'n'\n", QEMU_ARCH_A= LL) + " configure a hub port on the hub with ID 'n'\n", QEMU_= ARCH_ALL) DEF("nic", HAS_ARG, QEMU_OPTION_nic, "--nic [tap|bridge|" #ifdef CONFIG_SLIRP @@ -2028,10 +2028,9 @@ DEF("nic", HAS_ARG, QEMU_OPTION_nic, " provided a 'user' network connection)\n", QEMU_ARCH_ALL) DEF("net", HAS_ARG, QEMU_OPTION_net, - "-net nic[,vlan=3Dn][,netdev=3Dnd][,macaddr=3Dmac][,model=3Dtype][,nam= e=3Dstr][,addr=3Dstr][,vectors=3Dv]\n" + "-net nic[,macaddr=3Dmac][,model=3Dtype][,name=3Dstr][,addr=3Dstr][,ve= ctors=3Dv]\n" " configure or create an on-board (or machine default) = NIC and\n" - " connect it either to VLAN 'n' or the netdev 'nd' (for= pluggable\n" - " NICs please use '-device devtype,netdev=3Dnd' instead= )\n" + " connect it to hub 0 (please use -nic unless you need = a hub)\n" "-net [" #ifdef CONFIG_SLIRP "user|" @@ -2044,7 +2043,7 @@ DEF("net", HAS_ARG, QEMU_OPTION_net, #ifdef CONFIG_NETMAP "netmap|" #endif - "socket][,vlan=3Dn][,option][,option][,...]\n" + "socket][,option][,option][,...]\n" " old way to initialize a host network interface\n" " (use the -netdev option if possible instead)\n", QEMU= _ARCH_ALL) STEXI @@ -2462,17 +2461,14 @@ qemu -m 512 -object memory-backend-file,id=3Dmem,si= ze=3D512M,mem-path=3D/hugetlbfs,sha Create a hub port on the emulated hub with ID @var{hubid}. =20 The hubport netdev lets you connect a NIC to a QEMU emulated hub instead o= f a -single netdev. @code{-net} and @code{-device} with the parameter @option{v= lan} -(deprecated), or @code{-nic hubport} can also be used to connect a -network device or a NIC to a hub. Alternatively, you can also connect the -hubport to another netdev with ID @var{nd} by using the @option{netdev=3D@= var{nd}} -option. +single netdev. Alternatively, you can also connect the hubport to another +netdev with ID @var{nd} by using the @option{netdev=3D@var{nd}} option. =20 -@item -net nic[,vlan=3D@var{n}][,netdev=3D@var{nd}][,macaddr=3D@var{mac}][= ,model=3D@var{type}] [,name=3D@var{name}][,addr=3D@var{addr}][,vectors=3D@v= ar{v}] +@item -net nic[,netdev=3D@var{nd}][,macaddr=3D@var{mac}][,model=3D@var{typ= e}] [,name=3D@var{name}][,addr=3D@var{addr}][,vectors=3D@var{v}] @findex -net Legacy option to configure or create an on-board (or machine default) Netw= ork -Interface Card(NIC) and connect it either to the emulated hub port ("vlan") -with number @var{n} (@var{n} =3D 0 is the default), or to the netdev @var{= nd}. +Interface Card(NIC) and connect it either to the emulated hub with ID 0 (i= .e. +the default hub), or to the netdev @var{nd}. The NIC is an e1000 by default on the PC target. Optionally, the MAC addre= ss can be changed to @var{mac}, the device address set to @var{addr} (PCI car= ds only), and a @var{name} can be assigned for use in monitor commands. @@ -2482,11 +2478,10 @@ that the card should have; this option currently on= ly affects virtio cards; set NIC is created. QEMU can emulate several different models of network card. Use @code{-net nic,model=3Dhelp} for a list of available devices for your = target. =20 -@item -net user|tap|bridge|socket|l2tpv3|vde[,...][,vlan=3D@var{n}][,name= =3D@var{name}] +@item -net user|tap|bridge|socket|l2tpv3|vde[,...][,name=3D@var{name}] Configure a host network backend (with the options corresponding to the sa= me -@option{-netdev} option) and connect it to the emulated hub ("vlan") with = the -number @var{n} (default is number 0). Use @var{name} to specify the name o= f the -hub port. +@option{-netdev} option) and connect it to the emulated hub 0 (the default +hub). Use @var{name} to specify the name of the hub port. ETEXI =20 STEXI --=20 2.7.4