From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCuYj-0000hK-0w for qemu-devel@nongnu.org; Fri, 23 Aug 2013 12:50:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCuYc-0008A9-IH for qemu-devel@nongnu.org; Fri, 23 Aug 2013 12:50:00 -0400 Received: from goliath.siemens.de ([192.35.17.28]:27813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCuYc-000899-8w for qemu-devel@nongnu.org; Fri, 23 Aug 2013 12:49:54 -0400 Message-ID: <521792AB.7090909@siemens.com> Date: Fri, 23 Aug 2013 18:49:47 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1377051352-23499-1-git-send-email-pingfank@linux.vnet.ibm.com> <1377051352-23499-4-git-send-email-pingfank@linux.vnet.ibm.com> <15639A5F7F3F28E754294165@nimrod.local> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 3/3] slirp: set mainloop timeout with more precise value List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liu ping fan Cc: Paolo Bonzini , Stefan Hajnoczi , qemu-devel@nongnu.org, Alex Bligh On 2013-08-21 10:07, liu ping fan wrote: > On Wed, Aug 21, 2013 at 3:36 PM, Alex Bligh wrote: >> >> >> --On 21 August 2013 10:15:52 +0800 Liu Ping Fan wrote: >> >>> -void slirp_update_timeout(uint32_t *timeout) >>> +static void slirp_update_timeout(uint32_t *timeout) >>> { >>> - if (!QTAILQ_EMPTY(&slirp_instances)) { >>> - *timeout = MIN(1000, *timeout); >> >> >> If you are putting things in macros, you might as well change that > > TIMEOUT_FAST/SLOW have definite meaning, and used more than one place > in the code. For 1000ms, I do not know this magic value's meaning, but > whatever, it just occurs once. So there is no trouble to read the > code. You could name it ONE_SEC or so. Can be done as trivial patch on top. IIRC, slirp requires regular polling for the aging of certain requests like DNS. Jan > >> 1000 as well, and hopefully comment why that particular magic value >> is there. >> >> >>> + Slirp *slirp; >>> + uint32_t t; >>> + >>> + *timeout = MIN(1000, *timeout); >>> + if (*timeout <= TIMEOUT_FAST) { >>> + return; >>> + } >>> + t = *timeout; >> >> >> >> >> -- >> Alex Bligh -- Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux