From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by dpdk.org (Postfix) with ESMTP id 25F954F94 for ; Wed, 5 Sep 2018 15:11:03 +0200 (CEST) Received: by mail-ed1-f66.google.com with SMTP id a20-v6so6029502edd.4 for ; Wed, 05 Sep 2018 06:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=89T2BJ/8sWCDkdN1VM/ULD0fG/wW5ur6rBKR+z1E9qY=; b=AoNp3Kz6XlCtrupqFcD87FLKBx+93ipV3COWHkl4pkEnB6n3FfRRRouY/MqUOItyVA s+mTqiA2iTNA5bwX5IBMOeFTfh1pphkK0s4A086D7BYf5/Wd4m675lOiLIAFZqtDbWjn FBUIDVuLqjdmYfxMF0A3wcOW/NDDzWnzXQJgjUO29E+T2pgoTRzz+ihDTgbOuIs/BIkr u7iOhO0BdmxUUmQ8LuB7QtvdRpAQYQudMO9k++fk+/J+ZIZ7mc2JAz7aT5rZX79oR04G BGFVO9Dr188RlonLGca4SDXmEfTGHipwZBUSigPLM42Vk186OlPRe99359QxZ9wesEN5 +uBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=89T2BJ/8sWCDkdN1VM/ULD0fG/wW5ur6rBKR+z1E9qY=; b=At9F40k/GR1tsZSqWG6nJIGGxzFvyd8YTmMmLvyX2bYG0Adcc/EfMUE5ihY7Aa3tvv +C+6z4bwXdNDbATtV8l44DAOBGJW4AciHCBt/SUk8zXcjalsqCvuXu48hpRInM0MKRYW AkVwMSkIf81veiNMXIjbgO1u2eDZfTlPxYVybQWHsRh+wQokHW8n4lu0a8QAbcPrZM4+ K5v93gfU3kOBpjBUkK7Czbpetn7Jz0vSEHs2CbCFhCl9DGr2xWa0v1fhql3Ya8PF8G1s 50O0Jk9IXO/n1nCrt/ux450d9kHEs25brz4aZfeGfQ1M6NsKmjyTYLxs2qNpCH4lTkr7 uNPw== X-Gm-Message-State: APzg51Dqx2ykldRah41KDNt0wx6IPLxxLUep4p4Klt9dEDVbgJlh2GuB veDciE3yggZ/JHVsiI2QScdgiQ== X-Google-Smtp-Source: ANB0VdYQ3H5U+ImFFSCImf9EVC2tz1mWFAqdlCpcslaoJGq99N29Zp1uJiXX6fkYwXe6YQnE31KUWA== X-Received: by 2002:a50:b4db:: with SMTP id x27-v6mr41266040edd.155.1536153062597; Wed, 05 Sep 2018 06:11:02 -0700 (PDT) Received: from shemminger-XPS-13-9360 ([31.216.236.195]) by smtp.gmail.com with ESMTPSA id x44-v6sm1049725edd.1.2018.09.05.06.11.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Sep 2018 06:11:02 -0700 (PDT) Date: Wed, 5 Sep 2018 14:10:59 +0100 From: Stephen Hemminger To: Ilya Maximets Cc: dev@dpdk.org, Jingjing Wu , Konstantin Ananyev , Wenzhuo Lu , Beilei Xing , Qi Zhang , Xiao Wang , Bruce Richardson Message-ID: <20180905141059.5218b455@shemminger-XPS-13-9360> In-Reply-To: <20180903144615eucas1p1d7377fa285a86f522f29c2a9528a638e~Q6xtl-i3s2361123611eucas1p1Q@eucas1p1.samsung.com> References: <20180903144311eucas1p2b6499c49dbd0d54334e973113cdc5ad6~Q6vBsFYRm1033710337eucas1p2D@eucas1p2.samsung.com> <20180903144615eucas1p1d7377fa285a86f522f29c2a9528a638e~Q6xtl-i3s2361123611eucas1p1Q@eucas1p1.samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v1 1/2] eal: add nanosleep based delay function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2018 13:11:03 -0000 On Mon, 3 Sep 2018 17:47:42 +0300 Ilya Maximets wrote: > > +void __rte_experimental > +rte_delay_us_sleep(unsigned int us) > +{ > + struct timespec wait[2]; > + int ind = 0; > + > + wait[0].tv_sec = 0; > + if (us >= US_PER_S) { > + wait[0].tv_sec = us / US_PER_S; > + us -= wait[0].tv_sec * US_PER_S; > + } > + wait[0].tv_nsec = 1000 * us; > + > + while (nanosleep(&wait[ind], &wait[1 - ind]) == EINTR) > + ind = 1 - ind; > +} > + This seems like a complex/tricky way to handle the case where nanosleep is interrupted. It needs a comment.