Commit Graph

27 Commits

Author SHA1 Message Date
Zhi Yong Wu 691a4f3a95 net: determine if packets can be sent before net queue deliver packets
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>
2012-08-01 13:32:11 +01:00
Jan Kiszka f373431977 slirp: Remove unneeded if_queued
There is now a trivial check on entry of if_start for pending packets,
so we can drop the additional tracking via if_queued.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-03-13 14:05:49 +01:00
Jan Kiszka e3078bf40a slirp: Fix queue walking in if_start
Another attempt to get this right: We need to carefully walk both the
fastq and the batchq in if_start while trying to send packets to
possibly not yet resolved hosts on the virtual network.

So far we just requeued a delayed packet where it was and then started
walking the queues from the top again - that couldn't work. Now we pre-
calculate the next packet in the queue so that the current one can
safely be removed if it was sent successfully. We also need to take into
account that the next packet can be from the same session if the current
one was sent and there are no other sessions.

CC: Fabien Chouteau <chouteau@adacore.com>
CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Stefan Weil <sw@weilnetz.de>
Tested-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-03-13 14:05:48 +01:00
Jan Kiszka 953e7f54e6 slirp: Prevent recursion of if_start
if_start can be called recursively via if_encap. Avoid this as our
scheme of dequeuing packets is not compatible with this.

CC: Fabien Chouteau <chouteau@adacore.com>
CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-03-13 14:05:48 +01:00
Jan Kiszka d6536b2c97 slirp: Keep next_m always valid
Make sure that next_m always points to a packet if batchq is non-empty.
This will simplify walking the queues in if_start.

CC: Fabien Chouteau <chouteau@adacore.com>
CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-03-13 14:05:48 +01:00
Jan Kiszka b87ffa1631 slirp: Refactor if_start
Replace gotos with a while loop, fix coding style.

CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-02-27 14:54:49 +01:00
Jan Kiszka b248ede2ef slirp: Fix requeuing of batchq packets in if_start
In case we requeued a packet that was the head of a longer session
queue, we failed to restore this ordering. Also, we did not properly
deal with changes to Slirp::next_m.

Instead of a cumbersome roll back, this fix simply avoids any changes
until we know if the packet was actually sent. Both fixes crashes due
to inconsistent queues and simplifies the logic.

Thanks to Zhi Yong Wu who found the reason for these crashes.

CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-02-27 14:54:49 +01:00
Jan Kiszka 79e7e937bd slirp: Clean up ifs_init
Remove duplicate ifs_init macros, reimplement the logic as static inline
in mbuf.h.

CC: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
CC: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2012-02-27 14:54:49 +01:00
Jan Kiszka e3a110b527 slirp: Only start packet expiration for delayed ones
The expiration timeout must only affect packets that are queued due to
pending ARP resolutions. The old version broke ping e.g.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2011-08-05 14:05:53 +02:00
Jan Kiszka fd5938799d slirp: Read current time only once per if_start call
No need to update the current time for each packet we send from the
queue. Processing time is comparably short.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2011-08-05 14:04:00 +02:00
Fabien Chouteau 1ab74cea06 Delayed IP packets
In the current implementation, if Slirp tries to send an IP packet to a client
with an unknown hardware address, the packet is simply dropped and an ARP
request is sent (if_encap in slirp/slirp.c).

With this patch, Slirp will send the ARP request, re-queue the packet and try
to send it later. The packet is dropped after one second if the ARP reply is
not received.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2011-08-03 12:57:11 +02:00
Jan Kiszka 9f8bd0421d slirp: Use internal state in interface
This now also exports the internal state to the slirp users in qemu,
returning it from slirp_init and expecting it along with service
invocations. Additionally provide an opaque value interface for the
callbacks from slirp into the qemu core.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:49 -05:00
Jan Kiszka 460fec67ee slirp: Factor out internal state structure
The essence of this patch is to stuff (almost) all global variables of
the slirp stack into the structure Slirp. In this step, we still keep
the structure as global variable, directly accessible by the whole
stack. Changes to the external interface of slirp will be applied in
the following patches.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:49 -05:00
Jan Kiszka b5302e1a9d slirp: Drop link_up checks from if_output and slirp_socket_can_recv
link_up is true once slirp is initialized, so these check are really not
required.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:49 -05:00
Jan Kiszka 0d62c4cfe2 slirp: Drop dead code
After all its years inside the qemu tree, there is no point in keeping
the dead code paths of slirp. This patch is a first round of removing
usually commented out code parts. More cleanups need to follow (and
maybe finally a proper reindention).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-06-29 08:52:46 -05:00
blueswir1 511d2b140f Sparse fixes: NULL use, header order, ANSI prototypes, static
Fix Sparse warnings:
 * use NULL instead of plain 0
 * rearrange header include order to avoid redefining types accidentally
 * ANSIfy SLIRP
 * avoid "restrict" keyword
 * add static



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6736 c046a42c-6fe2-441c-8c8c-71466251a162
2009-03-07 15:32:56 +00:00
blueswir1 674bb26172 Add some missing static qualifiers
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5363 c046a42c-6fe2-441c-8c8c-71466251a162
2008-09-30 18:18:27 +00:00
blueswir1 a5f1b965da Fix warnings that would be generated by gcc -Wstrict-prototypes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5021 c046a42c-6fe2-441c-8c8c-71466251a162
2008-08-17 20:21:51 +00:00
balrog 242acf3af4 Special-case CTL_ALIAS instead of CTL_DNS in udp loopback test.
At the same time remove a bogus test (tested by Jason Wessel).
Quiet some gcc4 warnings from slirp compilation.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4402 c046a42c-6fe2-441c-8c8c-71466251a162
2008-05-10 01:49:53 +00:00
blueswir1 7878ff6bc7 Add const etc. to places forgotten from the previous commit
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3453 c046a42c-6fe2-441c-8c8c-71466251a162
2007-10-26 19:34:46 +00:00
blueswir1 9634d9031c Use const and static as needed, disable unused code
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3452 c046a42c-6fe2-441c-8c8c-71466251a162
2007-10-26 19:01:16 +00:00
ths 3b46e62427 find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in the regex.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-17 08:09:54 +00:00
ths 5fafdf24ef find -type f | xargs sed -i 's/[\t ]$//g' # on most files
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-16 21:08:06 +00:00
bellard 38f3e7c2f5 suppressed unaligned accesses
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1911 c046a42c-6fe2-441c-8c8c-71466251a162
2006-05-10 19:21:58 +00:00
bellard 02d2c54cd3 windows fixes (Gregory Alexander)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1102 c046a42c-6fe2-441c-8c8c-71466251a162
2004-10-07 23:27:35 +00:00
bellard c9a621176e memory leak fix (Juergen Keil)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1067 c046a42c-6fe2-441c-8c8c-71466251a162
2004-09-13 21:42:51 +00:00
bellard f0cbd3ec9f initial user mode network support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@733 c046a42c-6fe2-441c-8c8c-71466251a162
2004-04-22 00:10:48 +00:00