Commit Graph

7697 Commits

Author SHA1 Message Date
Mark McLoughlin
e19eb22486 net: make use of async packet sending API in tap client
If a packet is queued by qemu_send_packet(), remove I/O
handler for the tap fd until we get notification that the
packet has been sent.

A not insignificant side effect of this is we can now
drain the tap send queue in one go without fear of packets
being dropped.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:50 +01:00
Mark McLoughlin
f3b6c7fcf8 net: add qemu_send_packet_async()
Add a qemu_send_packet() variant which will queue up the packet
if it cannot be sent when all client queues are full. It later
invokes the supplied callback when the packet has been sent.

If qemu_send_packet_async() returns zero, the caller is expected
to not send any more packets until the queued packet has been
sent.

Packets are queued iff a receive() handler returns zero (indicating
queue full) and the caller has provided a sent notification callback
(indicating it will stop and start its own queue).

We need the packet sending API to support queueing because:

  - a sending client should process all available packets in one go
    (e.g. virtio-net emptying its tx ring)

  - a receiving client may not be able to handle the packet
    (e.g. -EAGAIN from write() to tapfd)

  - the sending client could detect this condition in advance
    (e.g. by select() for writable on tapfd)

  - that's too much overhead (e.g. a select() call per packet)

  - therefore the sending client must handle the condition by
    dropping the packet or queueing it

  - dropping packets is poor form; we should queue.

However, we don't want queueing to be completely transparent. We
want the sending client to stop sending packets as soon as a
packet is queued. This allows the sending client to be throttled
by the receiver.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:50 +01:00
Mark McLoughlin
e94667b91c net: split out packet queueing and flushing into separate functions
We'll be doing more packet queueing in later commits.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:50 +01:00
Mark McLoughlin
3e021d40b7 net: return status from qemu_deliver_packet()
Will allow qemu_send_packet() handle queue full condition.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:50 +01:00
Mark McLoughlin
4f1c942b7f net: add return value to packet receive handler
This allows us to handle queue full conditions rather than dropping
the packet on the floor.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Mark McLoughlin
e3f5ec2b5e net: pass VLANClientState* as first arg to receive handlers
Give static type checking a chance to catch errors.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Mark McLoughlin
cda9046ba7 net: re-name vc->fd_read() to vc->receive()
VLANClientState's fd_read() handler doesn't read from file
descriptors, it adds a buffer to the client's receive queue.

Re-name the handlers to make things a little less confusing.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Mark McLoughlin
463af5349a net: add fd_readv() handler to qemu_new_vlan_client() args
This, apparently, is the style we prefer - all VLANClientState
should be an argument to qemu_new_vlan_client().

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Mark McLoughlin
3471b757d0 net: only read from tapfd when we can send
Reduce the number of packets dropped under heavy network
traffic by only reading a packet from the tapfd when a
client can actually handle it.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Mark McLoughlin
2e1e064110 net: vlan clients with no fd_can_read() can always receive
If a vlan client has no fd_can_read(), that means it can
always receive packets. The current code assumes it can *never*
receive packets.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Mark McLoughlin
5b01e886d9 net: move the tap buffer into TAPState
KVM uses a 64k buffer for reading from tapfd (for GSO support)
and allocates the buffer with TAPState rather than on the stack.

Not allocating it on the stack probably makes sense for qemu
anyway, so merge it in advance of GSO support.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Mark McLoughlin
5a6d881574 net: factor tap_read_packet() out of tap_send()
Move portability clutter out into its own function.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Jan Kiszka
b8e8af38ee slirp: Reorder initialization
This patch reorders the initialization of slirp itself as well as its
associated features smb and redirection. So far the first reference to
slirp triggered the initialization, independent of the actual -net user
option which may carry additional parameters. Now we save any request to
add a smb export or some redirections until the actual initialization of
the stack. This also allows to move a few parameters that were passed
via global variable into the argument list of net_slirp_init.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Jan Kiszka
10ae5a7a98 net: Improve parameter error reporting
As host network devices can also be instantiated via the monitor, errors
should then be reported to the related monitor instead of stderr. This
requires larger refactoring, so this patch starts small with introducing
a helper to catch both cases and convert net_client_init as well as
net_slirp_redir.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Mark McLoughlin
c8decae2e1 net: fix error reporting for some net parameter checks
A small bit of confusion between buffers is causing errors like:

  qemu: invalid parameter '10' in 'script=/etc/qemu-ifup,fd=10'

