From a15573c47c362c116d37c0400fd57dc606507b14 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 22 Feb 2016 15:17:13 -0700 Subject: [PATCH] nvme: don't reset already-disabled controllers In nvme_ctrlr_hw_reset(), if we encounter a controller whose CC.EN bit is already 0 (controller is disabled), the previous code would enable the controller just so that it could be disabled to get a full reset (transition from CC.EN = 1 to CC.EN = 0). However, it is a safe assumption that if CC.EN is already 0, the controller has just been reset, so we don't need to reset it again. This saves a significant amount of time (2+ seconds per controller with Intel SSD DC P3700) during initialization for devices that were disabled on startup. Change-Id: I552b1f0f185a84a8a0ce57a93b012d9d5fe096f3 Signed-off-by: Daniel Verkamp --- lib/nvme/nvme_ctrlr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 1afc937f8..d26213211 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -394,11 +394,11 @@ nvme_ctrlr_hw_reset(struct spdk_nvme_ctrlr *ctrlr) } } else { /* - * Ensure we do a transition from cc.en==1 to cc.en==0. - * If we started disabled (cc.en==0), then we have to enable - * first to get a reset. + * The controller was already disabled. We will assume that nothing + * has been changed since cc.en was set to 0, + * meaning that we don't need to do an extra reset, and we can just + * re-enable the controller. */ - nvme_ctrlr_enable(ctrlr); } nvme_ctrlr_disable(ctrlr);