Skip to contentSkip to conversation

net: Mark the 'hubport' netdev as deprecated

PATCH In review Thomas Huth 3 participants 6 messages May 24, 2017 – Sep 20, 2017 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Mark the 'hubport' netdev as deprecated

The 'hubport' netdev is closely tied to the 'vlan' concept which has been marked as deprecated in commit a2dbe1356faff3cb6 already. Thus we should also mark the hubport netdevs as deprecated to make the remaining users aware that they should not use this anymore.

---
 net/hub.c       | 4 ++++
 qemu-options.hx | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
net/hub.c +4 -0
index 32d8cf5..85bd5bc 100644
@@ -13,6 +13,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "monitor/monitor.h"
 #include "net/net.h"
 #include "clients.h"
@@ -286,6 +287,9 @@ int net_init_hubport(const Netdev *netdev, const char *name,
 {
     const NetdevHubPortOptions *hubport;
 
+    error_report("hubports are deprecated and will be removed in a "
+                 "future release");
+
     assert(netdev->type == NET_CLIENT_DRIVER_HUBPORT);
     assert(!peer);
     hubport = &netdev->u.hubport;
qemu-options.hx +4 -2
index dc1a48a..efb555c 100644
@@ -1810,7 +1810,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
     "-netdev vhost-user,id=str,chardev=dev[,vhostforce=on|off]\n"
     "                configure a vhost-user network, backed by a chardev 'dev'\n"
     "-netdev hubport,id=str,hubid=n\n"
-    "                configure a hub port on QEMU VLAN 'n'\n", QEMU_ARCH_ALL)
+    "                configure a hub port on QEMU VLAN 'n' (deprecated)\n", QEMU_ARCH_ALL)
 DEF("net", HAS_ARG, QEMU_OPTION_net,
     "-net nic[,vlan=n][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
     "                old way to create a new NIC and connect it to VLAN 'n'\n"
@@ -2239,7 +2239,9 @@ Create a hub port on QEMU "vlan" @var{hubid}.
 
 The hubport netdev lets you connect a NIC to a QEMU "vlan" instead of a single
 netdev.  @code{-net} and @code{-device} with parameter @option{vlan} create the
-required hub automatically.
+required hub automatically. Note that the "vlan" concept and thus the hubport
+option, too, are considered as deprecated and might be removed in a future
+release of QEMU.
 
 @item -netdev vhost-user,chardev=@var{id}[,vhostforce=on|off][,queues=n]
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 48 lines · Thomas Huth

The 'hubport' netdev is closely tied to the 'vlan' concept which has been marked as deprecated in commit a2dbe1356faff3cb6 already. Thus we should also mark the hubport netdevs as deprecated to make the remaining users aware that they should not use this anymore.

---
 net/hub.c       | 4 ++++
 qemu-options.hx | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
net/hub.c +4 -0
index 32d8cf5..85bd5bc 100644
@@ -13,6 +13,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "monitor/monitor.h"
 #include "net/net.h"
 #include "clients.h"
@@ -286,6 +287,9 @@ int net_init_hubport(const Netdev *netdev, const char *name,
 {
     const NetdevHubPortOptions *hubport;
 
+    error_report("hubports are deprecated and will be removed in a "
+                 "future release");
+
     assert(netdev->type == NET_CLIENT_DRIVER_HUBPORT);
     assert(!peer);
     hubport = &netdev->u.hubport;
qemu-options.hx +1 -1
index dc1a48a..efb555c 100644
@@ -1810,7 +1810,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
     "-netdev vhost-user,id=str,chardev=dev[,vhostforce=on|off]\n"
     "                configure a vhost-user network, backed by a chardev 'dev'\n"
     "-netdev hubport,id=str,hubid=n\n"
-    "                configure a hub port on QEMU VLAN 'n'\n", QEMU_ARCH_ALL)
+    "                configure a hub port on QEMU VLAN 'n' (deprecated)\n", QEMU_ARCH_ALL)
 DEF("net", HAS_ARG, QEMU_OPTION_net,
     "-net nic[,vlan=n][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
     "                old way to create a new NIC and connect it to VLAN 'n'\n"

qemu-options.hx Create a hub port on QEMU "vlan" @var{hubid}. · line 2247

Quoted 10 lines
qemu-options.hx +3 -1
@@ -2239,7 +2239,9 @@ Create a hub port on QEMU "vlan" @var{hubid}.
 
 The hubport netdev lets you connect a NIC to a QEMU "vlan" instead of a single
 netdev.  @code{-net} and @code{-device} with parameter @option{vlan} create the
-required hub automatically.
+required hub automatically. Note that the "vlan" concept and thus the hubport
+option, too, are considered as deprecated and might be removed in a future
+release of QEMU.
 
 @item -netdev vhost-user,chardev=@var{id}[,vhostforce=on|off][,queues=n]
 

ping?

Thomas

#3 lore raw
In reply to Paolo Bonzini
Quoted 7 lines · Paolo Bonzini
Quoted 6 lines · Thomas Huth
Quoted 5 lines · Thomas Huth

The 'hubport' netdev is closely tied to the 'vlan' concept which has been marked as deprecated in commit a2dbe1356faff3cb6 already. Thus we should also mark the hubport netdevs as deprecated to make the remaining users aware that they should not use this anymore.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

What is the replacement for VLANs?

The point of hub/hubport was to implement this without needing special-casing of VLANs everywhere in the net/ directory. VLANs remain messy in terms of command-line expression for -net, but that's where the problems end.

The QEMU "VLAN"s are a complete PITA for the users, they are causing confusion (e.g. https://bugs.launchpad.net/qemu/+bug/658904) and mis-configurations (see e.g.
http://lists.gnu.org/archive/html/qemu-discuss/2017-08/msg00031.html).
So I hope you agree that we should get rid of this "vlan" stuff in QEMU (no matter whether we continue to provide some kind of "hub" or "switch" instead or completely remove it).

Quoted 5 lines

In fact, while there are some uses of VLANs that have been replaced by filters, VLANs are still needed to place 2 NICs to be on the same guest network without using a host bridge. This should be a supported use case for e.g. L2TP backends, and it can be important for users that don't have the ability to configure a host bridge.

I don't think that anybody really wants to connect two NICs of one machine to a *hub* - all the network traffic of one NIC will go to the other, too! That might only make sense if you want to do some basic network driver tests in your guest, but for every normal OS, this is nonsense. You normally are also not doing this with real hardware (note that we're talking about hubs, not switches!).

Quoted 18 lines

Rather than deprecating hubport, we need a mechanism to define a hubport for the back-end side. For example:

-netdev l2tp,...,id=l2tp-backend
-netdev hubport,hubid=0,netdev=l2tp-backend,id=l2tp-hub -netdev hubport,hubid=0,id=nic0 -device virtio-net-pci,netdev=nic0 -netdev hubport,hubid=0,id=nic1 -device virtio-net-pci,netdev=nic1

This would normalize the topology

NIC NIC L2TP

    |        |        |
   hubport  hubport   |
    |        |        |
    '--------'--------'-------- hub

to

Quoted 8 lines

NIC NIC L2TP

    |        |        |
   hubport  hubport  hubport
    |        |        |
    '--------'--------'-------- hub

and would let us drop vlan from the command-line options. Even immediately in 2.11.

While that looks at least way more logical than the "vlan" parameter, I really doubt that we need a *hub* within QEMU. Emulating a switch might make at least a little bit more sense ... but still, do we really need this? Do you have any real world example where somebody is using QEMU for a configuration like this?

Thomas

PS: Or are you just afraid that we might finally get rid of the short "-net nic -net tap" syntax, which is way easier to type than its -netdev equivalent? Well, I'd say that's a different topic, and we should come up with a new convenience option instead before we remove the old one.

#5 lore raw
In reply to Thomas Huth
Quoted 11 lines · Thomas Huth
Quoted 10 lines · Thomas Huth

The 'hubport' netdev is closely tied to the 'vlan' concept which has been marked as deprecated in commit a2dbe1356faff3cb6 already. Thus we should also mark the hubport netdevs as deprecated to make the remaining users aware that they should not use this anymore.

---
 net/hub.c       | 4 ++++
 qemu-options.hx | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

Needs to include a update to the qemu-doc.texi "Deprecated features" appendix

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
In reply to Thomas Huth
Quoted 7 lines · Thomas Huth
Quoted 6 lines · Thomas Huth

The 'hubport' netdev is closely tied to the 'vlan' concept which has been marked as deprecated in commit a2dbe1356faff3cb6 already. Thus we should also mark the hubport netdevs as deprecated to make the remaining users aware that they should not use this anymore.

What is the replacement for VLANs?

The point of hub/hubport was to implement this without needing special-casing of VLANs everywhere in the net/ directory. VLANs remain messy in terms of command-line expression for -net, but that's where the problems end.

In fact, while there are some uses of VLANs that have been replaced by filters, VLANs are still needed to place 2 NICs to be on the same guest network without using a host bridge. This should be a supported use case for e.g. L2TP backends, and it can be important for users that don't have the ability to configure a host bridge.

In addition, depending on how you read the warning in commit a2dbe1356, this patch could be deprecating the exact replacement that you're suggesting in the warning.

Rather than deprecating hubport, we need a mechanism to define a hubport for the back-end side. For example:

-netdev l2tp,...,id=l2tp-backend
-netdev hubport,hubid=0,netdev=l2tp-backend,id=l2tp-hub -netdev hubport,hubid=0,id=nic0 -device virtio-net-pci,netdev=nic0 -netdev hubport,hubid=0,id=nic1 -device virtio-net-pci,netdev=nic1

This would normalize the topology

NIC NIC L2TP

    |        |        |
   hubport  hubport   |
    |        |        |
    '--------'--------'-------- hub

to

NIC NIC L2TP

    |        |        |
   hubport  hubport  hubport
    |        |        |
    '--------'--------'-------- hub

and would let us drop vlan from the command-line options. Even immediately in 2.11.

(Also, the reasoning in commit a2dbe1356 seems backwards, what's wrong with connecting two NICs with a cross cable? If you can do it with physical hardware, you ought to be able to do it in QEMU).

And in any case, this is certainly not a trivial patch!

Paolo

Quoted 57 lines
Quoted 42 lines
---
 net/hub.c       | 4 ++++
 qemu-options.hx | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
net/hub.c +4 -0
index 32d8cf5..85bd5bc 100644
@@ -13,6 +13,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "monitor/monitor.h"
 #include "net/net.h"
 #include "clients.h"
@@ -286,6 +287,9 @@ int net_init_hubport(const Netdev *netdev, const char *name,
 {
     const NetdevHubPortOptions *hubport;
 
+    error_report("hubports are deprecated and will be removed in a "
+                 "future release");
+
     assert(netdev->type == NET_CLIENT_DRIVER_HUBPORT);
     assert(!peer);
     hubport = &netdev->u.hubport;
qemu-options.hx +1 -1
index dc1a48a..efb555c 100644
@@ -1810,7 +1810,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev,
     "-netdev vhost-user,id=str,chardev=dev[,vhostforce=on|off]\n"
     "                configure a vhost-user network, backed by a chardev 'dev'\n"
     "-netdev hubport,id=str,hubid=n\n"
-    "                configure a hub port on QEMU VLAN 'n'\n", QEMU_ARCH_ALL)
+    "                configure a hub port on QEMU VLAN 'n' (deprecated)\n", QEMU_ARCH_ALL)
 DEF("net", HAS_ARG, QEMU_OPTION_net,
     "-net nic[,vlan=n][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n"
     "                old way to create a new NIC and connect it to VLAN 'n'\n"

qemu-options.hx Create a hub port on QEMU "vlan" @var{hubid}. · line 2247

Quoted 10 lines
qemu-options.hx +3 -1
@@ -2239,7 +2239,9 @@ Create a hub port on QEMU "vlan" @var{hubid}.
 
 The hubport netdev lets you connect a NIC to a QEMU "vlan" instead of a single
 netdev.  @code{-net} and @code{-device} with parameter @option{vlan} create the
-required hub automatically.
+required hub automatically. Note that the "vlan" concept and thus the hubport
+option, too, are considered as deprecated and might be removed in a future
+release of QEMU.
 
 @item -netdev vhost-user,chardev=@var{id}[,vhostforce=on|off][,queues=n]
 

ping?

Thomas

#4 lore raw
In reply to Thomas Huth
Quoted 31 lines · Thomas Huth
Quoted 7 lines · Paolo Bonzini
Quoted 6 lines · Thomas Huth
Quoted 5 lines · Thomas Huth

The 'hubport' netdev is closely tied to the 'vlan' concept which has been marked as deprecated in commit a2dbe1356faff3cb6 already. Thus we should also mark the hubport netdevs as deprecated to make the remaining users aware that they should not use this anymore.

Quoted 8 lines
Quoted 1 line
Quoted 1 line

What is the replacement for VLANs?

The point of hub/hubport was to implement this without needing special-casing of VLANs everywhere in the net/ directory. VLANs remain messy in terms of command-line expression for -net, but that's where the problems end.

The QEMU "VLAN"s are a complete PITA for the users, they are causing confusion (e.g. https://bugs.launchpad.net/qemu/+bug/658904) and mis-configurations (see e.g.
http://lists.gnu.org/archive/html/qemu-discuss/2017-08/msg00031.html).
So I hope you agree that we should get rid of this "vlan" stuff in QEMU (no matter whether we continue to provide some kind of "hub" or "switch" instead or completely remove it).

Quoted 5 lines

In fact, while there are some uses of VLANs that have been replaced by filters, VLANs are still needed to place 2 NICs to be on the same guest network without using a host bridge. This should be a supported use case for e.g. L2TP backends, and it can be important for users that don't have the ability to configure a host bridge.

Quoted 6 lines

I don't think that anybody really wants to connect two NICs of one machine to a *hub* - all the network traffic of one NIC will go to the other, too! That might only make sense if you want to do some basic network driver tests in your guest, but for every normal OS, this is nonsense. You normally are also not doing this with real hardware (note that we're talking about hubs, not switches!).

Whether it's a hub or switch is an implementation detail; currently QEMU supports hubs, which is probably a good idea because this _is_ a somewhat fringe use and performance isn't super important.

Quoted 5 lines

While that looks at least way more logical than the "vlan" parameter, I really doubt that we need a *hub* within QEMU. Emulating a switch might make at least a little bit more sense ... but still, do we really need this? Do you have any real world example where somebody is using QEMU for a configuration like this?

If you have two NICs and SLIRP, for example, the two NICs will be in entirely different subnets and cannot talk to each other without setting up something like proxy ARP in the guest.

Quoted 4 lines

PS: Or are you just afraid that we might finally get rid of the short "-net nic -net tap" syntax, which is way easier to type than its -netdev equivalent? Well, I'd say that's a different topic, and we should come up with a new convenience option instead before we remove the old one.

No, this is a different topic. It's just about hubs and providing a replacement for these four lines of net/net.c:

     if (netdev->type != NET_CLIENT_DRIVER_NIC ||
         !opts->u.nic.has_netdev) {
         peer = net_hub_add_port(net->has_vlan ? net->vlan : 0, NULL);
     }

Regarding "-net", a replacement for "-net nic,vlan=0 -net tap,vlan=0 -net nic,vlan=1 -net tap,vlan=1" (where the connection is point-to-point and vlans are pointless) already exists using "-net nic,netdev". If you removed VLANs then "-net nic -net tap" could be kept as syntactic sugar, but "-net nic -net nic -net tap" would not. Instead, you'd have to declare the three hubports manually and use "-net nic,netdev=hubportN".

Paolo