summaryrefslogtreecommitdiffstats
path: root/net.h
Commit message (Collapse)AuthorAgeFilesLines
* net: add API to disable/enable pollingMichael S. Tsirkin2010-01-081-0/+3
| | | | | | | | | When vhost is bound to a backend device, we need to stop polling it when vhost 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* default devices: networkGerd Hoffmann2009-12-121-0/+1
| | | | | | | | | Add a default_net variable which specified whenever a default network should be created. It is cleared in case any -net option is specified and it is also added to the new -nodefaults switch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add qemu_foreach_nic()Mark McLoughlin2009-12-031-0/+2
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: remove VLANClientState members now in NetClientInfoMark McLoughlin2009-12-031-9/+1
| | | | | | | | Add a NetClientInfo pointer to VLANClientState and use that for the typecode and function pointers. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: remove qemu_new_vlan_client()Mark McLoughlin2009-12-031-13/+0
| | | | | | | | | ... and VLANClientState::opaque and qemu_find_vlan_client(). All of these are now unused Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: introduce NICState and qemu_new_nic()Mark McLoughlin2009-12-031-0/+11
| | | | | | | | | | | | | Common state for all NICs. The opaque member will replace the opaque member in VLANClientState since only NICs need it. The conf member will allow us to iterate over NICs, access the MAC addr for the NIC and send a packet from each NIC in qemu_announce_self(). Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: introduce qemu_new_net_client()Mark McLoughlin2009-12-031-0/+5
| | | | | | | | A replacement for qemu_new_vlan_client(), using NetClientInfo to replace most arguments. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: introduce NetClientInfoMark McLoughlin2009-12-031-0/+11
| | | | | | | | This structure holds data which is common to all instances of a given net client type/model. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: remove NICInfo::privateMark McLoughlin2009-12-031-1/+0
| | | | | | | Was used by hot-unplug, but not anymore. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: remove NICInfo::vcMark McLoughlin2009-12-031-1/+0
| | | | | | | | Since 1cc33683, this field is not set for most devices, so just remove it and its remaining few uses. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move slirp code from net.c to net/slirp.cMark McLoughlin2009-12-031-6/+2
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: disable receiving if client returns zeroMark McLoughlin2009-11-091-0/+1
| | | | | | | | | | | | | If a receiver returns zero, that means its queue is full and it will notify us when room is available using qemu_flush_queued_packets(). Take note of that and disable that receiver until it flushes its queue. This is a first step towards allowing can_receive() handlers to return true even if no buffer space is available. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: split all the tap code out into net/tap.cMark McLoughlin2009-10-301-0/+2
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move more stuff into net/tap-win32.c, add net/tap.hMark McLoughlin2009-10-301-5/+0
| | | | | Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move net-checksum.c under net/Mark McLoughlin2009-10-301-7/+0
| | | | | | | Also add a new net/checksum.h header Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: move net-queue.[ch] under net/Mark McLoughlin2009-10-301-1/+1
| | | | | | | [v2: handle building in a separate dir] Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* really fix net.hAnthony Liguori2009-10-271-1/+1
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix signature of new_vlan_clientAnthony Liguori2009-10-271-1/+2
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Enable UFO on virtio-net and tap devicesSridhar Samudrala2009-10-271-1/+2
| | | | | | | | | Enable UFO on the host tap device if supported and allow setting UFO on 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()Mark McLoughlin2009-10-271-0/+1
| | | | | | | | | This API allows virtio-net to enable various offload features on a tap interface - e.g. to tell the host kernel it can pass up partial checksums to userspace. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add receive_raw parameter to qemu_new_vlan_client()Mark McLoughlin2009-10-271-0/+1
| | | | | | | | | | Trivial patch to allow supplying a receive_raw function. A future cleanup should combine this function pointer parameters into a table. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add an API for 'raw' packetsMark McLoughlin2009-10-271-0/+2
| | | | | | | | | | 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> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add tap_has_vnet_hdr() and tap_using_vnet_hdr() APIsMark McLoughlin2009-10-271-0/+3
| | | | | | | | | These lamely named functions allow virtio-net to query whether IFF_VNET_HDR is enabled on a tap interface and inform the tap code that virtio-net will supply packets with a vnet header. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add a client type codeMark McLoughlin2009-10-271-0/+11
| | | | | | | | | This is so as to allow APIs which operate on specific client types without having to add a function table entry which is only implemented by a single client type. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* zap DeviceState->ndGerd Hoffmann2009-10-271-7/+0
| | | | | | | | 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 bitsGerd Hoffmann2009-10-271-0/+14
| | | | | | | | Add a new type for properties common to all nics. Add helper functions and macros to deal with it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qdev: add netdev propertyGerd Hoffmann2009-10-271-0/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add macaddr type.Gerd Hoffmann2009-10-271-0/+5
| | | | | | | | | | Add new type for mac addresses. Add function which sets the qemu default mac address if it finds the mac address uninitialized (i.e. all zeros). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add queue for peer-to-peer packet forwardingMark McLoughlin2009-10-151-0/+1
| | | | | | | | | Now that we have re-factored the packet queue code, we can re-use it for peer-to-peer also. Patchworks-ID: 35520 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: refactor packet queueing codeMark McLoughlin2009-10-151-16/+2
| | | | | | | | | | The packet queue code is fairly standalone, has some complex details and easily reusable. It makes sense to split it out on its own. This patch doesn't contain any functional changes. Patchworks-ID: 35511 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: allow NICs to be connected to netdevsMark McLoughlin2009-10-151-0/+2
| | | | | | | | | | Introduce a 'peer' member to VLANClientState as an alternative to a vlan. The idea being that packets are transfered directly from peer clients rather than going through a vlan. Patchworks-ID: 35516 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add -net nic,netdev= optionMark McLoughlin2009-10-151-0/+1
| | | | | | Patchworks-ID: 35515 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: handle -netdevice optionsMark McLoughlin2009-10-151-1/+1
| | | | | | | | | | | | | 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 is required Patchworks-ID: 35517 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add QemuOptsList arg to net_client_parse()Mark McLoughlin2009-10-151-1/+1
| | | | | | Patchworks-ID: 35505 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: use qtailq for vlan and client listsMark McLoughlin2009-10-151-3/+3
| | | | | | Patchworks-ID: 35507 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: remove id field from NICInfoMark McLoughlin2009-10-151-1/+0
| | | | | | | | | | | Just use the name field instead since we now use the id paramater as the name, if supplied. Only implication with this change is that if id is not supplied, the value of the name paramater is used as an id. Patchworks-ID: 35512 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: remove unused qemu_handler_true()Mark McLoughlin2009-10-151-1/+0
| | | | | | Patchworks-ID: 35504 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Final net cleanup after conversion to QemuOptsMark McLoughlin2009-10-061-3/+2
| | | | | | | | | | | | | | | | Now that net_client_init() has no users, kill it off and rename net_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 the special handling of the 'vmchannel' type there. Simplify the vl.c code into merely call net_client_parse() for each -net command line option and then calling net_init_clients() later to iterate over the options and create the clients. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Port usb net to QemuOptsMark McLoughlin2009-10-061-0/+2
| | | | | | | We need net_client_init_from_opts() exported for this Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Don't exit() in config_error()Markus Armbruster2009-10-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Propagating errors up the call chain is tedious. In startup code, we can 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 program unless its mon parameter tells it it's working for the monitor. Its users need to return status anyway (unless passing a null mon argument, which none do), which their users need to check. So this automatic exit buys us exactly nothing useful. Only the dangerous delusion that we can get away without returning status. Some of its users fell for that. Their callers continue executing after failure when working for the monitor. This bites monitor command host_net_add in two places: * net_slirp_init() continues after slirp_hostfwd(), slirp_guestfwd(), or slirp_smb() failed, and may end up reporting success. This happens for "host_net_add user guestfwd=foo": it complains about the invalid guest forwarding rule, then happily creates the user network without guest forwarding. * net_client_init() can't detect slirp_guestfwd() failure, and gets fooled by net_slirp_init() lying about success. Suppresses its "Could not initialize device" message. Add the missing error reporting, make sure errors are checked, and drop the exit() from config_error(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make NICInfo string fields non-constMark McLoughlin2009-10-061-4/+4
| | | | | | | | | | We now only assign strdup()ed strings to these fields, never static strings. aliguori: fix build for ppc_prep and mips_jazz Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix pci_add nic not to exit on bad modelMarkus Armbruster2009-10-051-2/+3
| | | | | | | | | | | | | | | | Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() to create the NIC. When MODEL is unknown or "?", this prints to stderr and terminates the program. Change pci_nic_init() not to treat "?" specially, and to return NULL on failure. Switch uses during startup to new convenience wrapper pci_nic_init_nofail(), which behaves just like pci_nic_init() used to do. Bonus bug fix: we now check for qdev_init() failing there. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make it obvious that pci_nic_init() can't failMarkus Armbruster2009-10-051-2/+2
| | | | | | | | | | | | | Before this patch, pci_nic_init() returns NULL when it can't find the model in pci_nic_models[]. Except this can't happen, because qemu_check_nic_model_list() just searched for model in pci_nic_models[], and terminated the program on failure. Repeating the search here is pointless. Instead, change qemu_check_nic_model_list() to return the model's array index. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix sys-queue.h conflict for goodBlue Swirl2009-09-121-3/+3
| | | | | | | | | | | | | | | Problem: Our file sys-queue.h is a copy of the BSD file, but there are some additions and it's not entirely compatible. Because of that, there have been conflicts with system headers on BSD systems. Some hacks have been introduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896, f40d753718c72693c5f520f0d9899f6e50395e94, 96555a96d724016e13190b28cffa3bc929ac60dc and 3990d09adf4463eca200ad964cc55643c33feb50 but the fixes were fragile. Solution: Avoid the conflict entirely by renaming the functions and the file. Revert the previous hacks. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* monitor: Port handler_3 to use QDictLuiz Capitulino2009-09-041-4/+2
| | | | | | | | This commit ports command handlers that receive three arguments to use the new monitor's dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* monitor: Port handler_2 to use QDictLuiz Capitulino2009-09-041-3/+4
| | | | | | | | This commit ports command handlers that receive two arguments to use the new monitor's dictionary. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: Fix send queue orderingJan Kiszka2009-09-041-2/+3
| | | | | | | | | | | Ensure that packets enqueued for delayed delivery are dequeued in FIFO order. At least one simplistic guest TCP/IP stack became unhappy due to sporadically reordered packet streams. At this chance, switch the send queue implementation to TAILQ. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: Fix do_set_link() return typeLuiz Capitulino2009-08-101-1/+1
| | | | | | | | | do_set_link() returns int, but Monitor handler functions should always 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.Gerd Hoffmann2009-07-161-0/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Don't leak VLANClientState on PCI hot removeMark McLoughlin2009-07-091-0/+1
| | | | | | | | | | | | | | | destroy_nic() requires that NICInfo::private by a PCIDevice pointer, but then goes on to require that the same pointer matches VLANClientState::opaque. That is no longer the case for virtio-net since qdev and wasn't previously the case for rtl8139, ne2k_pci or eepro100. Make the situation a lot more clear by maintaining a VLANClientState pointer in NICInfo. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud