env: Move tsc functions to env.
Change-Id: Ieb1caabd76b1af9fdc7a95698ae09c86dce134bd Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
2832b2161f
commit
7c3a6d8c43
@ -61,6 +61,21 @@ spdk_zmalloc(size_t size, size_t align, uint64_t *phys_addr);
|
|||||||
void
|
void
|
||||||
spdk_free(void *buf);
|
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)
|
#define SPDK_VTOPHYS_ERROR (0xFFFFFFFFFFFFFFFFULL)
|
||||||
|
|
||||||
uint64_t spdk_vtophys(void *buf);
|
uint64_t spdk_vtophys(void *buf);
|
||||||
|
16
lib/env/env.c
vendored
16
lib/env/env.c
vendored
@ -36,6 +36,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <rte_config.h>
|
#include <rte_config.h>
|
||||||
|
#include <rte_cycles.h>
|
||||||
#include <rte_malloc.h>
|
#include <rte_malloc.h>
|
||||||
|
|
||||||
void *
|
void *
|
||||||
@ -54,3 +55,18 @@ spdk_free(void *buf)
|
|||||||
{
|
{
|
||||||
return rte_free(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);
|
||||||
|
}
|
||||||
|
@ -4,17 +4,10 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdbool.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/assert.h"
|
||||||
#include "spdk/env.h"
|
#include "spdk/env.h"
|
||||||
|
|
||||||
#include <rte_pci.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
*
|
*
|
||||||
@ -44,6 +37,6 @@
|
|||||||
/**
|
/**
|
||||||
* Delay us.
|
* Delay us.
|
||||||
*/
|
*/
|
||||||
#define ioat_delay_us(us) rte_delay_us(us)
|
#define ioat_delay_us spdk_delay_us
|
||||||
|
|
||||||
#endif /* __IOAT_IMPL_H__ */
|
#endif /* __IOAT_IMPL_H__ */
|
||||||
|
@ -54,15 +54,11 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <rte_config.h>
|
#include <rte_config.h>
|
||||||
#include <rte_cycles.h>
|
|
||||||
#include <rte_malloc.h>
|
|
||||||
#include <rte_mempool.h>
|
#include <rte_mempool.h>
|
||||||
#include <rte_version.h>
|
#include <rte_version.h>
|
||||||
#include <rte_memzone.h>
|
#include <rte_memzone.h>
|
||||||
#include <rte_eal.h>
|
#include <rte_eal.h>
|
||||||
|
|
||||||
#include <rte_pci.h>
|
|
||||||
|
|
||||||
#include "spdk/pci_ids.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).
|
* 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.
|
* 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__ */
|
#endif /* __NVME_IMPL_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user