nvme/reset: simplify timing logic and shorten test

Change-Id: I070223e25988e9a35a4df91331ea88bc4f7c5f13
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-03-07 15:06:33 -07:00
parent cc0b900e29
commit a606a3ed5c
2 changed files with 4 additions and 3 deletions

View File

@ -34,7 +34,7 @@ timing_exit reserve
#Now test nvme reset function #Now test nvme reset function
timing_enter reset timing_enter reset
$testdir/reset/reset -q 64 -w write -s 4096 -t 15 $testdir/reset/reset -q 64 -w write -s 4096 -t 2
timing_exit reset timing_exit reset
timing_enter sgl timing_enter sgl

View File

@ -271,6 +271,7 @@ work_fn(void *arg)
uint64_t tsc_end = rte_get_timer_cycles() + g_time_in_sec * g_tsc_rate; uint64_t tsc_end = rte_get_timer_cycles() + g_time_in_sec * g_tsc_rate;
struct worker_thread *worker = (struct worker_thread *)arg; struct worker_thread *worker = (struct worker_thread *)arg;
struct ns_worker_ctx *ns_ctx = NULL; struct ns_worker_ctx *ns_ctx = NULL;
bool did_reset = false;
printf("Starting thread on core %u\n", worker->lcore); printf("Starting thread on core %u\n", worker->lcore);
@ -298,8 +299,7 @@ work_fn(void *arg)
ns_ctx = ns_ctx->next; ns_ctx = ns_ctx->next;
} }
if (((tsc_end - rte_get_timer_cycles()) / g_tsc_rate) > (uint64_t)g_time_in_sec / 5 && if (!did_reset && ((tsc_end - rte_get_timer_cycles()) / g_tsc_rate) > (uint64_t)g_time_in_sec / 2) {
((tsc_end - rte_get_timer_cycles()) / g_tsc_rate) < (uint64_t)(g_time_in_sec / 5 + 10)) {
ns_ctx = worker->ns_ctx; ns_ctx = worker->ns_ctx;
while (ns_ctx != NULL) { while (ns_ctx != NULL) {
if (spdk_nvme_ctrlr_reset(ns_ctx->entry->ctrlr) < 0) { if (spdk_nvme_ctrlr_reset(ns_ctx->entry->ctrlr) < 0) {
@ -308,6 +308,7 @@ work_fn(void *arg)
} }
ns_ctx = ns_ctx->next; ns_ctx = ns_ctx->next;
} }
did_reset = true;
} }
if (rte_get_timer_cycles() > tsc_end) { if (rte_get_timer_cycles() > tsc_end) {