summaryrefslogtreecommitdiffstats
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
* net: netmap_poll must update both read/write poll statePrasad Joshi2014-03-251-2/+2
| | | | | Signed-off-by: Prasad Joshi <prasadjoshi.linux@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into ↵Peter Maydell2014-03-121-2/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | staging Net patches # gpg: Signature made Wed 12 Mar 2014 13:48:20 GMT using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/net-pull-request: tap: avoid deadlocking rx Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * tap: avoid deadlocking rxStefan Hajnoczi2014-03-121-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The net subsystem has a control flow mechanism so peer NetClientStates can tell each other to stop sending packets. This is used to stop monitoring the tap file descriptor for incoming packets if the guest rx ring has no spare buffers. There is a corner case when tap_can_send() is true at the beginning of an event loop iteration but becomes false before the tap_send() fd handler is invoked. tap_send() will read the packet from the tap file descriptor and attempt to send it. The net queue will hold on to the packet and return 0, indicating that further I/O is not possible. tap then stops monitoring the file descriptor for reads. This is unlike the normal case where tap_can_send() is the same before and during the event loop iteration. The event loop would simply not monitor the file descriptor if tap_can_send() returns true. Upon next iteration it would check tap_can_send() again and begin monitoring if we can send. The deadlock happens because tap_send() explicitly disabled read_poll. This is done with the expectation that the peer will call qemu_net_queue_flush(). But hw/net/virtio-net.c does not monitor vm_running transitions and issue the flush. Hence we're left with a broken tap device. Cc: qemu-stable@nongnu.org Reported-by: Neil Skrypuch <neil@tembosocial.com> Tested-by: Neil Skrypuch <neil@tembosocial.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* | slirp smb with modern win guests when samba is also running on hostMichael Tokarev2014-03-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After numerous reports that -smb (or -netdev user,smb=foo) not working with modern windows (win7 and vista are reported as non-working), I started digging myself. And found that indeed it doesn't work, and why. The thing is that modern win tries to connect to port 445 (microsoft-ds) first, and if that fails, it falls back to old port 139 (netbios-ssn). slirp code in qemu only redirects port 139, it does not touch port 445. So the prob is that if samba is also running on the host, guest will try to communicate using port 445, and that will succed, but ofcourse guest will not talk with our samba but with samba running on the host. If samba is not running on the host, guest will fall back to port 139, and will reach the redirecting rule and qemu will spawn smbd correctly. The solution is to redirect both ports (139 and 445), and the fix is a one-liner, adding second call to slirp_add_exec() at the end of net/slirp.c:slirp_smb() function (provided below). But it looks like that is not a proper fix really, since in theory we should redirect both ports to the SAME, single samba instance, but I'm not sure this is possible with slirp. Well, even if two smbd processes will be run on the same config dir, it should not be a problem. The one-liner (not exactly 1 since it touches previous line too) is like this: Signed-off-By: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
* | qemu/slirp: Fix SMB security configuration on newer samba versionsMichael Buesch2014-03-121-1/+2
|/ | | | | | | | | | | | | | | | | The smb.conf automatically generated by qemu's -smb option fails on current samba, because smbd rejects the security=share option with the following warning: > WARNING: Ignoring invalid value 'share' for parameter 'security' Which makes it fall back to security=user without guest login. This results in being unable to login to the samba server from the guest OS. This fixes it by selecting 'user' explicitly and mapping unknown users to guest logins. Signed-off-by: Michael Buesch <m@bues.ch> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
* net: remove implicit peer from offload APIStefan Hajnoczi2014-02-251-18/+18
| | | | | | | | | | | | | | | | The virtio_net offload APIs are used on the NIC's peer (i.e. the tap device). The API was defined to implicitly use nc->peer, saving the caller the trouble. This wasn't ideal because: 1. There are callers who have the peer but not the NIC. Currently they are forced to bypass the API and access peer->info->... directly. 2. The rest of the net.h API uses nc, not nc->peer, so it is inconsistent. This patch pushes nc->peer back up to callers. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: Disable netmap backend when not supportedVincenzo Maffione2014-02-251-42/+13
| | | | | | | | | | | | | | | | | | | This patch fixes configure so that the netmap backend is not compiled in if the host doesn't support an API version >= 11. A version upper bound (15) has been added so that the netmap API can be extended with some minor features without requiring QEMU code modifications. Moreover, some changes have been done to net/netmap.c in order to reflect the current netmap API/ABI (11). The NETMAP_WITH_LIBS macro makes possible to include some utilities (e.g. netmap ring macros, D(), RD() and other high level functions) through the netmap headers. In this way we get rid of the D and RD macro definitions in the QEMU code, and we open the way for further code simplifications that will be introduced by future patches. Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: add offloading support to netmap backendVincenzo Maffione2014-02-251-1/+67
| | | | | | | | | | Whit this patch, the netmap backend supports TSO/UFO/CSUM offloadings, and accepts the virtio-net header, similarly to what happens with TAP. The offloading callbacks in the NetClientInfo interface have been implemented. Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: make tap offloading callbacks staticVincenzo Maffione2014-02-252-12/+12
| | | | | | | | Since TAP offloadings are manipulated through a new API, it's not necessary to export them in include/net/tap.h anymore. Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: TAP uses NetClientInfo offloading callbacksVincenzo Maffione2014-02-252-43/+55
| | | | | | | | The TAP NetClientInfo structure is inizialized with the TAP-specific functions that manipulates offloading features. Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: extend NetClientInfo for offloadingVincenzo Maffione2014-02-251-0/+55
| | | | | | | | Some new callbacks have been added to generalize the operations done by virtio-net and vmxnet3 frontends to manipulate TAP offloadings. Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: change vnet-hdr TAP prototypesVincenzo Maffione2014-02-252-7/+7
| | | | | | | | | The tap_has_vnet_hdr() and tap_has_vnet_hdr_len() functions used to return int, even though they only return true/false values. This patch changes the prototypes to return bool. Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* Use error_is_set() only when necessaryMarkus Armbruster2014-02-171-6/+6
| | | | | | | | | | | | | | | | error_is_set(&var) is the same as var != NULL, but it takes whole-program analysis to figure that out. Unnecessarily hard for optimizers, static checkers, and human readers. Dumb it down to obvious. Gets rid of several dozen Coverity false positives. Note that the obvious form is already used in many places. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* tap-linux: Get features once and use it many timesKusanagi Kouichi2014-01-271-6/+8
| | | | | Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: Use g_strdup_printf instead of snprintf.Hani Benhabiles2014-01-271-4/+1
| | | | | | | | assign_name() in net/net.c is using snprintf + g_strdup to get the same result as g_strdup_printf. Signed-off-by: Hani Benhabiles <kroosec@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* misc: Use macro ARRAY_SIZE where possibleStefan Weil2013-12-231-1/+1
| | | | | | | | | | | This improves readability and simplifies the code. Cc: Anthony Liguori <aliguori@amazon.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* net: Update netdev peer on link changeVlad Yasevich2013-12-091-9/+17
| | | | | | | | | | | | | | | | | | | | | | When a link change occurs on a backend (like tap), we currently do not propage such change to the nic. As a result, when someone turns off a link on a tap device, for instance, then a guest doesn't see that change and continues to try to send traffic or run DHCP even though the lower-layer is disconnected. This is OK when the network is set up as a HUB since the the guest may be connected to other HUB ports too, but when it's set up as a netdev, it makes thinkgs worse. The patch addresses this by setting the peers link down only when the peer is not a HUBPORT device. With this patch, in the following config -netdev tap,id=net0 -device e1000,mac=XXXXX,netdev=net0 when net0 link is turned off, the guest e1000 shows lower-layer link down. This allows guests to boot much faster in such configurations. With windows guest, it also allows the network to recover properly since windows will not configure the link-local IPv4 address, and when the link is turned on, the proper address address is configured. Signed-off-by: Vlad Yasevich <vyasevic@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: Adding netmap network backendVincenzo Maffione2013-12-094-0/+447
| | | | | | | | | | | | | | | | | | | | | | | This patch adds support for a network backend based on netmap. netmap is a framework for high speed packet I/O. You can use it to build extremely fast traffic generators, monitors, software switches or network middleboxes. Its companion software switch VALE lets you interconnect virtual machines. netmap and VALE are implemented as a non-intrusive kernel module, support NICs from multiple vendors, are part of standard FreeBSD distributions and available in source format for Linux too. To compile QEMU with netmap support, use the following configure options: ./configure [...] --enable-netmap --extra-cflags=-I/path/to/netmap/sys where "/path/to/netmap" contains the netmap source code, available at http://info.iet.unipi.it/~luigi/netmap/ The same webpage contains more information about the netmap project (together with papers and presentations). Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: fix qemu_flush_queued_packets() in presence of a hubSergey Fedorov2013-11-081-1/+0
| | | | | | | | Do not return after net_hub_flush(). Always flush callee network client incoming queue. Signed-off-by: Sergey Fedorov <s.fedorov@samsung.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: disallow to specify multicast MAC addressDmitry Krivenok2013-11-081-0/+6
| | | | | | | | | | | | | | [Assigning a multicast MAC address to a NIC leads to confusing behavior. Reject multicast MAC addresses so users are alerted to their error straight away. The "net/eth.h" in6_addr rename prevents a name collision with <netinet/in.h> on Linux. -- Stefan] Signed-off-by: Dmitry V. Krivenok <krivenok.dmitry@gmail.com> Reviewed-by: Amos Kong <kongjianjun@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: call socket_set_fast_reuse instead of setting SO_REUSEADDRSebastian Ottlik2013-10-021-9/+10
| | | | | | | | | | | | | | SO_REUSEADDR should be avoided on Windows but is desired on other operating systems. So instead of setting it we call socket_set_fast_reuse that will result in the appropriate behaviour on all operating systems. An exception to this rule are multicast sockets where it is sensible to have multiple sockets listen on the same ip and port and we should set SO_REUSEADDR on windows. Signed-off-by: Sebastian Ottlik <ottlik@fzi.de> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de>
* net: Rename send_queue to incoming_queueJan Kiszka2013-09-062-8/+8
| | | | | | | | | | Each networking client has a queue for packets that could not yet be delivered to that client. Calling this queue "send_queue" is highly confusing as it has nothing to to with packets send from this client but to it. Avoid this confusing by renaming it to "incoming_queue". Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: Use numbered tap/tun devices on all *BSD OS'sBrad Smith2013-09-061-11/+0
| | | | | | | | | The following patch simplifies the *BSD tap/tun code and makes use of numbered tap/tun interfaces on all *BSD OS's. NetBSD has a patch in their pkgsrc tree to make use of this feature and DragonFly also supports this as well. Signed-off-by: Brad Smith <brad@comstyle.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* aio / timers: Switch entire codebase to the new timer APIAlex Bligh2013-08-221-1/+1
| | | | | | | | | | | This is an autogenerated patch using scripts/switch-timer-api. Switch the entire code base to using the new timer API. Note this patch may introduce some line length issues. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* aio / timers: Untangle include filesAlex Bligh2013-08-222-0/+2
| | | | | | | | | | include/qemu/timer.h has no need to include main-loop.h and doing so causes an issue for the next patch. Unfortunately various files assume including timers.h will pull in main-loop.h. Untangle this mess. Signed-off-by: Alex Bligh <alex@alex.org.uk> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* misc: Use g_assert_not_reached for code which is expected to be unreachableStefan Weil2013-07-271-1/+1
| | | | | | | | The macro g_assert_not_reached is a better self documenting replacement for assert(0) or assert(false). Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* net: add support of mac-programming over macvtap in QEMU sideAmos Kong2013-07-151-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently macvtap based macvlan device is working in promiscuous mode, we want to implement mac-programming over macvtap through Libvirt for better performance. Design: QEMU notifies Libvirt when rx-filter config is changed in guest, then Libvirt query the rx-filter information by a monitor command, and sync the change to macvtap device. Related rx-filter config of the nic contains main mac, rx-mode items and vlan table. This patch adds a QMP event to notify management of rx-filter change, and adds a monitor command for management to query rx-filter information. Test: If we repeatedly add/remove vlan, and change macaddr of vlan interfaces in guest by a loop script. Result: The events will flood the QMP client(management), management takes too much resource to process the events. Event_throttle API (set rate to 1 ms) can avoid the events to flood QMP client, but it could cause an unexpected delay (~1ms), guests guests normally expect rx-filter updates immediately. So we use a flag for each nic to avoid events flooding, the event is emitted once until the query command is executed. The flag implementation could not introduce unexpected delay. There maybe exist an uncontrollable delay if we let Libvirt do the real change, guests normally expect rx-filter updates immediately. But it's another separate issue, we can investigate it when the work in Libvirt side is done. Michael S. Tsirkin: tweaked to enable events on start Michael S. Tsirkin: fixed not to crash when no id Michael S. Tsirkin: fold in patch: "additional fixes for mac-programming feature" Amos Kong: always notify QMP client if mactable is changed Amos Kong: return NULL list if no net client supports rx-filter query Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* fix -net user checks by reordering checksBas van Sisseren2013-06-191-6/+6
| | | | | | | | | | reorder slirp config options. first check the dns-server-address, then check the first-dhcp-address. the original code was comparing the first-dhcp-address with the default dns-server-address, not the configured dns-server-address. Signed-off-by: Bas van Sisseren <bas@quarantainenet.nl> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
* tap: fix NULL dereference when passing invalid parameters to tapJason Wang2013-06-071-6/+12
| | | | | | | | | | | | | | | | | | | | This patch forbid the following invalid parameters to tap: 1) fd and vhostfds were specified but vhostfd were not specified 2) vhostfds were specified but fds were not specified 3) fds and vhostfd were specified For 1 and 2, net_init_tap_one() will still pass NULL as vhostfdname to monitor_handle_fd_param(), which may crash the qemu. Also remove the unnecessary has_fd check. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Stefan Hajnoczi <shajnocz@redhat.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: support for bridged networking on Mac OS XAlasdair McLeay2013-05-241-1/+2
| | | | | | | | | | | | | | | | | tun tap can be implemented on Mac OS X using http://tuntaposx.sourceforge.net It behaves in the same way as FreeBSD/OpenBSD implementations, but Qemu needs a patch to use the OpenBS/FreeBSD code. As per the patch listed in this forum thread: http://forum.gns3.net/post17679.html#p17679 And also as used in the MacPorts installation: https://trac.macports.org/browser/trunk/dports/emulators/qemu/files/patch-net-tap-interface.diff Signed-off-by: Alasdair McLeay <alasdair.mcleay@me.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: properly initialize vhostfdsJason Wang2013-05-031-1/+1
| | | | | | | | | | | | | | Only tap->vhostfd were checked net_init_tap_one(), but tap->vhostfds were forgot, this will lead qemu to ignore all fds passed by management through vhostfds, and tries to create vhost_net device itself. Fix by adding this check also. Reportyed-by: Michal Privoznik <mprivozn@redhat.com> Cc: Michal Privoznik <mprivozn@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: make network client name uniqueAmos Kong2013-05-031-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | assign_name() creates a name MODEL.NUM, where MODEL is the client's model, and NUM is the number of MODELs that already exist. Markus added NIC naming for non-VLAN clients in commit 53e51d85. commit d33d93b2 incorrectly added a judgement of net-hub. It caused net clients created with -netdev get same names. eg: # qemu-upstream -device virtio-net-pci,netdev=h1 -netdev tap,id=h1 \ -device virtio-net-pci,netdev=h2 -netdev tap,id=h2 .. (qemu) info network virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:56 \ h1: index=0,type=tap,ifname=tap0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown virtio-net-pci.0: index=0,type=nic,model=virtio-net-pci,macaddr=52:54:00:12:34:57 \ h2: index=0,type=tap,ifname=tap1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown This patch removed the check of nic-hub, and created unique names for all net clients that have same model. v2: update commitlog & comments Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* sysemu: avoid proliferation of include/ subdirectoriesPaolo Bonzini2013-04-151-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* hw: move headers to include/Paolo Bonzini2013-04-081-1/+1
| | | | | | | | | Many of these should be cleaned up with proper qdev-/QOM-ification. Right now there are many catch-all headers in include/hw/ARCH depending on cpu.h, and this makes it necessary to compile these files per-target. However, fixing this does not belong in these patches. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qemu-char: Call fe_claim / fe_release when not using qdev chr propertiesHans de Goede2013-04-041-0/+1
| | | | | | | | | | | | | | | | | | chardev-frontends need to explictly check, increase and decrement the avail_connections "property" of the chardev when they are not using a qdev-chardev-property for the chardev. This fixes things like: qemu-kvm -chardev stdio,id=foo -device isa-serial,chardev=foo \ -mon chardev=foo Working, where they should fail. Most of the changes here are due to old hardware emulation code which is using serial_hds directly rather then a qdev-chardev-property. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Message-id: 1364412581-3672-3-git-send-email-hdegoede@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: ensure "socket" backend uses non-blocking fdsStefan Hajnoczi2013-04-021-1/+6
| | | | | | | | | | | | | | | | | | There are several code paths in net_init_socket() depending on how the socket is created: file descriptor passing, UDP multicast, TCP, or UDP. Some of these support both listen and connect. Not all code paths set the socket to non-blocking. This patch addresses the file descriptor passing and UDP cases which were missing socket_set_nonblock(fd) calls. I considered moving socket_set_nonblock(fd) to a central location but it turns out the code paths are different enough to require non-blocking at different places. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()Stefan Hajnoczi2013-04-021-3/+3
| | | | | | | | | The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets. Rename to qemu_set_nonblock() just like qemu_set_cloexec(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* net: increase buffer size to accommodate Jumbo frame pktsScott Feldman2013-03-254-10/+5
| | | | | | | | | | | | | | | | | | | | Socket buffer sizes were hard-coded to 4K for VDE and socket netdevs. Bump this up to 68K (ala tap netdev) to handle maximum GSO packet size (64k) plus plenty of room for the ethernet and virtio_net headers. Originally, ran into this limitation when using -netdev UDP sockets to connect VM-to-VM, where VM interface is configure with MTU=9000. (Using virtio_net NIC model). Test is simple: ping -M do -s 8500 <target>. This test will attempt to ping with unfragmented packet of given size. Without patch, size is limited to < 4K (minus protocol hdrs). With patch, ping test works with pkt size up to 9000 (again, minus protocol hdrs). v2: per Stefan, increase buf size to (4096+65536) as done in tap and apply to vde and socket netdevs. v1: increase buf size to 12K just for -netdev UDP sockets Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* Common definitions for VMWARE devicesDmitry Fleytman2013-03-252-0/+218
| | | | | | Signed-off-by: Dmitry Fleytman <dmitry@daynix.com> Signed-off-by: Yan Vugenfirer <yan@daynix.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: iovec checksum calculatorDmitry Fleytman2013-03-251-0/+29
| | | | | | Signed-off-by: Dmitry Fleytman <dmitry@daynix.com> Signed-off-by: Yan Vugenfirer <yan@daynix.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* Checksum-related utility functionsDmitry Fleytman2013-03-251-6/+7
| | | | | | | | | | | | net_checksum_add_cont() checksum calculation for scattered data with odd chunk sizes net_raw_checksum() checksum calculation for a buffer Signed-off-by: Dmitry Fleytman <dmitry@daynix.com> Signed-off-by: Yan Vugenfirer <yan@daynix.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: use socket_set_nodelay() for -netdev socketStefan Hajnoczi2013-03-251-0/+3
| | | | | | | | | | | | | | | Reduce -netdev socket latency by disabling the Nagle algorithm on SOCK_STREAM sockets in net/socket.c. Since we are tunelling Ethernet over TCP we shouldn't artificially delay outgoing packets, let the guest decide packet scheduling. I already get sub-millisecond -netdev socket ping times on localhost, so there was no measurable difference in my testing. This won't hurt though and may improve remote socket performance. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
* Fix typos and misspellingsPeter Maydell2013-03-221-1/+1
| | | | | | | | | Fix various typos and misspellings. The bulk of these were found with codespell. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* MinGW: Replace setsockopt by qemu_setsocketoptStefan Weil2013-03-221-11/+10
| | | | | | | | | Instead of adding missing type casts which are needed by MinGW for the 4th argument, the patch uses qemu_setsockopt which was invented for this purpose. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: reduce the unnecessary memory allocation of multiqueueJason Wang2013-02-271-10/+9
| | | | | | | | | | | | | | | | | | Edivaldo reports a problem that the array of NetClientState in NICState is too large - MAX_QUEUE_NUM(1024) which will wastes memory even if multiqueue is not used. Instead of static arrays, solving this issue by allocating the queues on demand for both the NetClientState array in NICState and VirtIONetQueue array in VirtIONet. Tested by myself, with single virtio-net-pci device. The memory allocation is almost the same as when multiqueue is not merged. Cc: Edivaldo de Araujo Pereira <edivaldoapereira@yahoo.com.br> Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: set IFF_ONE_QUEUE per defaultPeter Lieven2013-02-272-8/+11
| | | | | | | | | | | | | | historically the kernel queues packets two times. once at the device and second in qdisc. this is believed to cause interface stalls if one of these queues overruns. setting IFF_ONE_QUEUE is the default in kernels >= 3.8. the flag is ignored since then. see kernel commit 5d097109257c03a71845729f8db6b5770c4bbedc Signed-off-by: Peter Lieven <pl@kamp.de> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: forbid creating multiqueue tap when hub is usedJason Wang2013-02-271-0/+7
| | | | | | | | | | Obviously, hub does not support multiqueue tap. So this patch forbids creating multiple queue tap when hub is used to prevent the crash when command line such as "-net tap,queues=2" is used. Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: fix unbounded NetQueueLuigi Rizzo2013-02-271-0/+15
| | | | | | | | | | | | | | | | | | | | | | In the current implementation of qemu, running without a network backend will cause the queue to grow unbounded when the guest is transmitting traffic. This patch fixes the problem by implementing bounded size NetQueue, used with an arbitrary limit of 10000 packets, and dropping packets when the queue is full _and_ the sender does not pass a callback. The second condition makes sure that we never drop packets that contains a callback (which would be tricky, because the producer expects the callback to be run when all previous packets have been consumed; so we cannot run it when the packet is dropped). If documentation is correct, producers that submit a callback should stop sending when their packet is queued, so there is no real risk that the queue exceeds the max size by large values. Signed-off-by: Luigi Rizzo <rizzo@iet.unipi.it> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: fix qemu_flush_queued_packets() in presence of a hubLuigi Rizzo2013-02-273-0/+21
| | | | | | | | | | | | | | | | | | When frontend and backend are connected through a hub as below (showing only one direction), and the frontend (or in general, all output ports of the hub) cannot accept more traffic, the backend queues packets in queue-A. When the frontend (or in general, one output port) becomes ready again, quemu tries to flush packets from queue-B, which is unfortunately empty. e1000.0 <--[queue B]-- hub0port0(hub)hub0port1 <--[queue A]-- tap.0 To fix this i propose to introduce a new function net_hub_flush() which is called when trying to flush a queue connected to a hub. Signed-off-by: Luigi Rizzo <rizzo@iet.unipi.it> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: Avoid NULL function pointer dereference on cleanupAndreas Färber2013-02-131-1/+3
| | | | | | | | | | | The pSeries machine and some other devices don't supply a cleanup callback. Revert part of 1ceef9f27359cbe92ef124bf74de6f792e71f6fb that started calling it unconditionally. Cc: Jason Wang <jasowang@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1360707366-9271-1-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud