nvme/rdma: partly remove CC.EN = 1 hack
The generic NVMe library controller initialization process already handles enabling the controller; the RDMA transport should not need to set EN itself. For now, the discovery controller is cheating and not using the normal initialization process, so move the EN = 1 hack to the discovery controller bringup until it is overhauled to use the full nvme_ctrlr_process_init() path. The previous code where CC.EN was set to 1 before going through the controller init process would cause an EN = 1 to EN = 0 transition, which triggers a controller level reset. This change stops us from causing a reset during the controller startup sequence, which is defined by the NVMe over Fabrics spec as terminating the host/controller association (breaking the connection). Our NVMe over Fabrics target does not yet implement this correctly, but we should still do the right thing in preparation for a full reset implementation. This patch also reverts the NVMe over Fabrics target reset handling hack that was added as part of the NVMe over Fabrics host commit to its previous state of just printing an error message. Change-Id: I0aedd73dfd2dd1168e7b13b79575cc387737d4f0 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
bdf982302e
commit
efca92b85b
@ -1057,7 +1057,6 @@ static int
|
||||
nvme_rdma_ctrlr_construct_admin_qpair(struct spdk_nvme_ctrlr *ctrlr)
|
||||
{
|
||||
struct spdk_nvme_qpair *qpair;
|
||||
union spdk_nvme_cc_register cc = {};
|
||||
int rc;
|
||||
|
||||
qpair = nvme_rdma_ctrlr_create_qpair(ctrlr, 0, 0);
|
||||
@ -1067,16 +1066,6 @@ nvme_rdma_ctrlr_construct_admin_qpair(struct spdk_nvme_ctrlr *ctrlr)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Must enable CC.EN, otherwise we can not send nvme commands to the disabled controller */
|
||||
cc.raw = 0;
|
||||
cc.bits.en = 1;
|
||||
rc = nvme_transport_ctrlr_set_reg_4(ctrlr, offsetof(struct spdk_nvme_registers, cc.raw),
|
||||
cc.raw);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("Failed to set cc\n");
|
||||
rc = -1;
|
||||
goto error;
|
||||
}
|
||||
SPDK_TRACELOG(SPDK_TRACE_DEBUG, "successfully create admin qpair\n");
|
||||
return 0;
|
||||
|
||||
@ -1137,6 +1126,7 @@ nvme_rdma_ctrlr_scan(enum spdk_nvme_transport transport,
|
||||
struct spdk_nvme_probe_info probe_info;
|
||||
struct spdk_nvme_ctrlr *discovery_ctrlr;
|
||||
struct spdk_nvmf_discovery_log_page *log_page;
|
||||
union spdk_nvme_cc_register cc;
|
||||
char buffer[4096];
|
||||
int rc;
|
||||
uint32_t i;
|
||||
@ -1152,10 +1142,22 @@ nvme_rdma_ctrlr_scan(enum spdk_nvme_transport transport,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* TODO: this should be using the normal NVMe controller initialization process */
|
||||
cc.raw = 0;
|
||||
cc.bits.en = 1;
|
||||
rc = nvme_transport_ctrlr_set_reg_4(discovery_ctrlr, offsetof(struct spdk_nvme_registers, cc.raw),
|
||||
cc.raw);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("Failed to set cc\n");
|
||||
nvme_ctrlr_destruct(discovery_ctrlr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = nvme_fabrics_get_log_discovery_page(discovery_ctrlr, buffer);
|
||||
if (rc < 0) {
|
||||
SPDK_ERRLOG("nvme_fabrics_get_log_discovery_page error\n");
|
||||
nvme_ctrlr_destruct(discovery_ctrlr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_page = (struct spdk_nvmf_discovery_log_page *)buffer;
|
||||
|
@ -400,9 +400,7 @@ nvmf_prop_set_cc(struct spdk_nvmf_session *session, uint64_t value)
|
||||
session->vcprop.cc.bits.en = 1;
|
||||
session->vcprop.csts.bits.rdy = 1;
|
||||
} else {
|
||||
/* TODO: reset is not really supported here */
|
||||
session->vcprop.cc.bits.en = 0;
|
||||
session->vcprop.csts.bits.rdy = 0;
|
||||
SPDK_ERRLOG("CC.EN transition from 1 to 0 (reset) not implemented!\n");
|
||||
|
||||
}
|
||||
diff.bits.en = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user