History | View | Annotate | Download (38.7 kB)
qapi: Convert set_link
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Move filedescriptor parsing code from net.c into qemu_parse_fd()
Move the parsing of a filedescriptor into a common functionqemu_parse_fd() so others can use it as well. Have net.c call thisfunction.
v2: - moving qemu_parse_fd into cutils.c
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>...
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Merge remote-tracking branch 'mst/for_anthony' into staging
net: Improve layout of 'info network'
Improve the layout when listing non-vlan clients via 'info network'. Theresult looks like this:
(qemu) info networkDevices not on any VLAN: orphan: net=10.0.2.0, restricted=n virtio-net-pci.0: model=virtio-net-pci,macaddr=52:54:00:12:34:56...
net: Refactor net_client_types
Position entries of net_client_types according to the correspondingvalues of NET_CLIENT_TYPE_*. The array size is now defined byNET_CLIENT_TYPE_MAX. This will allow to obtain entries based on typevalue in later patches....
net: Dump client type 'info network'
Include the client type name into the output of 'info network'. Theresult looks like this:
(qemu) info networkVLAN 0 devices: rtl8139.0: type=nic,model=rtl8139,macaddr=52:54:00:12:34:57Devices not on any VLAN: virtio-net-pci.0: type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56...
net: Consistently use qemu_macaddr_default_if_unset
Drop the open-coded MAC assignment from net_init_nic and replace it withstandard qemu_macaddr_default_if_unset which is also used by qdev. Thatavoid creating colliding MACs when instantiating NICs via different...
Fix automatically assigned network names for netdev
If a network client doesn't have a name, we make one up, withassign_name(). assign_name() creates a name MODEL.NUM, where MODEL isthe client's model, and NUM is the number of MODELs that alreadyexist....
Fix netdev name lookup in -device, device_add, netdev_del
qemu_find_netdev() looks up members of non_vlan_clients by name. Ithappily returns the first match. Trouble is the names need not beunique.
non_vlan_clients contains host parts (netdevs) and guest parts (NICs)....
Strip trailing '\n' from error_report()'s first argument
error_report() prepends location, and appends a newline. The messageconstructed from the arguments should not contain a newline. Fix theobvious offenders.
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
net: Warn about "-net nic" options which were ignored
Diagnose the case where the user asked for a NIC via "-net nic" but the board didn't instantiate that NIC (for example where theuser asked for two NICs but the board only supports one). Notethat this diagnostic doesn't apply to NICs created through -device,...
Revert "net: Improve the warnings for dubious command line option combinations"
This reverts commit f68b9d672b90dedc79aeb9b44607f484dbe46a6b.That attempt at diagnosing unused -net nic options failed to accountfor NICs created via -device; back it out cleanly in preparation...
net: Don't warn about the default network setup
Don't warn about the default network setup that you get if no command line-net options are specified. There are two cases that we would otherwisecomplain about:
(1) board doesn't support a NIC but the implicit "-net nic" requested one...
Remove unused sysemu.h include directives
Remove unused sysemu.h include directives to speed up buildwith the following patches.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
net: Improve the warnings for dubious command line option combinations
Improve the warnings we give if the user specified a combination of -netoptions which don't make much sense: * Don't warn about anything if the config is the implicit default "-net user -net nic" rather than one specified by the user (this will...
Fix net_check_clients warnings: make it per vlan.
Signed-off-by: Tristan Gingold <gingold@adacore.com>Reviewed-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
net: Add the missing option declaration of "vhostforce"
Signed-off-by: Jason Wang <jasowang@redhat.com>Acked-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
net: remove parse_host_src_port() function
It was deprecated, and it has no users.
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
net: Use iov helper functions
Signed-off-by: Benjamin Poirier <benjamin.poirier@gmail.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Acked-by: Jason Wang <jasowang@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
net: fix qemu_can_send_packet logic
If any of the clients is not ready to receive (ie it has a can_receivecallback and can_receive() returns false), we don't want to startsending, else this client may miss/discard the packet.
I got this behaviour with the following setup :...
net: notify peer about link status change
qemu makes it possible to disable link at tap which is not communicatedto the guest but causes all packets to be dropped.
This works for virtio userspace, as qemu stops giving it packets, butnot for virtio-net connected to vhost-net as that does not get notified...
net/sock: option to specify local address
Add an option to specify the host IP to send multicast packets from,when using a multicast socket for networking. The option takes an IPaddress and sets the IP_MULTICAST_IF socket option, which causes thepackets to use that IP's interface as an egress....
net: properly handle illegal fd/vhostfd from command line
When hanlding fd/vhostfd form command line through net_handle_fd_param(),we need to check mon and return value of strtol() otherwise we couldget segmentation fault or invalid fd when user type an illegal fd/vhostfd....
net: delay freeing peer host device
With -netdev, virtio devices present offloadfeatures to guest, depending on the backend used.Thus, removing host netdev peer while guest isactive leads to guest-visible inconsistency and/or crashes.
As a solution, while guest (NIC) peer device exists,...
QemuOpts: make most qemu_*_opts static
Switch tree to lookup-by-name using qemu_find_opts().Also hook up virtfs options so qemu_find_opts works for them too.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: delete QemuOpts when net_client_init() fails.
This fixes the following scenario using QMP.
First, put a bogus argument "foo" to "type", which results in an error. {"execute": "netdev_add", "arguments": { "type": "foo", "id": "netdev1" } }Then, call it again with correct argument "user"....
net: Fix VM start with '-net none'
Commit 50e32ea8f31035877decc10f1075aa0e619e09cb changed the behaviourfor the return type of net_client_init() when a nic type with no initmethod was specified. 'none' is one such nic type. Instead of returning0, which gets interpreted as an index into the nd_table[] array, we...
Make netdev_del delete the netdev even when it's in use
To hot-unplug guest and host part of a network device, you do:
device_del NIC-ID netdev_del NETDEV-ID
For PCI devices, device_del merely tells ACPI to unplug the device.The device goes away for real only after the guest processed the ACPI...
Merge remote branch 'mst/for_anthony' into staging
net: Fix hotplug with pci_add
The correct model type wasn't getting added when hotplugging nics withpci_add.
Testcase: start VM with default nic type. In the qemu_monitor:
(qemu) pci_add auto nic model=virtio
This results in a nic hot-plug of the same nic type as the default....
Monitor: Drop QMP documentation from code
Previous commit added QMP documentation to the qemu-monitor.hxfile, it's is a copy of this information.
While it's good to keep it near code, maintaining two copies ofthe same information is too hard and has little benefit as we...
monitor: Use argument type 'b' for set_link
Second argument is now "on" or "off" instead of "up" or "down".
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
monitor: Convert do_set_link() to QObject, QError
monitor: New commands netdev_add, netdev_del
Monitor commands to go with -netdev.
error: Drop extra messages after qemu_opts_set() and qemu_opts_parse()
Both functions report errors nicely enough now, no need for additionalmessages.
error: Convert net_client_init() to QError
The conversion is shallow: client type init() methods aren'tconverted. Converting them is a big job for relatively littlepractical benefit, so leave it for later.
net: remove broken net_set_boot_mask() boot device validation
There are many problems with net_set_boot_mask():
1) It is broken when using the device model instead of "-net nic". Example: $ qemu-system-x86_64 -device rtl8139,vlan=0,id=net0,mac=52:54:00:82:41:fd,bus=pci.0,addr=0x4 -net user,vlan=0,name=hostnet0 -vnc 0.0.0.0:0 -boot n...
net: remove NICInfo.bootable field
It is just set by net_set_boot_mask() and never used. The logic for rom loadingchanged a lot since this field was introduced. It is not needed anymore.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>Acked-by: Juan Quintela <quintela@redhat.com>...
tap: add vhost/vhostfd options
This adds vhost binary option to tap, to enable vhost net accelerator.Default is off for now, we'll be able to make default on long termwhen we know it's stable.
vhostfd option can be used by management, to pass in the fd. Assigning...
qemu-option: Move the implied first name into QemuOptsList
We sometimes permit omitting the first option name, for example-device foo is short for -device driver=foo. The name to use("driver" in the example) is passed as argument to qemu_opts_parse()....
error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline. Strip it itfrom its arguments.
This fixes a few error messages lacking a newline:net_handle_fd_param()'s "No file descriptor named %s found", andtap_open()'s "vnet_hdr=1 requested, but no kernel support for...
qdev: Catch attempt to attach more than one device to a netdev
Guest device and host netdev are peers, i.e. it's a 1:1 relation.However, we fail to enforce that:
$ qemu -nodefaults --nographic -netdev user,id=net0 -device e1000,netdev=net0 -device virtio-net-pci,netdev=net0 -monitor stdio...
qdev: Add a DEV_NVECTORS_UNSPECIFIED enum for unspecified nr of MSI vectors
net.c used a constant to signify no MSI vectors were specified. Extendthat to all qdev devices.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Reported-by: "Michael S. Tsirkin" <mst@redhat.com>...
Allow const QemuOptDesc
Fix warning on OpenBSD
/src/qemu/net.c: In function `net_check_clients':/src/qemu/net.c:1287: warning: `has_nic' might be used uninitialized in this function/src/qemu/net.c:1287: warning: `has_host_dev' might be used uninitialized in this function
net: net_check_clients() checks only VLAN clients, fix
Clients not associated with a VLAN exist since commit d80b9fc6.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: info network shows only VLAN clients, fix
net: Monitor command set_link finds only VLAN clients, fix
net: Remove unused net_client_uninit()
Unused since commit 9ad4531e.
net: net_check_clients() runs too early to see -device, fix
Call it right after -device devices get created.
net: Fix bogus "Warning: vlan 0 with no nics" with -device
net_check_clients() prints this when an VLAN has host devices, but noguest devices. It uses VLANState members nb_guest_devs andnb_host_devs to keep track of these devices. However, -device does...
don't dereference NULL after failed strdup
Most of these are obvious NULL-deref bug fixes, for example,the ones in these files:
block/curl.c net.c slirp/misc.c
and the first one in block/vvfat.c.The others in block/vvfat.c may not lead to an immediate segfault, but I...
default devices: network
Add a default_net variable which specified whenever a default networkshould be created. It is cleared in case any -net option is specifiedand it is also added to the new -nodefaults switch.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>...
net: add qemu_foreach_nic()
Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: print correct error for '-netdev ""'
Reported-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: move parse_macaddr() to net/util.[ch]
net: remove qemu_new_vlan_client()
... and VLANClientState::opaque and qemu_find_vlan_client().
All of these are now unused
net: remove VLANClientState members now in NetClientInfo
Add a NetClientInfo pointer to VLANClientState and use thatfor the typecode and function pointers.
net: introduce NICState and qemu_new_nic()
Common state for all NICs.
The opaque member will replace the opaque member in VLANClientStatesince only NICs need it.
The conf member will allow us to iterate over NICs, access the MACaddr for the NIC and send a packet from each NIC in qemu_announce_self()....
net: introduce qemu_new_net_client()
A replacement for qemu_new_vlan_client(), using NetClientInfo toreplace most arguments.
net: move vde code from net.c to net/vde.c
net: move socket backend code from net.c to net/socket.c
net: move dump backend code from net.c to net/dump.c
net: clean up includes in net.c
This is probably a little drastic, but the includes in this file arenow totally out of control when compared with what includes areactually needed.
This may break the build on e.g. *BSD, but it will be easily fixed byre-instating an include....
net: move slirp code from net.c to net/slirp.c
Add support for GNU/kFreeBSD
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
net: disable receiving if client returns zero
If a receiver returns zero, that means its queue is full and it willnotify us when room is available using qemu_flush_queued_packets().
Take note of that and disable that receiver until it flushes its queue....
net: move AIX code into net/tap-aix.c
Okay, this makes the tap options available on AIX even though there'sno support, but if we want to do it right we should have not compilethe tap code at all on AIX using e.g. CONFIG_TAP.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
net: move more stuff into net/tap-win32.c, add net/tap.h
net: move tap-linux.h under net/
net: split all the tap code out into net/tap.c
Enable UFO on virtio-net and tap devices
Enable UFO on the host tap device if supported and allow setting UFOon virtio-net in the guest.
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: add tap_set_offload()
This API allows virtio-net to enable various offload features on atap interface - e.g. to tell the host kernel it can pass up partialchecksums to userspace.
net: add flags parameter to packet queue interface
This allows for the addition of a raw flag, and leaves the way openfor other flags too.
net: add an API for 'raw' packets
In the case where a NIC and backend agree on a packet header format,this API allows injecting packets which lack the agreed upon header.
We need this for sending our gratuitous ARP.
net: add receive_raw parameter to qemu_new_vlan_client()
Trivial patch to allow supplying a receive_raw function.
A future cleanup should combine this function pointer parameters into atable.
net: implement tap support for receive_raw()
tap_receive_raw() always prepends a vnet header if IFF_VNET_HDR isenabled.
tap_receive() only prepends when the a header is required but the NICdoesn't supply one.
net: import linux tap ioctl definitions
Making features dependent on the availability of newer versions if_tun.his going to get seriously clumsy, so let's just import the definitionswe need. It's only a small handful.
If and when we're comfortable depending on 2.6.30 headers, we can remove...
net: make tap_receive() re-use tap_receive_iov() code
In future we will want to prepend a virtio_net header if the NIC didn'tsupply one but IFF_VNET_HDR is enabled on the interface. This is mosteasily achived by using writev() in all cases.
net: enable IFF_VNET_HDR on tap fds if available
For now, we just add an empty header before writing and strip the headerafter reading.
We really only want IFF_VNET_HDR when virtio_net is using it, but itwould significantly complicate matters to try and do that. There should...
net: refactor tap initialization
Re-factor things so that there is only one call site fornet_tap_fd_init().
Two concerns about the QemuOpts usage here - firstly, we set the scriptarguments to their default value and, secondly, we set the ifname valueto the name allocated by the kernel if none is supplied. Are we okay...
net: add a vnet_hdr=on|off parameter
This allows people to disable the IFF_VNET_HDR flag, e.g. for debuggingpurposes or if they know they may migrate the guest to a machine withoutIFF_VNET_HDR support.
It also allows making the lack of IFF_VNET_HDR support an error...
net: add a client type code
This is so as to allow APIs which operate on specific client typeswithout having to add a function table entry which is only implementedby a single client type.
net: add tap_has_vnet_hdr() and tap_using_vnet_hdr() APIs
These lamely named functions allow virtio-net to query whetherIFF_VNET_HDR is enabled on a tap interface and inform the tap codethat virtio-net will supply packets with a vnet header.
qdev: add netdev property
net: add macaddr type.
Add new type for mac addresses.
Add function which sets the qemu default mac address if it finds the macaddress uninitialized (i.e. all zeros).
net: refactor packet queueing code
The packet queue code is fairly standalone, has some complex details andeasily reusable. It makes sense to split it out on its own. This patchdoesn't contain any functional changes.
Patchworks-ID: 35511Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
net: add queue for peer-to-peer packet forwarding
Now that we have re-factored the packet queue code, we can re-useit for peer-to-peer also.
Patchworks-ID: 35520Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: fix multiple NICs causing net opts process to stop
For NICs, net_init_client() returns the index into the NICInfo table.
qemu_opts_foreach() interprets non-zero as an error return an stopsiterating over the options.
So, if you have more than one '-net nic' on the command line, subsequent...
net: maintain a list of vlan-less clients
Allows them to be cleaned up at shutdown.
This is pretty lame, but will eventually go away as we make vlansthe special case.
Patchworks-ID: 35518Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: add -net nic,netdev= option
Patchworks-ID: 35515Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: allow NICs to be connected to netdevs
Introduce a 'peer' member to VLANClientState as an alternativeto a vlan. The idea being that packets are transfered directlyfrom peer clients rather than going through a vlan.
Patchworks-ID: 35516Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
net: allow clients not associated with a vlan
Allow net clients to be created which are not connected to any vlan.
This is needed by Gerd in order to allow adding -device nic, wherethe absence of a vlan parameter will not imply vlan=0. Also neededto allow adding a -netdevice option which doesn't connect the backend...
net: add QemuOptsList arg to net_client_parse()
Patchworks-ID: 35505Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: handle -netdevice options
Same as for -net except for:
- only tap, user, vde and socket types are supported- the vlan parameter is not allowed- the name parameter is not allowed but the id parameter isrequired
Patchworks-ID: 35517Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
net: pass monitor handle to client init functions
Needed for e.g. looking up a file descriptor name usingmonitor_get_fd() in net_init_tap()
Patchworks-ID: 35509Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: handle id= parameter for -net
Use id= in the same was as the current name= parameter; if both arespecified, id= is used.
Patchworks-ID: 35514Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net: remove id field from NICInfo
Just use the name field instead since we now use the id paramater asthe name, if supplied. Only implication with this change is that ifid is not supplied, the value of the name paramater is used as anid.
Patchworks-ID: 35512...
net: use qtailq for vlan and client lists
Patchworks-ID: 35507Signed-off-by: Mark McLoughlin <markmc@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>