Re: [Qemu-devel] [PATCH v3 for-2.13 1/3] net: Remove the deprecated "vlan" parameter

2018-04-17 Thread Paolo Bonzini
On 17/04/2018 10:08, Thomas Huth wrote:
>>> -"-net 
>>> nic[,vlan=n][,netdev=nd][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
>>> +"-net 
>>> nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\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=nd' 
>>> instead)\n"
>>> +"connect it to hub 0 (please use -nic for direct 
>>> connections)\n"
>> What does "direct connections" means?
> I mean a 1:1 connection between the backend and frontend here, without a
> hub inbetween. Can you think of a better wording?

"use -nic unless you need a hub"?

Paolo



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v3 for-2.13 1/3] net: Remove the deprecated "vlan" parameter

2018-04-17 Thread Thomas Huth
On 17.04.2018 09:21, Stefan Hajnoczi wrote:
> On Mon, Apr 16, 2018 at 08:44:39AM +0200, Thomas Huth wrote:
>> @@ -499,10 +497,11 @@
>>  # @opts: device type specific properties (legacy)
>>  #
>>  # Since: 1.2
>> +#
>> +# 'vlan' - removed with 2.12
> 
> Not sure how to interpret this.  How about "removed in 2.13"?

Sure, will change it.

>> @@ -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=n][,netdev=nd][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
>> +"-net 
>> nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\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=nd' instead)\n"
>> +"connect it to hub 0 (please use -nic for direct 
>> connections)\n"
> 
> What does "direct connections" means?

I mean a 1:1 connection between the backend and frontend here, without a
hub inbetween. Can you think of a better wording?

 Thomas



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v3 for-2.13 1/3] net: Remove the deprecated "vlan" parameter

2018-04-17 Thread Stefan Hajnoczi
On Mon, Apr 16, 2018 at 08:44:39AM +0200, Thomas Huth wrote:
> @@ -499,10 +497,11 @@
>  # @opts: device type specific properties (legacy)
>  #
>  # Since: 1.2
> +#
> +# 'vlan' - removed with 2.12

Not sure how to interpret this.  How about "removed in 2.13"?

> @@ -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=n][,netdev=nd][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
> +"-net nic[,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\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=nd' instead)\n"
> +"connect it to hub 0 (please use -nic for direct 
> connections)\n"

What does "direct connections" means?


signature.asc
Description: PGP signature


[Qemu-devel] [PATCH v3 for-2.13 1/3] net: Remove the deprecated "vlan" parameter

2018-04-16 Thread 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=0"
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 
---
 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.
 
 Some PCI devices aren't available with -net nic, e.g. i82558a.
 
-To connect to a VLAN instead of an ordinary host part, replace
-netdev=NET-ID by vlan=VLAN.
-
 === Graphics Devices ===
 
 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-system.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 = {
 .set   = set_netdev,
 };
 
-/* --- vlan --- */
-
-static int print_vlan(DeviceState *dev, Property *prop, char *dest, size_t len)
-{
-NetClientState **ptr = qdev_get_prop_ptr(dev, prop);
-
-if (*ptr) {
-int id;
-if (!net_hub_id_for_client(*ptr, )) {
-return snprintf(dest, len, "%d", id);
-}
-}
-
-return snprintf(dest, len, "");
-}
-
-static void get_vlan(Object *obj, Visitor *v, const char *name, void *opaque,
- Error **errp)
-{
-DeviceState *dev = DEVICE(obj);
-Property *prop = opaque;
-NetClientState **ptr = qdev_get_prop_ptr(dev, prop);
-int32_t id = -1;
-
-if (*ptr) {
-int hub_id;
-if (!net_hub_id_for_client(*ptr, _id)) {
-id = hub_id;
-}
-}
-
-visit_type_int32(v, name, , errp);
-}
-
-static void set_vlan(Object *obj, Visitor *v, const char *name, void *opaque,
- Error **errp)
-{
-DeviceState *dev = DEVICE(obj);
-Property *prop = opaque;
-NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop);
-NetClientState **ptr = _ptr->ncs[0];
-Error *local_err = NULL;
-int32_t id;
-NetClientState *hubport;
-
-if (dev->realized) {
-qdev_prop_set_after_realize(dev, name, errp);
-return;
-}
-
-visit_type_int32(v, name, , _err);
-if (local_err) {
-error_propagate(errp, local_err);
-return;
-}
-if (id == -1) {
-*ptr = NULL;
-return;
-}
-if (*ptr) {
-error_set_from_qdev_prop_error(errp, -EINVAL, dev, prop, name);
-return;
-}
-
-hubport = net_hub_port_find(id);
-if (!hubport) {
-error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
-   name, prop->info->name);
-return;
-}
-*ptr = hubport;
-}
-
-const PropertyInfo qdev_prop_vlan = {
-.name  = "int32",
-.description = "Integer VLAN id to connect to",
-.print = print_vlan,
-.get   = get_vlan,
-.set   = set_vlan,
-};
 
 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