mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
net: Add a hub net client
The vlan feature can be implemented in terms of hubs. By introducing a hub net client it becomes possible to remove the special case vlan code from net.c and push the vlan feature out of generic networking code. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
34309d2b12
commit
f6c874e300
5 changed files with 282 additions and 16 deletions
17
net.c
17
net.c
|
@ -30,6 +30,7 @@
|
|||
#include "net/dump.h"
|
||||
#include "net/slirp.h"
|
||||
#include "net/vde.h"
|
||||
#include "net/hub.h"
|
||||
#include "net/util.h"
|
||||
#include "monitor.h"
|
||||
#include "qemu-common.h"
|
||||
|
@ -816,19 +817,20 @@ static int (* const net_client_init_fun[NET_CLIENT_OPTIONS_KIND_MAX])(
|
|||
const NetClientOptions *opts,
|
||||
const char *name,
|
||||
VLANState *vlan) = {
|
||||
[NET_CLIENT_OPTIONS_KIND_NIC] = net_init_nic,
|
||||
[NET_CLIENT_OPTIONS_KIND_NIC] = net_init_nic,
|
||||
#ifdef CONFIG_SLIRP
|
||||
[NET_CLIENT_OPTIONS_KIND_USER] = net_init_slirp,
|
||||
[NET_CLIENT_OPTIONS_KIND_USER] = net_init_slirp,
|
||||
#endif
|
||||
[NET_CLIENT_OPTIONS_KIND_TAP] = net_init_tap,
|
||||
[NET_CLIENT_OPTIONS_KIND_SOCKET] = net_init_socket,
|
||||
[NET_CLIENT_OPTIONS_KIND_TAP] = net_init_tap,
|
||||
[NET_CLIENT_OPTIONS_KIND_SOCKET] = net_init_socket,
|
||||
#ifdef CONFIG_VDE
|
||||
[NET_CLIENT_OPTIONS_KIND_VDE] = net_init_vde,
|
||||
[NET_CLIENT_OPTIONS_KIND_VDE] = net_init_vde,
|
||||
#endif
|
||||
[NET_CLIENT_OPTIONS_KIND_DUMP] = net_init_dump,
|
||||
[NET_CLIENT_OPTIONS_KIND_DUMP] = net_init_dump,
|
||||
#ifdef CONFIG_NET_BRIDGE
|
||||
[NET_CLIENT_OPTIONS_KIND_BRIDGE] = net_init_bridge,
|
||||
[NET_CLIENT_OPTIONS_KIND_BRIDGE] = net_init_bridge,
|
||||
#endif
|
||||
[NET_CLIENT_OPTIONS_KIND_HUBPORT] = net_init_hubport,
|
||||
};
|
||||
|
||||
|
||||
|
@ -858,6 +860,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
|
|||
#ifdef CONFIG_NET_BRIDGE
|
||||
case NET_CLIENT_OPTIONS_KIND_BRIDGE:
|
||||
#endif
|
||||
case NET_CLIENT_OPTIONS_KIND_HUBPORT:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue