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 <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-02-22 15:17:13 -07:00
parent 4cb05719bd
commit a15573c47c

View File

@ -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);