From patchwork Mon Jun 18 16:59:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhiyong Wu X-Patchwork-Id: 165567 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DE431B706A for ; Tue, 19 Jun 2012 04:03:10 +1000 (EST) Received: from localhost ([::1]:33470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SggI8-0004oq-R0 for incoming@patchwork.ozlabs.org; Mon, 18 Jun 2012 14:03:08 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgfLY-00049N-DY for qemu-devel@nongnu.org; Mon, 18 Jun 2012 13:02:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgfLW-0002AQ-EE for qemu-devel@nongnu.org; Mon, 18 Jun 2012 13:02:35 -0400 Received: from e37.co.us.ibm.com ([32.97.110.158]:49862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgfLW-0002AI-7f for qemu-devel@nongnu.org; Mon, 18 Jun 2012 13:02:34 -0400 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Jun 2012 11:02:29 -0600 Received: from d01dlp03.pok.ibm.com (9.56.224.17) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 18 Jun 2012 11:01:37 -0600 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 3BBA4C9005E for ; Mon, 18 Jun 2012 13:01:34 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5IH1ZYB141062 for ; Mon, 18 Jun 2012 13:01:35 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5IMVfCP025936 for ; Mon, 18 Jun 2012 18:31:42 -0400 Received: from us.ibm.com (f15.cn.ibm.com [9.115.118.27]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q5IMVYr6025372; Mon, 18 Jun 2012 18:31:36 -0400 Received: by us.ibm.com (sSMTP sendmail emulation); Tue, 19 Jun 2012 01:00:41 +0800 From: zwu.kernel@gmail.com To: qemu-devel@nongnu.org Date: Tue, 19 Jun 2012 00:59:17 +0800 Message-Id: <1340038759-27796-16-git-send-email-zwu.kernel@gmail.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1340038759-27796-1-git-send-email-zwu.kernel@gmail.com> References: <1340038759-27796-1-git-send-email-zwu.kernel@gmail.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12061817-7408-0000-0000-000005F4F8CA X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.110.158 Cc: pbonzini@redhat.com, aliguori@us.ibm.com, Zhi Yong Wu , stefanha@linux.vnet.ibm.com, jan.kiszka@siemens.com Subject: [Qemu-devel] [PATCH v5 15/17] net: determine if packets can be sent before net queue deliver packets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Zhi Yong Wu Reviewed-by: Paolo Bonzini Signed-off-by: Zhi Yong Wu --- net/queue.c | 8 ++++---- net/slirp.c | 7 ------- slirp/if.c | 5 ----- slirp/libslirp.h | 1 - 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/net/queue.c b/net/queue.c index 0afd783..7484d2a 100644 --- a/net/queue.c +++ b/net/queue.c @@ -176,8 +176,8 @@ ssize_t qemu_net_queue_send(NetQueue *queue, { ssize_t ret; - if (queue->delivering) { - return qemu_net_queue_append(queue, sender, flags, data, size, NULL); + if (queue->delivering || !qemu_can_send_packet(sender)) { + return qemu_net_queue_append(queue, sender, flags, data, size, sent_cb); } ret = qemu_net_queue_deliver(queue, sender, flags, data, size); @@ -200,8 +200,8 @@ ssize_t qemu_net_queue_send_iov(NetQueue *queue, { ssize_t ret; - if (queue->delivering) { - return qemu_net_queue_append_iov(queue, sender, flags, iov, iovcnt, NULL); + if (queue->delivering || !qemu_can_send_packet(sender)) { + return qemu_net_queue_append_iov(queue, sender, flags, iov, iovcnt, sent_cb); } ret = qemu_net_queue_deliver_iov(queue, sender, flags, iov, iovcnt); diff --git a/net/slirp.c b/net/slirp.c index 2df50a8..1e5cabb 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -96,13 +96,6 @@ static void slirp_smb_cleanup(SlirpState *s); static inline void slirp_smb_cleanup(SlirpState *s) { } #endif -int slirp_can_output(void *opaque) -{ - SlirpState *s = opaque; - - return qemu_can_send_packet(&s->nc); -} - void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len) { SlirpState *s = opaque; diff --git a/slirp/if.c b/slirp/if.c index 096cf6f..533295d 100644 --- a/slirp/if.c +++ b/slirp/if.c @@ -177,11 +177,6 @@ void if_start(Slirp *slirp) } while (ifm_next) { - /* check if we can really output */ - if (!slirp_can_output(slirp->opaque)) { - break; - } - ifm = ifm_next; from_batchq = next_from_batchq; diff --git a/slirp/libslirp.h b/slirp/libslirp.h index 77527ad..9b471b5 100644 --- a/slirp/libslirp.h +++ b/slirp/libslirp.h @@ -25,7 +25,6 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds, void slirp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len); /* you must provide the following functions: */ -int slirp_can_output(void *opaque); void slirp_output(void *opaque, const uint8_t *pkt, int pkt_len); int slirp_add_hostfwd(Slirp *slirp, int is_udp,