From: Vincent Palatin <vpalatin@chromium.org>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: Vincent Palatin <vpalatin@chromium.org>
Subject: [Qemu-devel] [PATCH 2/2] net: fix qemu_can_send_packet logic
Date: Wed, 2 Mar 2011 17:25:02 -0500 [thread overview]
Message-ID: <1299104702-18928-3-git-send-email-vpalatin@chromium.org> (raw)
In-Reply-To: <1299104702-18928-1-git-send-email-vpalatin@chromium.org>
If any of the clients is not ready to receive (ie it has a can_receive
callback and can_receive() returns false), we don't want to start
sending, else this client may miss/discard the packet.
I got this behaviour with the following setup :
the emulated machine is using an USB-ethernet adapter, it is connected
to the network using SLIRP and I'm dumping the traffic in a .pcap file.
As per the following command line :
-net nic,model=usb,vlan=1 -net user,vlan=1 -net dump,vlan=1,file=/tmp/pkt.pcap
Every time that two packets are coming in a row from the host, the
usb-net code will receive the first one, then returns 0 to can_receive
call since it has a 1 packet long queue. But as the dump code is always
ready to receive, qemu_can_send_packet will return true and the next
packet will discard the previous one in the usb-net code.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
---
net.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net.c b/net.c
index ec4745d..72ac4cf 100644
--- a/net.c
+++ b/net.c
@@ -411,11 +411,11 @@ int qemu_can_send_packet(VLANClientState *sender)
}
/* no can_receive() handler, they can always receive */
- if (!vc->info->can_receive || vc->info->can_receive(vc)) {
- return 1;
+ if (vc->info->can_receive && !vc->info->can_receive(vc)) {
+ return 0;
}
}
- return 0;
+ return 1;
}
static ssize_t qemu_deliver_packet(VLANClientState *sender,
--
1.7.3.1
prev parent reply other threads:[~2011-03-02 22:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-02 22:25 [Qemu-devel] net: small fixes Vincent Palatin
2011-03-02 22:25 ` [Qemu-devel] [PATCH 1/2] net: fix trace when debug is activated in slirp Vincent Palatin
2011-03-03 9:18 ` Stefan Hajnoczi
2011-03-05 12:18 ` Blue Swirl
2011-03-02 22:25 ` Vincent Palatin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1299104702-18928-3-git-send-email-vpalatin@chromium.org \
--to=vpalatin@chromium.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).