History | View | Annotate | Download (6.6 kB)
net: purge the monitor object from all init functions
The only backend that really uses it is the socket one, which callsmonitor_get_fd(). But it can use 'cur_mon' instead.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Reviewed-By: Laszlo Ersek <lersek@redhat.com>
net: net_client_init(): use error_set()
Callers are changed to use qerror_report_err() to keep their QErrorsemantics.
qapi: convert netdev_add
This is not a full QAPI conversion, but an intermediate step.
In essence, do_netdev_add() is split into three functions:
1. netdev_add(): performs the actual work. This function is fully converted to Error (thus, it's "qapi-friendly")...
qapi: convert netdev_del
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Reviewed-By: Laszlo Ersek <lersek@redhat.com>
net: move compute_mcast_idx() to net.h
Reduce duplicated codes.
Signed-off-by: Jason Wang <jasowang@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Add support for net bridge
The most common use of -net tap is to connect a tap device to a bridge. Thisrequires the use of a script and running qemu as root in order to allocate atap device to pass to the script.
This model is great for portability and flexibility but it's incredibly...
vmstate: extract declarations out of hw/hw.h
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qapi: Convert set_link
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Allow overriding the location of Samba's smbd.
Pretty much every OS I look at has some means ofchanging this path (patching) so lets just makeit easier for OS developers creating packagesand/or end users to override the location....
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: 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...
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,...
Add bootindex parameter to net/block/fd device
If bootindex is specified on command line a string that describes devicein firmware readable way is added into sorted list. Later this list willbe passed into firmware to control boot order.
Signed-off-by: Gleb Natapov <gleb@redhat.com>...
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,...
Move stdbool.h
Move inclusion of stdbool.h to common header files, instead of includingin an ad-hoc manner.
Signed-off-by: Paul Brook <paul@codesourcery.com>
monitor: Convert do_set_link() to QObject, QError
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
monitor: New commands netdev_add, netdev_del
Monitor commands to go with -netdev.
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>...
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>...
net: Remove unused net_client_uninit()
Unused since commit 9ad4531e.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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...
net: add API to disable/enable polling
When vhost is bound to a backend device, we need to stop polling it whenvhost is started, and restart polling when vhost is stopped.Add an API for that for use by vhost, and implement in tap backend.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>...
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: 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: remove NICInfo::private
Was used by hot-unplug, but not anymore.
net: introduce NetClientInfo
This structure holds data which is common to all instances of a givennet client type/model.
net: introduce qemu_new_net_client()
A replacement for qemu_new_vlan_client(), using NetClientInfo toreplace most arguments.
net: remove NICInfo::vc
Since 1cc33683, this field is not set for most devices, so justremove it and its remaining few uses.
net: move slirp code from net.c to net/slirp.c
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 more stuff into net/tap-win32.c, add net/tap.h
net: split all the tap code out into net/tap.c
net: move net-queue.[ch] under net/
[v2: handle building in a separate dir]
net: move net-checksum.c under net/
Also add a new net/checksum.h header
Fix signature of new_vlan_client
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
really fix net.h
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 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.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>...
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: 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.
zap DeviceState->nd
No users left.Also cleanup obsolete helper functions.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev/net: common nic property bits
Add a new type for properties common to all nics.Add helper functions and macros to deal with it.
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: 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: 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: remove unused qemu_handler_true()
Patchworks-ID: 35504Signed-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>
Port usb net to QemuOpts
We need net_client_init_from_opts() exported for this
Final net cleanup after conversion to QemuOpts
Now that net_client_init() has no users, kill it off and renamenet_client_init_from_opts().
There is no further need for the old code in net_client_parse() either.We use qemu_opts_parse() 'firstname' facitity for that. Instead, move...
Make NICInfo string fields non-const
We now only assign strdup()ed strings to these fields, never staticstrings.
aliguori: fix build for ppc_prep and mips_jazz
Don't exit() in config_error()
Propagating errors up the call chain is tedious. In startup code, wecan take a shortcut: terminate the program. This is wrong elsewhere,the monitor in particular.
config_error() tries to cater for both customers: it terminates the...
Make it obvious that pci_nic_init() can't fail
Before this patch, pci_nic_init() returns NULL when it can't find themodel in pci_nic_models[]. Except this can't happen, becauseqemu_check_nic_model_list() just searched for model inpci_nic_models[], and terminated the program on failure....
Fix pci_add nic not to exit on bad model
Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() tocreate the NIC. When MODEL is unknown or "?", this prints to stderrand terminates the program.
Change pci_nic_init() not to treat "?" specially, and to return NULL...
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there aresome additions and it's not entirely compatible. Because of that, there havebeen conflicts with system headers on BSD systems. Some hacks have beenintroduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...
monitor: Port handler_2 to use QDict
This commit ports command handlers that receive two arguments to usethe new monitor's dictionary.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor: Port handler_3 to use QDict
This commit ports command handlers that receive three arguments to usethe new monitor's dictionary.
net: Fix send queue ordering
Ensure that packets enqueued for delayed delivery are dequeued in FIFOorder. At least one simplistic guest TCP/IP stack became unhappy due tosporadically reordered packet streams.
At this chance, switch the send queue implementation to TAILQ....
net: Fix do_set_link() return type
do_set_link() returns int, but Monitor handler functions shouldalways return void.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Message-Id:
qdev: add id= support for pci nics.
Don't leak VLANClientState on PCI hot remove
destroy_nic() requires that NICInfo::private by a PCIDevice pointer,but then goes on to require that the same pointer matchesVLANClientState::opaque.
That is no longer the case for virtio-net since qdev and wasn't...
net: Provide VLAN client lookup helper
Introduce qemu_find_vlan_client_by_name for VLANClientState lookup basedon VLAN ID and client name. This is useful for monitor commands.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
slirp: Make hostfwd_add/remove multi-instance-aware
Extend the syntax of hostfwd_add/remove to optionally take a tuple ofVLAN ID and slirp stack name. If those are omitted, the commands willcontinue to work on the first registered slirp stack.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
slirp: Kill slirp_is_inited
Avoid the need for slirp_is_inited by refactoring the protectedslirp_select_* functions. This also avoids the clearing of all fd setson select errors.
slirp: Add info usernet for dumping connection states
Break out sockstats from the slirp statistics and present them under thenew info category "usernet". This patch also improves the current output/wrt proper reporting connection source and destination....
slirp: Rework monitor commands for host forwarding
Improve the monitor interface for adding and removing host forwardingrules by splitting it up in two commands and rename them to hostfwd_addand hostfwd_remove. Also split up the paths taken for legacy -redir...
slirp: Bind support for host forwarding rules
Extend the hostfwd rule format so that the user can specify on whichhost interface qemu should listen for incoming connections. If omitted,binding will takes place against all interfaces.
slirp: Move smb, redir, tftp and bootp parameters and -net channel
So far a couple of slirp-related parameters were expressed viastand-alone command line options. This it inconsistent and unintuitive.Moreover, it prevents both dynamically reconfigured (host_net_add/...
qemu/net: flag to control the number of vectors a nic has
Add an option to specify the number of MSI-X vectors for PCI NIC cards. Thiscan also be used to disable MSI-X, for compatibility with old qemu. Thisoption currently only affects virtio cards.
net: add qemu_purge_queued_packets()
If net client sends packets asynchronously, it needs to purge its queuedpackets in cleanup() so as to prevent sent callbacks being invoked witha freed client.
net: add packet length to NetPacketSent callback
virtio-net needs this - for the same purpose that it currently uses thereturn value from qemu_sendv_packet().
Support addr=... in option argument of -net nic
Make net_client_init() accept addr=, put the value into structNICinfo. Use it in pci_nic_init(), and remove arguments bus anddevfn.
Don't support addr= in third argument of monitor command pci_add,because that clashes with its first argument. Admittedly unelegant....
Make nic option rom loading less painful.
The code how it is today, is totally painful to read and keep.To begin with, the code is duplicated with the option rom loadingcode that linux_boot and vga are already using.
This patch introduces a "bootable" state in NICInfo structure,...
net: add qemu_send_packet_async()
Add a qemu_send_packet() variant which will queue up the packetif it cannot be sent when all client queues are full. It laterinvokes the supplied callback when the packet has been sent.
If qemu_send_packet_async() returns zero, the caller is expected...
net: Improve parameter error reporting
As host network devices can also be instantiated via the monitor, errorsshould then be reported to the related monitor instead of stderr. Thisrequires larger refactoring, so this patch starts small with introducing...
net: add fd_readv() handler to qemu_new_vlan_client() args
This, apparently, is the style we prefer - all VLANClientStateshould be an argument to qemu_new_vlan_client().
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
net: re-name vc->fd_read() to vc->receive()
VLANClientState's fd_read() handler doesn't read from filedescriptors, it adds a buffer to the client's receive queue.
Re-name the handlers to make things a little less confusing.
net: pass VLANClientState* as first arg to receive handlers
Give static type checking a chance to catch errors.
net: add return value to packet receive handler
This allows us to handle queue full conditions rather than droppingthe packet on the floor.
User Networking: Enable removal of redirections
Using the new host_net_redir command you can easily create redirectionson the fly while your VM is running.
While that's great, it's missing the removal of redirections, in case youwant to have a port closed again at a later point in time....
PCI network qdev conversion
slirp: Enhance host-guest redirection setup (Jan Kiszka)
Allow to establish a TCP/UDP connection redirection also via a monitorcommand 'host_net_redir'. Moreover, assume TCP as connection type ifthat parameter is omitted.
net: Untangle nested qemu_send_packet (Jan Kiszka)
Queue packets that are send during an ongoing packet delivery. Thisensures that packets will always arrive in their logical order at eachclient of a VLAN. Currently, slirp generates such immediate relies, and...
Introduce VLANClientState::cleanup() (Mark McLoughlin)
We're currently leaking memory and file descriptors on devicehot-unplug.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7150 c046a42c-6fe2-441c-8c8c-71466251a162
monitor: Rework API (Jan Kiszka)
Refactor the monitor API and prepare it for decoupled terminals:term_print functions are renamed to monitor_* and all monitor servicesgain a new parameter (mon) that will once refer to the monitor instancethe output is supposed to appear on. However, the argument remains...
qemu: PCI device, disk and host network hot-add / hot-remove (Marcelo Tosatti)
Add monitor command to hot-add PCI devices (nic and storage).
Syntax is:
pci_add pci_addr=[[<domain>:]<bus>:]<slot> nic|storage params
It returns the domain, bus and slot for the newly added device on success....
qemu: add net_client_uninit / qemu_find_vlan_client (Marcelo Tosatti)
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6600 c046a42c-6fe2-441c-8c8c-71466251a162
qemu: dynamic nic info index allocation (Marcelo Tosatti)
Dynamically allocate nic info index, so to reuse indexes when devices areremoved.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6595 c046a42c-6fe2-441c-8c8c-71466251a162