Received: from eggs.gnu.org ([208.118.235.92]:45174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USn53-00084a-5H for qemu-devel@nongnu.org; Thu, 18 Apr 2013 07:32:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1USn4x-0001GB-Oz for qemu-devel@nongnu.org; Thu, 18 Apr 2013 07:32:45 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:60736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1USn4x-0001Fh-J7 for qemu-devel@nongnu.org; Thu, 18 Apr 2013 07:32:39 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MLG00IU57YFBI90@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Thu, 18 Apr 2013 12:32:34 +0100 (BST) From: Sergey Fedorov Date: Thu, 18 Apr 2013 15:31:55 +0400 Message-id: <1366284715-10107-1-git-send-email-s.fedorov@samsung.com> Subject: [Qemu-devel] [PATCH] net/hub: remove can_receive handler List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Sergey Fedorov , aliguori@us.ibm.com, a.basov@samsung.com, stefanha@redhat.com Network hub should always receive incoming packets. Then forward them to the appropriate port queue and let the qemu_send_packet() do the right things. If the destination queue cannot receive the packet it will be appended to the queue. When the receiver call qemu_flush_queued_packets() later the queue will be really flushed and no packets will be stalled in the sender network queue. Signed-off-by: Sergey Fedorov --- net/hub.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/net/hub.c b/net/hub.c index df32074..552e970 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, -- 1.7.9.5