summaryrefslogtreecommitdiffstats
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
...
* net: introduce qemu_get_nic()Jason Wang2013-02-011-4/+16
| | | | | | | | | To support multiqueue, this patch introduces a helper qemu_get_nic() to get NICState from a NetClientState. The following patches would refactor this helper to support multiqueue. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: introduce qemu_get_queue()Jason Wang2013-02-011-0/+5
| | | | | | | | | To support multiqueue, the patch introduce a helper qemu_get_queue() which is used to get the NetClientState of a device. The following patches would refactor this helper to support multiqueue. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: tap: use abort() instead of assert(0)Jason Wang2013-02-012-3/+3
| | | | | Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: tap: using bool instead of bitfieldJason Wang2013-02-012-23/+21
| | | | | Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* g_strdup(NULL) returns NULL; simplifyMarkus Armbruster2013-01-301-3/+1
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* HMP: add QDict to info callback handlerWenchao Xia2013-01-172-2/+2
| | | | | | | | | This patch change all info call back function to take additional QDict * parameter, which allow those command take parameter. Now it is set to NULL at default case. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* qemu-option: move standard option definitions out of qemu-config.cPaolo Bonzini2013-01-121-0/+26
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* net: add missing include fileLiming Wang2012-12-221-0/+1
| | | | | | | | | | | | | To fix building error: CC net/vde.o net/vde.c: In function ‘vde_cleanup’: net/vde.c:65:5: error: implicit declaration of function ‘qemu_set_fd_handler’ [-Werror=implicit-function-declaration] net/vde.c:65:5: error: nested extern declaration of ‘qemu_set_fd_handler’ [-Werror=nested-externs] cc1: all warnings being treated as errors Signed-off-by: Liming Wang <walimisdev@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* net: Add missing include statement (fix compiler warnings for MinGW)Stefan Weil2012-12-221-0/+1
| | | | | | | | | | | These and some more compiler warnings were caused by a recent commit: net/tap-win32.c:724: warning: no previous prototype for ‘tap_has_ufo’ net/tap-win32.c:729: warning: no previous prototype for ‘tap_has_vnet_hdr’ ... Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Merge remote-tracking branch 'bonzini/header-dirs' into stagingAnthony Liguori2012-12-1923-215/+1114
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bonzini/header-dirs: (45 commits) janitor: move remaining public headers to include/ hw: move executable format header files to hw/ fpu: move public header file to include/fpu softmmu: move remaining include files to include/ subdirectories softmmu: move include files to include/sysemu/ misc: move include files to include/qemu/ qom: move include files to include/qom/ migration: move include files to include/migration/ monitor: move include files to include/monitor/ exec: move include files to include/exec/ block: move include files to include/block/ qapi: move include files to include/qobject/ janitor: add guards to headers qapi: make struct Visitor opaque qapi: remove qapi/qapi-types-core.h qapi: move inclusions of qemu-common.h from headers to .c files ui: move files to ui/ and include/ui/ qemu-ga: move qemu-ga files to qga/ net: reorganize headers net: move net.c to net/ ... Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
| * softmmu: move remaining include files to include/ subdirectoriesPaolo Bonzini2012-12-191-1/+1
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * softmmu: move include files to include/sysemu/Paolo Bonzini2012-12-195-5/+5
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * misc: move include files to include/qemu/Paolo Bonzini2012-12-1912-19/+19
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * monitor: move include files to include/monitor/Paolo Bonzini2012-12-195-5/+5
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * qapi: move include files to include/qobject/Paolo Bonzini2012-12-191-1/+1
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * net: reorganize headersPaolo Bonzini2012-12-1921-188/+25
| | | | | | | | | | | | | | | | | | Move public headers to include/net, and leave private headers in net/. Put the virtio headers in include/net/tap.h, removing the multiple copies that existed. Leave include/net/tap.h as the interface for NICs, and net/tap_int.h as the interface for OS-specific parts of the tap backend. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * net: move net.c to net/Paolo Bonzini2012-12-192-1/+1057
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * janitor: do not include qemu-char everywherePaolo Bonzini2012-12-194-3/+1
| | | | | | | | | | | | | | Touching char/char.h basically causes the whole of QEMU to be rebuilt. Avoid this, it is usually unnecessary. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * tap: reset vnet header size on openMichael S. Tsirkin2012-12-121-0/+8
| | | | | | | | | | | | | | | | | | For tap, we currently assume the vnet header size is 10 (the default value) but that might not be the case if tap is persistent and has been used by qemu previously. To fix, set vnet header size correctly on open. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | net, hub: fix the indent in the commentsZhi Yong Wu2012-12-181-1/+1
|/ | | | | | | | Remove some redundant blanks in the comments of net_hub_id_for_client(). Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* Fix spelling (prefered -> preferred)Stefan Weil2012-12-071-3/+4
| | | | | Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap: reset vnet header size on openMichael S. Tsirkin2012-11-201-0/+7
| | | | | | | | | | | For tap, we currently assume the vnet header size is 10 (the default value) but that might not be the case if tap is persistent and has been used by qemu previously. To fix, set host header size in tap device on open. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Alexander Graf <agraf@suse.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* slirp: Add domain-search option to slirp's DHCP serverKlaus Stengel2012-11-151-3/+32
| | | | | | | | | | | This patch will allow the user to include the domain-search option in replies from the built-in DHCP server. The domain suffixes can be specified by adding dnssearch= entries to the "-net user" parameter. [Jan: tiny style adjustments] Signed-off-by: Klaus Stengel <Klaus.Stengel@asamnet.de> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
* net: use "socket" model name for UDP socketsLei Li2012-11-011-1/+1
| | | | | | | | | | | | Fix the problem that can not delete the udp socket. It's caused by passing "udp" model to net_socket_udp_init, but we do not have "udp" model in our model list. Pass the right model "socket" to init function. https://bugs.launchpad.net/qemu/+bug/1073585?comments=all Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* tap-win32: stubs to fix win32 buildMichael S. Tsirkin2012-10-301-0/+10
| | | | | | | | Add missing stubs to win32 to fix link failure. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* net/tap-win32: Fix compiler warning caused by missing include statementStefan Weil2012-10-191-0/+1
| | | | | | | | | | The include file for net_init_tap was missing: net/tap-win32.c:703: warning: no previous prototype for ‘net_init_tap’ Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* net: consolidate NetClientState header files into onePaolo Bonzini2012-10-0813-92/+34
| | | | | | | | | | | | | | | This patch doesn't seem much useful alone, I must admit. However, it makes sense as part of the upcoming directory reorganization, where I want to have include/net/tap.h as the net<->hw interface for tap. Then having both net/tap.h and include/net/tap.h does not work. "Fixed" by moving all the init functions to a single header file net/clients.h. The patch also adopts a uniform style for including net/*.h files from net/*.c, without the net/ path. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
* net/socket: Fix compiler warning (regression for MinGW)Stefan Weil2012-09-231-3/+3
| | | | | | | | | | | | | | | | Commit 213fd5087e2e4e2da10ad266df0ba950cf7618bf removed a type cast which is needed for MinGW: net/socket.c:136: warning: pointer targets in passing argument 2 of ‘sendto’ differ in signedness /usr/lib/gcc/amd64-mingw32msvc/4.4.4/../../../../amd64-mingw32msvc/include/winsock2.h:1313: note: expected ‘const char *’ but argument is of type ‘const uint8_t *’ Add a 'qemu_sendto' macro which provides that type cast where needed and use the new macro instead of 'sendto'. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
* net: EAGAIN handling for net/socket.c TCPStefan Hajnoczi2012-09-141-5/+31
| | | | | | | | | | | | | | | | | | | | Replace spinning send_all() with a proper non-blocking send. When the socket write buffer limit is reached, we should stop trying to send and wait for the socket to become writable again. Non-blocking TCP sockets can return in two different ways when the write buffer limit is reached: 1. ret = -1 and errno = EAGAIN/EWOULDBLOCK. No data has been written. 2. ret < total_size. Short write, only part of the message was transmitted. Handle both cases and keep track of how many bytes have been written in s->send_index. (This includes the 'length' header before the actual payload buffer.) Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* net: EAGAIN handling for net/socket.c UDPStefan Hajnoczi2012-09-141-2/+12
| | | | | | | Implement asynchronous send for UDP (or other SOCK_DGRAM) sockets. If send fails with EAGAIN we wait for the socket to become writable again. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* net: asynchronous send/receive infrastructure for net/socket.cStefan Hajnoczi2012-09-141-6/+52
| | | | | | | | | | | | | The net/socket.c net client is not truly asynchronous. This patch borrows the qemu_set_fd_handler2() code from net/tap.c as the basis for proper asynchronous send/receive. Only read packets from the socket when the peer is able to receive. This avoids needless queuing. Later patches implement asynchronous send. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* net: broadcast hub packets if at least one port can receiveStefan Hajnoczi2012-09-141-3/+3
| | | | | | | | | | | | | | | | | | | In commit 60c07d933c66c4b30a83b7ccbc8a0cb3df1b2d0e ("net: fix qemu_can_send_packet logic") the "VLAN" broadcast behavior was changed to queue packets if any net client cannot receive. It turns out that this was not actually the right fix and just hides the real bug that hw/usb/dev-network.c:usbnet_receive() clobbers its receive buffer when called multiple times in a row. The commit also introduced a new bug that "VLAN" packets would not be sent if one of multiple net clients was down. The hw/usb/dev-network.c bug has since been fixed, so this patch reverts broadcast behavior to send packets as long as one net client can receive. Packets simply get queued for the net clients that are temporarily unable to receive. Reported-by: Roy.Li <rongqing.li@windriver.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* net: do not report queued packets as sentStefan Hajnoczi2012-09-141-19/+16
| | | | | | | | | | | | | | | Net send functions have a return value where 0 means the packet has not been sent and will be queued. A non-zero value means the packet was sent or an error caused the packet to be dropped. This patch fixes two instances where packets are queued but we return their size. This causes callers to believe the packets were sent. When the caller uses the async send interface this creates a real problem because the callback will be invoked for a packet that the caller believed to be already sent. This bug can cause double-frees in the caller. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* net: notify iothread after flushing queuePaolo Bonzini2012-09-142-3/+4
| | | | | | | | | | | | | | | | | virtio-net has code to flush the queue and notify the iothread whenever new receive buffers are added by the guest. That is fine, and indeed we need to do the same in all other drivers. However, notifying the iothread should be work for the network subsystem. And since we are at it we can add a little smartness: if some of the queued packets already could not be delivered, there is no need to notify the iothread. Reported-by: Luigi Rizzo <rizzo@iet.unipi.it> Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Cc: Jan Kiszka <jan.kiszka@siemens.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* monitor: Rename+move net_handle_fd_param -> monitor_handle_fd_paramNicholas Bellinger2012-09-072-3/+3
| | | | | | | | | | | | | | | | | This patch renames+moves the net_handle_fd_param() caller used to obtain a file descriptor from either qemu_parse_fd() (the normal case) or from monitor_get_fd() (migration case) into a generically prefixed monitor_handle_fd_param() to be used by vhost-scsi code. Also update net/[socket,tap].c consumers to use the new prefix. Reported-by: Michael S. Tsirkin <mst@redhat.com> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* qapi: avoid reserved keywordsBlue Swirl2012-08-091-3/+3
| | | | | | | | | | Clang compiler complained about use of reserved word 'restrict' in SLIRP and QAPI. Prefix C keywords with "q_", adjust SLIRP accordingly. Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* net: add the support for -netdev socket, listenZhi Yong Wu2012-08-011-29/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The -net socket,listen option does not work with the newer -netdev syntax: http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg01508.html This patch makes it work now. For the case where one vlan has multiple listenning sockets, the patch will also provide the support. Supported syntax: 1.) -net socket,listen=127.0.0.1:1234,vlan=0 2.) -net socket,listen=127.0.0.1:1234,vlan=0 -net socket,listen=127.0.0.1:1235,vlan=0 3.) -netdev socket,listen=127.0.0.1:1234,id=socket0 Drop the NetSocketListenState struct and add a listen_fd field to NetSocketState. When a -netdev socket,listen= instance is created there will be a NetSocketState with fd=-1 and a valid listen_fd. The net_socket_accept() handler waits for listen_fd to become readable and then accepts the connection. When this state transition happens, we no longer monitor listen_fd for incoming connections...until the client disconnects again. Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* net: fix the coding styleZhi Yong Wu2012-08-011-1/+3
| | | | | | Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* hub: add the support for hub own flow controlZhi Yong Wu2012-08-011-3/+24
| | | | | | | | | | Only when all other hub port's *peer* .can_receive() all return 1, the source hub port .can_receive() return 1. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* net: determine if packets can be sent before net queue deliver packetsZhi Yong Wu2012-08-012-11/+5
| | | | | | | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* net: cleanup deliver/deliver_iov func pointersZhi Yong Wu2012-08-012-24/+6
| | | | | | | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* net: Make "info network" output more readable infoZhi Yong Wu2012-08-011-2/+4
| | | | | | | Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* net: Rename qemu_del_vlan_client() to qemu_del_net_client()Stefan Hajnoczi2012-08-011-1/+1
| | | | | | | | | | Another step in moving the vlan feature out of net core. Users only deal with NetClientState and therefore qemu_del_vlan_client() should be named qemu_del_net_client(). Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* net: Rename vc local variables to ncStefan Hajnoczi2012-08-012-12/+12
| | | | | | | | | | Now that VLANClientState has been renamed to NetClientState all 'vc' local variables should be 'nc'. Much of the code already used 'nc' but there are places where 'vc' needs to be renamed. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* net: Rename VLANClientState to NetClientStateStefan Hajnoczi2012-08-0115-110/+110
| | | | | | | | | | | | | | | The vlan feature is no longer part of net core. Rename VLANClientState to NetClientState because net clients are not explicitly associated with a vlan at all, instead they have a peer net client to which they are connected. This patch is a mechanical search-and-replace except for a few whitespace fixups where changing VLANClientState to NetClientState misaligned whitespace. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* net: Convert qdev_prop_vlan to peer with hubZhi Yong Wu2012-08-012-0/+26
| | | | | | | | | | | Instead of using VLANState use net/hub.h to support the vlan qdev property. The vlan qdev property becomes an alias for the peer qdev property but is represented as a VLAN ID number. When a VLAN ID is selected the device will really peer with a hub port. Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* net: Drop vlan argument to qemu_new_net_client()Stefan Hajnoczi2012-08-017-8/+8
| | | | | | | | | | Since hubs are now used to implement the 'vlan' feature and the vlan argument is always NULL, remove the argument entirely and update all net clients that use qemu_new_net_client(). Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* hub: Check that hubs are configured correctlyStefan Hajnoczi2012-08-012-0/+46
| | | | | | | | | | | | Checks can be performed to make sure that hubs have at least one NIC and one host device, warning the user if this is not the case. Configurations which do not meet this rule tend to be broken but just emit a warning. This patch preserves compatibility with the checks performed by net core on vlans. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* net: Look up 'vlan' net clients using hubsStefan Hajnoczi2012-08-013-2/+29
| | | | | | Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* net: Use hubs for the vlan featureStefan Hajnoczi2012-08-0113-58/+65
| | | | | | | | | | Stop using the special-case vlan code in net.c. Instead use the hub net client to implement the vlan feature. The next patch will remove vlan code from net.c completely. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
OpenPOWER on IntegriCloud