]> git.droids-corp.org - dpdk.git/commitdiff
timer: honor arch-specific TSC frequency query
authorJerin Jacob <jerin.jacob@caviumnetworks.com>
Fri, 22 Sep 2017 08:25:37 +0000 (13:55 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 13 Oct 2017 11:07:17 +0000 (13:07 +0200)
When calibrating the TSC frequency, first, probe the architecture specific
function. If not available, use the existing calibrate scheme.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
lib/librte_eal/bsdapp/eal/Makefile
lib/librte_eal/common/arch/arm/rte_cycles.c [new file with mode: 0644]
lib/librte_eal/common/arch/ppc_64/rte_cycles.c [new file with mode: 0644]
lib/librte_eal/common/arch/x86/rte_cycles.c [new file with mode: 0644]
lib/librte_eal/common/eal_common_timer.c
lib/librte_eal/common/eal_private.h
lib/librte_eal/linuxapp/eal/Makefile

index 317a75ebcc2fda6026abacb3bc771e816c65e503..b42306bc301a56fc81434d2675e6234c835812ac 100644 (file)
@@ -92,6 +92,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_service.c
 # from arch dir
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_cpuflags.c
 SRCS-$(CONFIG_RTE_ARCH_X86) += rte_spinlock.c
+SRCS-y += rte_cycles.c
 
 CFLAGS_eal_common_cpuflags.o := $(CPUFLAGS_LIST)
 
diff --git a/lib/librte_eal/common/arch/arm/rte_cycles.c b/lib/librte_eal/common/arch/arm/rte_cycles.c
new file mode 100644 (file)
index 0000000..851fd02
--- /dev/null
@@ -0,0 +1,7 @@
+#include "eal_private.h"
+
+uint64_t
+get_tsc_freq_arch(void)
+{
+       return 0;
+}
diff --git a/lib/librte_eal/common/arch/ppc_64/rte_cycles.c b/lib/librte_eal/common/arch/ppc_64/rte_cycles.c
new file mode 100644 (file)
index 0000000..851fd02
--- /dev/null
@@ -0,0 +1,7 @@
+#include "eal_private.h"
+
+uint64_t
+get_tsc_freq_arch(void)
+{
+       return 0;
+}
diff --git a/lib/librte_eal/common/arch/x86/rte_cycles.c b/lib/librte_eal/common/arch/x86/rte_cycles.c
new file mode 100644 (file)
index 0000000..851fd02
--- /dev/null
@@ -0,0 +1,7 @@
+#include "eal_private.h"
+
+uint64_t
+get_tsc_freq_arch(void)
+{
+       return 0;
+}
index ed0b16d05e804833c68e94403de69937086d5c89..5980b294e7a0406c0ba636b41ad0c2e2d6725355 100644 (file)
@@ -80,8 +80,11 @@ estimate_tsc_freq(void)
 void
 set_tsc_freq(void)
 {
-       uint64_t freq = get_tsc_freq();
+       uint64_t freq;
 
+       freq = get_tsc_freq_arch();
+       if (!freq)
+               freq = get_tsc_freq();
        if (!freq)
                freq = estimate_tsc_freq();
 
index 597d82e4454f1480dd44f3ff0270d006cf65a8af..6e0f85def8d04c6d30d384c708c5e22bdfb958d1 100644 (file)
@@ -314,6 +314,17 @@ void set_tsc_freq(void);
  */
 uint64_t get_tsc_freq(void);
 
+/**
+ * Get TSC frequency if the architecture supports.
+ *
+ * This function is private to the EAL.
+ *
+ * @return
+ *   The number of TSC cycles in one second.
+ *   Returns zero if the architecture support is not available.
+ */
+uint64_t get_tsc_freq_arch(void);
+
 /**
  * Prepare physical memory mapping
  * i.e. hugepages on Linux and
index 21e0b4aad99a80433e8522b37b3612104aaae2ab..140d1acfa7959037cf08ccd4de3328ccbb7b5edd 100644 (file)
@@ -101,6 +101,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_service.c
 # from arch dir
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_cpuflags.c
 SRCS-$(CONFIG_RTE_ARCH_X86) += rte_spinlock.c
+SRCS-y += rte_cycles.c
 
 CFLAGS_eal_common_cpuflags.o := $(CPUFLAGS_LIST)