aboutsummaryrefslogtreecommitdiffstats
path: root/net
AgeCommit message (Collapse)AuthorFilesLines
2010-04-25Remove dead assignments in various common files, spotted by clang analyzerBlue Swirl1-1/+1
Value stored is never read. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-02Fix build on mingw32Anthony Liguori1-0/+5
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-01tap: add API to retrieve vhost net headerMichael S. Tsirkin2-0/+10
will be used by virtio-net for vhost net support Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-01tap: add vhost/vhostfd optionsMichael S. Tsirkin1-0/+29
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 term when we know it's stable. vhostfd option can be used by management, to pass in the fd. Assigning vhostfd implies vhost=on. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-01tap: add interface to get device fdMichael S. Tsirkin2-0/+9
Will be used by vhost to attach/detach to backend. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-27Fix BSD and win32 buildsBlue Swirl2-0/+2
CC net/tap-bsd.o /src/qemu/net/tap-bsd.c: In function `tap_open': /src/qemu/net/tap-bsd.c:93: warning: implicit declaration of function `error_report' CC sparc-softmmu/../net/tap-win32.o cc1: warnings being treated as errors /src/qemu/target-sparc/../net/tap-win32.c: In function 'net_init_tap': /src/qemu/target-sparc/../net/tap-win32.c:709: warning: implicit declaration of function 'error_report' Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-21Revert "tap: invoke downscript when we exit abnormally"Anthony Liguori1-16/+0
This reverts commit 8af8ce4d6116e3d46ad298ca8fe50d3b515b1aac.
2010-03-19tap: invoke downscript when we exit abnormallyAnthony Liguori1-0/+16
Right now, downscript is not invoked reliably. If you execute 'quit' from the monitor, it won't be invoked. This fixes that by converting tap to use an exit_notifier to execute the downscript. In this case, allowing an exit notifier to include state is critically important for the conversion. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-16error: Replace qemu_error() by error_report()Markus Armbruster8-32/+33
error_report() terminates the message with a newline. Strip it it from its arguments. This fixes a few error messages lacking a newline: net_handle_fd_param()'s "No file descriptor named %s found", and tap_open()'s "vnet_hdr=1 requested, but no kernel support for IFF_VNET_HDR available" (all three versions). There's one place that passes arguments without newlines intentionally: load_vmstate(). Fix it up.
2010-03-16error: Move qemu_error & friends into their own headerMarkus Armbruster4-1/+4
2010-03-09slirp: check system() successJuan Quintela1-1/+1
we shouldn't call W*() macros until we check that fork worked. Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-19net: Fix bogus "Warning: vlan 0 with no nics" with -deviceMarkus Armbruster5-20/+0
net_check_clients() prints this when an VLAN has host devices, but no guest devices. It uses VLANState members nb_guest_devs and nb_host_devs to keep track of these devices. However, -device does not update nb_guest_devs, only net_init_nic() does that, for -net nic. Check the VLAN clients directly, and remove the counters. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-27Fix BSD buildBlue Swirl1-0/+3
<sys/wait.h> must be included in order to use WIF* macros. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-01-26net/slirp.c: fix warning with _FORTIFY_SOURCEKirill A. Shutemov1-1/+8
CC net/slirp.o cc1: warnings being treated as errors net/slirp.c: In function 'slirp_smb_cleanup': net/slirp.c:470: error: ignoring return value of 'system', declared with attribute warn_unused_result make: *** [net/slirp.o] Error 1 Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-01-08net: add API to disable/enable pollingMichael S. Tsirkin1-0/+8
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>
2009-12-13tap: Compilation fix for SolarisAndreas Färber1-0/+1
Avoid an unresolved symbol error for TFR, which is defined in sysemu.h. Based on patch by Palle Lyckegaard. Signed-off-by: Andreas Färber <afaerber@opensolaris.org> Cc: Palle Lyckegaard <palle@lyckegaard.dk> Cc: Ben Taylor <bentaylor.solx86@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-12-04win32: fix variable use before initializationBlue Swirl1-2/+2
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-12-03Don't leak file descriptorsKevin Wolf1-4/+4
We're leaking file descriptors to child processes. Set FD_CLOEXEC on file descriptors that don't need to be passed to children to stop this misbehaviour. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: fix vnet_hdr handling in solaris tap codeMark McLoughlin1-0/+11
Print an error if the user specifies vnet_hdr=1 on the cmdline. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: initialize vnet_hdr in net_init_tap()Mark McLoughlin1-1/+1
net_tap_init() always sets vnet_hdr using qemu_opt_get_bool(), but initialize it in net_init_tap() just to reduce confusion. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: check for TUNSETOFFLOAD support before trying to enable offload featuresPierre Riteau1-0/+5
This avoids the "TUNSETOFFLOAD ioctl() failed: Invalid argument" message on kernels without TUNSETOFFLOAD support. Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: fix TAP networking on host kernels without IFF_VNET_HDR supportPierre Riteau1-0/+2
vnet_hdr is initialized at 1 by default. We need to reset it to 0 if the kernel doesn't support IFF_VNET_HDR. Signed-off-by: Pierre Riteau <Pierre.Riteau@irisa.fr> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: remove VLANClientState members now in NetClientInfoMark McLoughlin1-3/+3
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>
2009-12-03net: move parse_macaddr() to net/util.[ch]Mark McLoughlin2-0/+92
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: convert dump to NetClientInfoMark McLoughlin1-21/+28
aliguori: fix uninitialized use of pcap_len Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: convert socket to NetClientInfoMark McLoughlin1-29/+45
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: convert vde to NetClientInfoMark McLoughlin1-17/+28
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: convert slirp to NetClientInfoMark McLoughlin1-24/+37
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: convert tap-win32 to NetClientInfoMark McLoughlin1-16/+23
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: convert tap to NetClientInfoMark McLoughlin1-37/+45
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: move dump backend code from net.c to net/dump.cMark McLoughlin2-0/+184
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: move socket backend code from net.c to net/socket.cMark McLoughlin2-0/+594
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: move vde code from net.c to net/vde.cMark McLoughlin2-0/+160
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-03net: move slirp code from net.c to net/slirp.cMark McLoughlin2-0/+803
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-29Add support for GNU/kFreeBSDAurelien Jarno1-5/+2
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-11-21Avoid segfault on net_tap_init() failureJuergen Lock1-0/+3
Check for fd == -1 there. Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-21tap-bsd: handle ifname on FreeBSD hostsJuergen Lock1-0/+28
Handle ifname on FreeBSD hosts; if no ifname is given, always start the search from tap0. (Simplified/cleaned up version of what has been in the FreeBSD ports for a long time.) Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-21Fix tap breakage on BSD hosts (no IFF_VNET_HDR)Juergen Lock1-0/+11
net/tap-bsd.c was assuming IFF_VNET_HDR was always available, which I think isn't true on any BSD. Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-09tap: drain queue in tap_send()Mark McLoughlin1-13/+16
Okay, let's try re-enabling the drain-entire-queue behaviour, with a difference - before each subsequent packet, use qemu_can_send_packet() to check that we can send it. This is similar to how we check before polling the tap fd and avoids having to drop a packet if the receiver cannot handle it. This patch should be a performance improvement since we no longer have to go through the mainloop for each packet. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09net/queue: queue packets even if sender doesn't supply a callbackMark McLoughlin1-3/+3
Now that we disable any receiver whose queue is full, we do not require senders to handle a zero return by supplying a sent callback. This is a second 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>
2009-11-09tap: disable draining queue in one goMark McLoughlin1-16/+13
If qemu_send_packet_async() returns zero, it means the packet has been queued and the sent callback will be invoked once it has been flushed. This is only possible where the NIC's receive() handler returns zero and promises to notify the networking core that room is available in its queue again. In the case where the receive handler does not have this capability (and its queue fills up) it returns -1 and the networking core does not queue up the packet. This condition is indicated by a -1 return from qemu_send_packet_async(). Currently, tap handles this condition simply by dropping the packet. It should do its best to avoid getting into this situation by checking such NIC's have room for a packet before copying the packet from the tap interface. tap_send() used to achieve this by only reading a single packet before returning to the mainloop. That way, tap_can_send() is called before reading each packet. tap_send() was changed to completely drain the tap interface queue without taking into account the situation where the NIC returns an error and the packet is not queued. Let's start fixing this by reverting to the previous behaviour of reading one packet at a time. Reported-by: Scott Tsai <scottt.tw@gmail.com> Tested-by: Sven Rudolph <Sven_Rudolph@drewag.de> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30Unbreak Linux buildAnthony Liguori1-1/+1
commit 71f4effce79ec0485586963ea764f2c212c72f26 Author: Alexander Graf <agraf@suse.de> Date: Fri Oct 30 22:27:00 2009 +0100 Unbreak tap compilation on OS X Broke the build on Linux due to a bad #if guard Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30Unbreak tap compilation on OS XAlexander Graf3-2/+9
Currently compiling the tap sources breaks on Mac OS X. This is because of: 1) tap-linux.h requiring Linux includes 2) typos 3) missing #includes This patch adds what's necessary to compile tap happily on Mac OS X. I haven't tested if using tap actually works, but I don't think that's a major issue as that code was probably seriously untested before already. I didn't split the patch, because it's only a few lines of code and splitting is probably not worth the effort here. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30net: move UFO support detection to tap-linux.cMark McLoughlin6-6/+29
Only supported on Linux Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30net: move tap_set_offload() code into tap-linux.cMark McLoughlin6-20/+43
TUNSETOFFLOAD is only available on Linux Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30net: move tap_probe_vnet_hdr() to tap-linux.cMark McLoughlin6-12/+27
Only Linux has support for IFF_VNET_HDR Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30net: move tap_set_sndbuf() to tap-linux.cMark McLoughlin6-24/+42
TUNSETSNDBUF is only available on linux Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30net: move linux code into net/tap-linux.cMark McLoughlin2-47/+78
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30net: move AIX code into net/tap-aix.cMark McLoughlin2-12/+32
Okay, this makes the tap options available on AIX even though there's no support, but if we want to do it right we should have not compile the tap code at all on AIX using e.g. CONFIG_TAP. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30net: move solaris code to net/tap-solaris.cMark McLoughlin3-165/+190
Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>