From patchwork Wed Feb 29 19:15:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 143810 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 2FFA2B6EE7 for ; Thu, 1 Mar 2012 06:17:24 +1100 (EST) Received: from localhost ([::1]:38401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2p1d-0008HX-Mn for incoming@patchwork.ozlabs.org; Wed, 29 Feb 2012 14:17:21 -0500 Received: from eggs.gnu.org ([208.118.235.92]:37020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2p1S-0008H4-3t for qemu-devel@nongnu.org; Wed, 29 Feb 2012 14:17:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2p17-0000za-CC for qemu-devel@nongnu.org; Wed, 29 Feb 2012 14:17:09 -0500 Received: from thoth.sbs.de ([192.35.17.2]:31517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2p16-0000yd-Uc for qemu-devel@nongnu.org; Wed, 29 Feb 2012 14:16:49 -0500 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id q1TJFmVS017334; Wed, 29 Feb 2012 20:15:48 +0100 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id q1TJFlH0003174; Wed, 29 Feb 2012 20:15:48 +0100 From: Jan Kiszka To: qemu-devel@nongnu.org Date: Wed, 29 Feb 2012 20:15:44 +0100 Message-Id: <12284987ef94b60989e786ff874d0f127280e7b5.1330542945.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.2 Cc: Stefan Weil , Zhi Yong Wu , Fabien Chouteau Subject: [Qemu-devel] [PATCH 1/4] slirp: Keep next_m always valid 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 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 CC: Zhi Yong Wu CC: Stefan Weil Signed-off-by: Jan Kiszka --- slirp/if.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slirp/if.c b/slirp/if.c index 33f08e1..166852a 100644 --- a/slirp/if.c +++ b/slirp/if.c @@ -96,8 +96,13 @@ if_output(struct socket *so, struct mbuf *ifm) ifs_insque(ifm, ifq->ifs_prev); goto diddit; } - } else + } else { ifq = slirp->if_batchq.ifq_prev; + /* Set next_m if the queue was empty so far */ + if (slirp->next_m == &slirp->if_batchq) { + slirp->next_m = ifm; + } + } /* Create a new doubly linked list for this session */ ifm->ifq_so = so; @@ -170,13 +175,8 @@ void if_start(Slirp *slirp) if (slirp->if_fastq.ifq_next != &slirp->if_fastq) { ifm = slirp->if_fastq.ifq_next; } else { - /* Nothing on fastq, see if next_m is valid */ - if (slirp->next_m != &slirp->if_batchq) { - ifm = slirp->next_m; - } else { - ifm = slirp->if_batchq.ifq_next; - } - + /* Nothing on fastq, pick up from batchq via next_m */ + ifm = slirp->next_m; from_batchq = true; }