From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: Ravi Kerur <rkerur@gmail.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v9 2/3] Move common functions in eal_timer.c
Date: Mon, 27 Jul 2015 01:40:26 +0200 [thread overview]
Message-ID: <18444292.n7c28FrYlF@xps13> (raw)
In-Reply-To: <1437852990-6096-2-git-send-email-rkerur@gmail.com>
2015-07-25 12:36, Ravi Kerur
> static int
> set_tsc_freq_from_sysctl(void)
> {
> size_t sz;
> int tmp;
> + uint64_t tsc_hz;
>
> sz = sizeof(tmp);
> tmp = 0;
> @@ -94,42 +77,23 @@ set_tsc_freq_from_sysctl(void)
> else if (tmp != 1)
> RTE_LOG(WARNING, EAL, "TSC is not invariant\n");
>
> - sz = sizeof(eal_tsc_resolution_hz);
> - if (sysctlbyname("machdep.tsc_freq", &eal_tsc_resolution_hz, &sz, NULL, 0)) {
> + sz = sizeof(tsc_hz);
> + if (sysctlbyname("machdep.tsc_freq", &tsc_hz, &sz, NULL, 0)) {
> RTE_LOG(WARNING, EAL, "%s\n", strerror(errno));
> return -1;
> }
> + rte_set_tsc_hz(tsc_hz);
>
> return 0;
> }
[...]
> --- /dev/null
> +++ b/lib/librte_eal/common/eal_common_timer.c
> +void
> +rte_set_tsc_hz(uint64_t tsc_hz)
> +{
> + eal_tsc_resolution_hz = tsc_hz;
> +}
[...]
> +void
> +set_tsc_freq(void)
> +{
> + if (set_tsc_freq_from_clock() < 0)
> + set_tsc_freq_fallback();
It would be simpler to get value from return of these functions
and store it in eal_tsc_resolution_hz here.
next prev parent reply other threads:[~2015-07-26 23:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-25 19:34 [dpdk-dev] [PATCH v9 0/3] Move EAL common functions Ravi Kerur
2015-07-25 19:36 ` [dpdk-dev] [PATCH v9 1/3] Move common functions in eal_lcore.c Ravi Kerur
2015-07-25 19:36 ` [dpdk-dev] [PATCH v9 2/3] Move common functions in eal_timer.c Ravi Kerur
2015-07-26 23:32 ` Thomas Monjalon
2015-07-26 23:40 ` Thomas Monjalon [this message]
2015-07-25 19:36 ` [dpdk-dev] [PATCH v9 3/3] Move common functions in eal_memory.c Ravi Kerur
2015-07-27 0:35 ` Thomas Monjalon
2015-07-25 19:36 ` [dpdk-dev] [PATCH v9 0/3] Move EAL common functions Ravi Kerur
2015-07-27 0:56 ` [dpdk-dev] [PATCH v10 0/3] deduplicate " Thomas Monjalon
2015-07-27 0:56 ` [dpdk-dev] [PATCH v10 1/3] eal: deduplicate lcore initialization Thomas Monjalon
2015-07-27 0:56 ` [dpdk-dev] [PATCH v10 2/3] eal: deduplicate timer functions Thomas Monjalon
2015-07-27 0:56 ` [dpdk-dev] [PATCH v10 3/3] eal: deduplicate memory initialization Thomas Monjalon
2015-07-27 0:59 ` [dpdk-dev] [PATCH v10 0/3] deduplicate EAL common functions Thomas Monjalon
2015-07-30 8:12 ` Olivier MATZ
2015-07-30 12:15 ` Ravi Kerur
2015-07-30 13:43 ` Thomas Monjalon
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=18444292.n7c28FrYlF@xps13 \
--to=thomas.monjalon@6wind.com \
--cc=dev@dpdk.org \
--cc=rkerur@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).