Commit 7c3a6d8c authored by Ben Walker's avatar Ben Walker
Browse files

env: Move tsc functions to env.



Change-Id: Ieb1caabd76b1af9fdc7a95698ae09c86dce134bd
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 2832b216
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -61,6 +61,21 @@ spdk_zmalloc(size_t size, size_t align, uint64_t *phys_addr);
void
spdk_free(void *buf);

/**
 * Get a monotonic timestamp counter.
 */
uint64_t spdk_get_ticks(void);

/**
 * Get the tick rate of spdk_get_ticks() per second.
 */
uint64_t spdk_get_ticks_hz(void);

/**
 * Delay the given number of microseconds
 */
void spdk_delay_us(unsigned int us);

#define SPDK_VTOPHYS_ERROR	(0xFFFFFFFFFFFFFFFFULL)

uint64_t spdk_vtophys(void *buf);
+16 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include <string.h>

#include <rte_config.h>
#include <rte_cycles.h>
#include <rte_malloc.h>

void *
@@ -54,3 +55,18 @@ spdk_free(void *buf)
{
	return rte_free(buf);
}

uint64_t spdk_get_ticks(void)
{
	return rte_get_timer_cycles();
}

uint64_t spdk_get_ticks_hz(void)
{
	return rte_get_timer_hz();
}

void spdk_delay_us(unsigned int us)
{
	return rte_delay_us(us);
}
+1 −8
Original line number Diff line number Diff line
@@ -4,17 +4,10 @@
#include <pthread.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <rte_config.h>
#include <rte_malloc.h>
#include <rte_atomic.h>
#include <rte_cycles.h>

#include "spdk/assert.h"
#include "spdk/env.h"

#include <rte_pci.h>

/**
 * \file
 *
@@ -44,6 +37,6 @@
/**
 * Delay us.
 */
#define ioat_delay_us(us)        rte_delay_us(us)
#define ioat_delay_us                   spdk_delay_us

#endif /* __IOAT_IMPL_H__ */
+2 −6
Original line number Diff line number Diff line
@@ -54,15 +54,11 @@
#include <unistd.h>
#include <stdbool.h>
#include <rte_config.h>
#include <rte_cycles.h>
#include <rte_malloc.h>
#include <rte_mempool.h>
#include <rte_version.h>
#include <rte_memzone.h>
#include <rte_eal.h>

#include <rte_pci.h>

#include "spdk/pci_ids.h"

/**
@@ -193,11 +189,11 @@ nvme_mempool_put(nvme_mempool_t *mp, void *buf)
/**
 * Get a monotonic timestamp counter (used for measuring timeouts during initialization).
 */
#define nvme_get_tsc()			rte_get_timer_cycles()
#define nvme_get_tsc()			spdk_get_ticks()

/**
 * Get the tick rate of nvme_get_tsc() per second.
 */
#define nvme_get_tsc_hz()		rte_get_timer_hz()
#define nvme_get_tsc_hz()		spdk_get_ticks_hz()

#endif /* __NVME_IMPL_H__ */