On Tue, Jul 24, 2012 at 4:35 PM, Stefan Hajnoczi <stefa...@linux.vnet.ibm.com> wrote: > [These patches are based on the net tree at git://github.com/stefanha/net] > > The QEMU net subsystem has the concept of separate network segments, called > "VLANs". Each VLAN is a broadcast domain so all net clients connected to the > same VLAN can communicate with each other. > > Today this feature is mostly used with the "dump" backend, which saves packet > captures to .pcap files. It can still come in useful in other rare cases. > > This patch series moves the VLAN code out of net.c and into net/hub.c. The > idea is to introduce a software network hub along with hub port net clients. > This way we can implement the same semantics of QEMU VLANs using just -netdev > peer. Then -netdev peer becomes the single method of connecting net clients. > > The end result of this series is that the net subsystem core is simplified. > Now is a good time to do this because it saves us from modeling QEMU VLANs > when > we convert the net subsystem to QOM. > > Please note that this series preserves command-line compatibility with the > QEMU > VLAN feature. No existing QEMU command-lines should break. > > I have tested the following configurations: > * -net user -net nic,model=virtio > * -net user,vlan=1 -net nic,model=virtio,vlan=1 > * -net user,vlan=1 -net nic,model=virtio,vlan=1 -net user,vlan=2 -net > nic,model=virtio,vlan=2 > * -netdev user,id=netdev0 -device virtio-net-pci,netdev=netdev0 > * -netdev user,id=netdev0 -device virtio-net-pci,netdev=netdev0 -net > user,vlan=2 -net nic,model=virtio,vlan=2 > > v2: > * Change int64_t and unsigned int mess to int which is what VLAN IDs are > today [Laszlo] > * Remove bogus error_set() -> qerror_report() merge artifact [Laszlo] > * Use net_hub_id_for_client(nc, NULL) == 0 instead of adding > net_hub_port_peer_nc() [Laszlo] > * Fix stray print_net_client(..., NetClientState *vc) argument name [Laszlo] > * Consistently update vlan -> peer argument name [Laszlo] > * Drop spurious closesocket(fd), probably merge conflict [Stefan] > > Stefan Hajnoczi (11): > net: Add a hub net client > net: Use hubs for the vlan feature > net: Look up 'vlan' net clients using hubs > hub: Check that hubs are configured correctly > net: Drop vlan argument to qemu_new_net_client() > net: Remove vlan code from net.c > net: Remove VLANState > net: Rename non_vlan_clients to net_clients > net: Rename VLANClientState to NetClientState > net: Rename vc local variables to nc > net: Rename qemu_del_vlan_client() to qemu_del_net_client() > > Zhi Yong Wu (5): > net: Convert qdev_prop_vlan to peer with hub > net: Make "info network" output more readable info > net: cleanup deliver/deliver_iov func pointers > net: determine if packets can be sent before net queue deliver > packets > hub: add the support for hub own flow control > > hw/cadence_gem.c | 8 +- > hw/dp8393x.c | 7 +- > hw/e1000.c | 10 +- > hw/eepro100.c | 8 +- > hw/etraxfs_eth.c | 8 +- > hw/exynos4_boards.c | 2 +- > hw/highbank.c | 2 +- > hw/integratorcp.c | 2 +- > hw/kzm.c | 2 +- > hw/lan9118.c | 8 +- > hw/lance.c | 2 +- > hw/mcf5208.c | 2 +- > hw/mcf_fec.c | 7 +- > hw/milkymist-minimac2.c | 6 +- > hw/mips_mipssim.c | 2 +- > hw/mips_r4k.c | 2 +- > hw/mipsnet.c | 6 +- > hw/musicpal.c | 6 +- > hw/ne2000-isa.c | 2 +- > hw/ne2000.c | 8 +- > hw/ne2000.h | 4 +- > hw/opencores_eth.c | 8 +- > hw/pcnet-pci.c | 4 +- > hw/pcnet.c | 6 +- > hw/pcnet.h | 6 +- > hw/qdev-properties.c | 54 +++-- > hw/qdev.c | 2 - > hw/qdev.h | 7 +- > hw/rtl8139.c | 10 +- > hw/smc91c111.c | 6 +- > hw/spapr_llan.c | 4 +- > hw/stellaris_enet.c | 6 +- > hw/usb/dev-network.c | 8 +- > hw/vexpress.c | 2 +- > hw/vhost_net.c | 24 +- > hw/vhost_net.h | 2 +- > hw/virtio-net.c | 12 +- > hw/xen_nic.c | 7 +- > hw/xgmac.c | 6 +- > hw/xilinx_axienet.c | 6 +- > hw/xilinx_ethlite.c | 6 +- > hw/xtensa_lx60.c | 2 +- > net.c | 616 > ++++++++++++++--------------------------------- > net.h | 86 +++---- > net/Makefile.objs | 2 +- > net/dump.c | 27 ++- > net/dump.h | 2 +- > net/hub.c | 339 ++++++++++++++++++++++++++ > net/hub.h | 29 +++ > net/queue.c | 38 ++- > net/queue.h | 25 +- > net/slirp.c | 34 ++- > net/slirp.h | 2 +- > net/socket.c | 60 ++--- > net/socket.h | 2 +- > net/tap-win32.c | 26 +- > net/tap.c | 44 ++-- > net/tap.h | 20 +- > net/vde.c | 16 +- > net/vde.h | 2 +- > qapi-schema.json | 30 ++- > qemu-common.h | 3 +- > slirp/if.c | 5 - > slirp/libslirp.h | 1 - > 64 files changed, 905 insertions(+), 796 deletions(-) > create mode 100644 net/hub.c > create mode 100644 net/hub.h > > -- > 1.7.10.4
Merged into the net tree: https://github.com/stefanha/qemu/tree/net Stefan