nvme: extract ready timeout calculation to a function

It will make it easier to set this timeout once the register accesses
are performed asynchronously.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I9d61555a17380ddd57567db8dd912ef6d739fc01
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8612
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Konrad Sztyber 2021-06-24 09:48:08 +02:00 committed by Tomasz Zawadzki
parent 214ed8e37f
commit 38091aade8

View File

@ -1094,6 +1094,12 @@ nvme_ctrlr_shutdown_poll_async(struct spdk_nvme_ctrlr *ctrlr,
return 0;
}
static inline uint64_t
nvme_ctrlr_get_ready_timeout(struct spdk_nvme_ctrlr *ctrlr)
{
return ctrlr->cap.bits.to * 500;
}
static int
nvme_ctrlr_enable(struct spdk_nvme_ctrlr *ctrlr)
{
@ -3384,7 +3390,7 @@ nvme_ctrlr_process_init(struct spdk_nvme_ctrlr *ctrlr)
return -EIO;
}
ready_timeout_in_ms = 500 * ctrlr->cap.bits.to;
ready_timeout_in_ms = nvme_ctrlr_get_ready_timeout(ctrlr);
/*
* Check if the current initialization step is done or has timed out.