All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ilya Maximets <i.maximets@samsung.com>
Cc: dev@dpdk.org, Jingjing Wu <jingjing.wu@intel.com>,
	Konstantin Ananyev <konstantin.ananyev@intel.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>,
	Xiao Wang <xiao.w.wang@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>
Subject: Re: [PATCH v1 1/2] eal: add nanosleep based delay function
Date: Wed, 5 Sep 2018 14:10:59 +0100	[thread overview]
Message-ID: <20180905141059.5218b455@shemminger-XPS-13-9360> (raw)
In-Reply-To: <20180903144615eucas1p1d7377fa285a86f522f29c2a9528a638e~Q6xtl-i3s2361123611eucas1p1Q@eucas1p1.samsung.com>

On Mon,  3 Sep 2018 17:47:42 +0300
Ilya Maximets <i.maximets@samsung.com> 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.

  reply	other threads:[~2018-09-05 13:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180831124358eucas1p22a0f8a7d0ae34dfad73b3b9e819366ec@eucas1p2.samsung.com>
2018-08-31 12:45 ` [RFC 0/2] CPU non-blocking delay Ilya Maximets
2018-08-31 13:01   ` Bruce Richardson
2018-08-31 13:39   ` Bruce Richardson
2018-09-03 14:41     ` Ilya Maximets
     [not found]   ` <CGME20180903144311eucas1p2b6499c49dbd0d54334e973113cdc5ad6@eucas1p2.samsung.com>
2018-09-03 14:44     ` [PATCH v1 " Ilya Maximets
     [not found]       ` <CGME20180903144615eucas1p1d7377fa285a86f522f29c2a9528a638e@eucas1p1.samsung.com>
2018-09-03 14:47         ` [PATCH v1 1/2] eal: add nanosleep based delay function Ilya Maximets
2018-09-05 13:10           ` Stephen Hemminger [this message]
2018-09-10 15:11             ` Ilya Maximets
     [not found]       ` <CGME20180903144704eucas1p1d469c23bc22f25af27f00d94aaf8a660@eucas1p1.samsung.com>
2018-09-03 14:48         ` [PATCH v1 2/2] drivers/net: use sleep delay by default for intel NICs Ilya Maximets
     [not found]       ` <CGME20180914105928eucas1p2be05dc93e02df94e895de24d5564927c@eucas1p2.samsung.com>
2018-09-14 11:01         ` [PATCH v2 0/2] CPU non-blocking delay Ilya Maximets
     [not found]           ` <CGME20180914105950eucas1p1391d6eccd8ccd5a03e7f742f1d12bb9d@eucas1p1.samsung.com>
2018-09-14 11:01             ` [PATCH v2 1/2] eal: add nanosleep based delay function Ilya Maximets
     [not found]           ` <CGME20180914105954eucas1p1662492cee6b5387cd4655ec940619ea8@eucas1p1.samsung.com>
2018-09-14 11:01             ` [PATCH v2 2/2] drivers/net: use sleep delay by default for intel NICs Ilya Maximets
2018-09-28 11:38           ` [PATCH v2 0/2] CPU non-blocking delay Ilya Maximets
     [not found]           ` <CGME20181004143338eucas1p2690a63adeb26785846ad0ea71b695215@eucas1p2.samsung.com>
2018-10-04 14:35             ` [PATCH v3 " Ilya Maximets
     [not found]               ` <CGME20181004143343eucas1p2e4d18dbed12ac9cebc6ea1af599f751a@eucas1p2.samsung.com>
2018-10-04 14:35                 ` [PATCH v3 1/2] eal: add nanosleep based delay function Ilya Maximets
     [not found]               ` <CGME20181004143345eucas1p2f9dfea7ea41111c2ce9cab98434339d0@eucas1p2.samsung.com>
2018-10-04 14:35                 ` [PATCH v3 2/2] drivers/net: use sleep delay by default for intel NICs Ilya Maximets
     [not found]               ` <CGME20181010140956eucas1p2720bbf053c9dd0ebbafbc99bb1dd6e1d@eucas1p2.samsung.com>
2018-10-10 14:12                 ` [PATCH v4 0/2] CPU non-blocking delay Ilya Maximets
     [not found]                   ` <CGME20181010141003eucas1p23e7bdfaad8cd676549f1cae42b6a8e40@eucas1p2.samsung.com>
2018-10-10 14:12                     ` [PATCH v4 1/2] eal: add nanosleep based delay function Ilya Maximets
     [not found]                   ` <CGME20181010141007eucas1p2a8039d5e180738a93a8b1e2991d68220@eucas1p2.samsung.com>
2018-10-10 14:12                     ` [PATCH v4 2/2] drivers/net: use sleep delay by default for intel NICs Ilya Maximets
2018-10-25 13:27                   ` [PATCH v4 0/2] CPU non-blocking delay Ferruh Yigit
2018-10-26 14:23                     ` Ferruh Yigit
2018-10-05 14:09       ` [PATCH v1 " Wiles, Keith
2018-10-05 14:44         ` Ilya Maximets
2018-10-05 15:04           ` Wiles, Keith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180905141059.5218b455@shemminger-XPS-13-9360 \
    --to=stephen@networkplumber.org \
    --cc=beilei.xing@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=i.maximets@samsung.com \
    --cc=jingjing.wu@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=wenzhuo.lu@intel.com \
    --cc=xiao.w.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.