instead of:

  qemu: invalid parameter 'script' in 'script=/etc/qemu-ifup,fd=10'

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Jan Kiszka
0aa7a205c8 net: Real fix for check_params users
OK, last try: 8e4416af45 broke -net socket, ffad4116b9 tried to fix it
but broke error reporting of invalid parameters. So this patch widely
reverts ffad4116b9 again and intead fixes those callers of check_params
that originally suffered from overwritten buffers by using separate
ones.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Mark McLoughlin
cda94b2782 Revert "Fix output of uninitialized strings"
This reverts commit 8cf07dcbe7.

This is a sorry saga.

This commit:

  8e4416af45 net: Add parameter checks for VLAN clients

broken '-net socket' and this commit:

  ffad4116b9 net: Fix -net socket parameter checks

fixed the problem but introduced another problem which
this commit:

  8cf07dcbe7 Fix output of uninitialized strings

fixed that final problem, but causing us to lose some
error reporting information in the process.

Meanwhile Jan posted a patch to mostly re-do ffad4116b9
in a way that fixes the original issue, but without
losing the error reporting information. So, let's revert
8cf07dcbe7 and apply Jan's patch.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Jan Kiszka
7c3370d4fe slirp: Avoid zombie processes after fork_exec
Slirp uses fork_exec for spawning service processes, and QEMU uses this
for running smbd. As SIGCHLD is not handled, these processes become
zombies on termination. Fix this by installing a proper signal handler,
but also make sure we disable the signal while waiting on forked network
setup/shutdown scripts.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:49 +01:00
Jan Kiszka
c27ff60871 net: Fix and improved ordered packet delivery
Fix a race in qemu_send_packet when delivering deferred packets and
add proper deferring also to qemu_sendv_packet.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:48 +01:00
Jan Kiszka
c8aa237c64 net: Don't deliver to disabled interfaces in qemu_sendv_packet
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-09 11:38:48 +01:00
Gerd Hoffmann
98ba2632fc qdev: c99 initilaizers for bus_type_names
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-06-08 20:36:54 +03:00
Gerd Hoffmann
682aea0eaa xen nic: use XC_PAGE_SIZE instead of PAGE_SIZE.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-06-08 20:02:04 +03:00
Gerd Hoffmann
7105b05658 xen nic: use qemu_malloc
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-06-08 20:01:23 +03:00
Jan Kiszka
168ccc11c3 kvm: Improve upgrade notes when facing unsupported kernels
Users complained that it is not obvious what to do when kvm refuses to
build or run due to an unsupported host kernel, so let's improve the
hints.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2009-06-07 16:40:22 +03:00
Blue Swirl
4ca1a9c62a Fix generation of CONFIG_KVM
When configuring for several targets, some with KVM and some without, CONFIG_KVM was accidentally disabled for some of the targets.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-07 13:29:26 +00:00
Stuart Brady
153859be1a Use hxtool for qemu-img command list
Use hxtool to generate the 'command syntax' section of qemu-img's help
message, and the corresponding section of the texinfo documentation.

This has the side-effect of adding 'check' to this list of commands in
the texinfo documentation.

Signed-off-by: Stuart Brady <stuart.brady@gmail.com>
2009-06-07 09:59:47 +03:00
Stefan Weil
3a2eeac0c9 doc: Update information on supported network adapters.
* There are no ISA PCI network adapters.
* MIPS Malta is supported with any PCI network card.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2009-06-06 19:22:44 +03:00
Gerd Hoffmann
6379840fc8 xen: net backend doesn't need linux headers.
Drop them to make qemu build on OpenSolaris.

