From: Thomas Huth <thuth@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.4] net-hub: Drop can_receive
Date: Tue, 30 Jun 2015 08:19:02 +0200 [thread overview]
Message-ID: <20150630081902.0c65837f@thh440s> (raw)
In-Reply-To: <1435631360-4978-1-git-send-email-famz@redhat.com>
On Tue, 30 Jun 2015 10:29:20 +0800
Fam Zheng <famz@redhat.com> wrote:
> It returns true as long as there is another attached port. This is not
> strictly necessary because even if there is only one port (the sender),
> net_hub_port_receive could succeed with a NOP. So always deliver the
> packets, instead of queuing them.
>
> This fixes the possible hanging issue after net layer changed how
> can_read is handled. That is, if net_hub_port_can_receive returned
> false, the peer would disable the queue until it's explicitly flushed
> (for example, a call to qemu_flush_queued_packets() in net_hub_add_port,
> where net_hub_port_can_receive() would become true). This patch avoids
> that complication.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
> net/hub.c | 20 --------------------
> 1 file changed, 20 deletions(-)
>
> diff --git a/net/hub.c b/net/hub.c
> index 3047f12..65a8e09 100644
> --- a/net/hub.c
> +++ b/net/hub.c
> @@ -87,25 +87,6 @@ static NetHub *net_hub_new(int id)
> return hub;
> }
>
> -static int net_hub_port_can_receive(NetClientState *nc)
> -{
> - NetHubPort *port;
> - NetHubPort *src_port = DO_UPCAST(NetHubPort, nc, nc);
> - NetHub *hub = src_port->hub;
> -
> - QLIST_FOREACH(port, &hub->ports, next) {
> - if (port == src_port) {
> - continue;
> - }
> -
> - if (qemu_can_send_packet(&port->nc)) {
> - return 1;
> - }
> - }
> -
> - return 0;
> -}
> -
> static ssize_t net_hub_port_receive(NetClientState *nc,
> const uint8_t *buf, size_t len)
> {
> @@ -132,7 +113,6 @@ static void net_hub_port_cleanup(NetClientState *nc)
> static NetClientInfo net_hub_port_info = {
> .type = NET_CLIENT_OPTIONS_KIND_HUBPORT,
> .size = sizeof(NetHubPort),
> - .can_receive = net_hub_port_can_receive,
> .receive = net_hub_port_receive,
> .receive_iov = net_hub_port_receive_iov,
> .cleanup = net_hub_port_cleanup,
Sounds reasonable.
Reviewed-by: Thomas Huth <thuth@redhat.com>
next prev parent reply other threads:[~2015-06-30 6:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 2:29 [Qemu-devel] [PATCH for-2.4] net-hub: Drop can_receive Fam Zheng
2015-06-30 6:19 ` Thomas Huth [this message]
2015-07-02 12:27 ` Stefan Hajnoczi
2015-07-02 13:30 ` Stefan Hajnoczi
2015-07-03 0:42 ` Fam Zheng
2015-07-03 10:28 ` Stefan Hajnoczi
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=20150630081902.0c65837f@thh440s \
--to=thuth@redhat.com \
--cc=famz@redhat.com \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).