Cc: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-06-06 18:48:50 +03:00
Kevin Wolf
eff442662d Document changes in qemu-img interface
Update the documentation to reflect the introduction of format specific options
with -o. Don't advertise -e or -6 any more, they exist only for compatibility
reasons and can be replaced by the corresponding -o options.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2009-06-06 18:39:02 +03:00
Kevin Wolf
db08adf526 qemu-img: Print available options with -o ?
This patch adds a small help text to each of the options in the block drivers
which can be displayed by using qemu-img create -f fmt -o ?

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2009-06-06 18:38:57 +03:00
Stefan Weil
f425c27872 Fix spelling in comment.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2009-06-06 18:17:14 +03:00
Blue Swirl
2313086add Use hxtool to generate monitor documentation and C structures
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-06-06 08:22:04 +00:00
Paul Brook
25517f999f Use correct type for SPARC cpu_cc_op
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-06 02:54:03 +01:00
Paul Brook
db241f4032 Fix typo
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-06 02:49:43 +01:00
Gerd Hoffmann
cae4956e5e qdev: add monitor command to dump the tree.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-05 15:53:17 +01:00
Paul Brook
1431b6a17e Record device property types
Record device property types, and provide a list of properties at device
registration time.

Add a "device" property type that holds a reference to annother device.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-05 15:52:04 +01:00
Paul Brook
fd93a79999 Fix elf loader range checking
The ELF loader tracks the range of addresses used by a binary.
However this incorrectly assumes zero is not a valid address.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-05 15:16:41 +01:00
Paul Brook
bdb11366b9 Remove ARM NVIC initialization hack
The ARMv7-M NVIC device pokes itself into the CPU state.  Now we have a
proper device model we can have the CPU/SoC code do this.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-04 13:12:05 +01:00
Paul Brook
f3d08ee6ae Add --enable-debug
New configure option for debug builds.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-04 11:41:10 +01:00
Gerd Hoffmann
aca312affb qdev: kill DeviceState->name
is redundant with DeviceState->type->name

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-06-04 11:24:42 +01:00
Nathan Froyd
1e9fa73016 fix gdbstub support for multiple threads in usermode, v3
When debugging multi-threaded programs, QEMU's gdb stub would report the
correct number of threads (the qfThreadInfo and qsThreadInfo packets).
However, the stub was unable to actually switch between threads (the T
packet), since it would report every thread except the first as being
dead.  Furthermore, the stub relied upon cpu_index as a reliable means
of assigning IDs to the threads.  This was a bad idea; if you have this
sequence of events:

initial thread created
new thread #1
new thread #2
thread #1 exits
new thread #3

thread #3 will have the same cpu_index as thread #1, which would confuse
GDB.  (This problem is partly due to the remote protocol not having a
good way to send thread creation/destruction events.)

We fix this by using the host thread ID for the identifier passed to GDB
when debugging a multi-threaded userspace program.  The thread ID might
wrap, but the same sort of problems with wrapping thread IDs would come
up with debugging programs natively, so this doesn't represent a
problem.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
2009-06-04 10:04:49 +01:00
Edgar E. Iglesias
4548eaea13 CRIS: Remove duplicated flag defines.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2009-06-03 22:48:05 +02:00
Edgar E. Iglesias
4b0c7aa364 microblaze: Fix loading of petalogix s3adsp1800 dtb.
Provide a petalogix-s3adsp1800.dtb blob.
Correct loading of the petalogix dtb.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2009-06-03 21:54:31 +02:00
Paul Brook
40905a6a31 Stellaris qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-03 15:16:49 +01:00
Paul Brook
2c6554bc6b Implement multiple samplers on stellaris ADC
Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-06-02 15:30:27 +01:00
Paul Brook
5cea8590ea Use relative path for bios
Look for bios and other support files relative to qemu binary, rather than
a hardcoded prefix.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2009-05-30 01:59:37 +01:00
Edgar E. Iglesias
abc0754527 Update maintainer list.
Add myself as maintainer for the microblaze cpu and boards.
Update list of CRIS machines.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2009-05-28 14:00:49 +02:00
Anthony Liguori
79fd42aab4 Install keymaps from new location
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-28 03:11:42 -05:00
Christoph Hellwig
f9e96436cc vvfat: one more missing BlockDriver C99 initializer conversion
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-28 02:14:56 -05:00
Anthony Liguori
f452095e3f Move keymaps into pc-bios
This isn't the most ideal layout, but it makes -L /path/to/git/pc-bios Just
Work which is very convenient.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-05-28 02:14:56 -05:00