From bfa9931b3a2972124072d83358938253280d3635 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Fri, 24 Jun 2016 17:26:21 -0700 Subject: [PATCH] nvmf: remove Create/Delete I/O SQ/CQ commands These are not supported (and did not actually function) in NVMe over Fabrics. Queue creation is handled automatically when new connections are initiated. Change-Id: If3a10e5df2f0625537b2c453cd8c835e570fa31e Signed-off-by: Daniel Verkamp --- lib/nvmf/request.c | 110 +++++---------------------------------------- lib/nvmf/session.h | 8 ---- 2 files changed, 10 insertions(+), 108 deletions(-) diff --git a/lib/nvmf/request.c b/lib/nvmf/request.c index 6831e5463..b4614295d 100644 --- a/lib/nvmf/request.c +++ b/lib/nvmf/request.c @@ -163,106 +163,6 @@ nvmf_process_admin_cmd(struct nvmf_request *req) rc = -1; } break; - case SPDK_NVME_OPC_DELETE_IO_SQ: { - uint16_t qid = cmd->cdw10 & 0xffff; - SPDK_TRACELOG(SPDK_TRACE_NVMF, "Delete IO SQ, QID %x\n", qid); - - if (qid >= MAX_SESSION_IO_QUEUES) { - SPDK_TRACELOG(SPDK_TRACE_NVMF, " Exceeded Session QP Index Limit\n"); - response->status.sc = SPDK_NVME_SC_INVALID_FIELD; - rc = -1; - } else if (session->qps[qid].sq_active == 0) { - SPDK_TRACELOG(SPDK_TRACE_NVMF, " Session SQ QP Index %x was not active!\n", qid); - response->status.sc = SPDK_NVME_SC_INVALID_FIELD; - rc = -1; - } else { - session->qps[qid].sq_size = 0; - session->qps[qid].sq_active = 0; - if (session->qps[qid].cq_active) - session->active_queues--; - rc = 1; - } - } - break; - case SPDK_NVME_OPC_DELETE_IO_CQ: { - uint16_t qid = cmd->cdw10 & 0xffff; - SPDK_TRACELOG(SPDK_TRACE_NVMF, "Delete IO CQ, QID %x\n", qid); - - if (qid >= MAX_SESSION_IO_QUEUES) { - SPDK_TRACELOG(SPDK_TRACE_NVMF, " Exceeded Session QP Index Limit\n"); - response->status.sc = SPDK_NVME_SC_INVALID_FIELD; - rc = -1; - } else if (session->qps[qid].cq_active == 0) { - SPDK_TRACELOG(SPDK_TRACE_NVMF, " Session CQ QP Index %x was not active!\n", qid); - response->status.sc = SPDK_NVME_SC_INVALID_FIELD; - rc = -1; - } else { - session->qps[qid].cq_size = 0; - session->qps[qid].cq_active = 0; - if (session->qps[qid].sq_active) - session->active_queues--; - rc = 1; - } - } - break; - case SPDK_NVME_OPC_CREATE_IO_SQ: - SPDK_TRACELOG(SPDK_TRACE_NVMF, "Create IO SQ\n"); - /* queues have already been initialized for this session. - so for now save details in the session for which QPs - the remote host attempts to enable. - */ - { - uint16_t qid = cmd->cdw10 & 0xffff; - uint16_t qsize = cmd->cdw10 >> 16; - SPDK_TRACELOG(SPDK_TRACE_NVMF, " QID %x, Queue Size %x, CDW11 %x\n", - qid, qsize, cmd->cdw11); - - if (qid >= MAX_SESSION_IO_QUEUES) { - SPDK_TRACELOG(SPDK_TRACE_NVMF, " Exceeded Session QP Index Limit\n"); - response->status.sc = SPDK_NVME_SC_INVALID_FIELD; - rc = -1; - } else if (session->qps[qid].sq_active > 0) { - SPDK_TRACELOG(SPDK_TRACE_NVMF, " Session SQ QP Index %x Already active!\n", qid); - response->status.sc = SPDK_NVME_SC_INVALID_FIELD; - rc = -1; - } else { - session->qps[qid].sq_size = qsize; - session->qps[qid].sq_active = 1; - if (session->qps[qid].cq_active) - session->active_queues++; - rc = 1; - } - } - break; - case SPDK_NVME_OPC_CREATE_IO_CQ: - SPDK_TRACELOG(SPDK_TRACE_NVMF, "Create IO CQ\n"); - /* queues have already been initialized for this session. - so for now save details in the session for which QPs - the remote host attempts to enable. - */ - { - uint16_t qid = cmd->cdw10 & 0xffff; - uint16_t qsize = cmd->cdw10 >> 16; - SPDK_TRACELOG(SPDK_TRACE_NVMF, " QID %x, Queue Size %x, CDW11 %x\n", - qid, qsize, cmd->cdw11); - - if (qid >= MAX_SESSION_IO_QUEUES) { - SPDK_TRACELOG(SPDK_TRACE_NVMF, " Exceeded Session QP Index Limit\n"); - response->status.sc = SPDK_NVME_SC_INVALID_FIELD; - rc = -1; - } else if (session->qps[qid].cq_active > 0) { - SPDK_TRACELOG(SPDK_TRACE_NVMF, " Session CQ QP Index %x Already active!\n", qid); - response->status.sc = SPDK_NVME_SC_INVALID_FIELD; - rc = -1; - } else { - session->qps[qid].cq_size = qsize; - session->qps[qid].cq_active = 1; - if (session->qps[qid].sq_active) - session->active_queues++; - rc = 1; - } - } - break; case SPDK_NVME_OPC_GET_FEATURES: feature = cmd->cdw10 & 0xff; /* mask out the FID value */ switch (feature) { @@ -329,6 +229,16 @@ nvmf_process_admin_cmd(struct nvmf_request *req) //session->keep_alive_timestamp = ; rc = 1; /* immediate completion */ break; + + case SPDK_NVME_OPC_CREATE_IO_SQ: + case SPDK_NVME_OPC_CREATE_IO_CQ: + case SPDK_NVME_OPC_DELETE_IO_SQ: + case SPDK_NVME_OPC_DELETE_IO_CQ: + SPDK_ERRLOG("Admin opc 0x%02X not allowed in NVMf\n", cmd->opc); + response->status.sc = SPDK_NVME_SC_INVALID_OPCODE; + rc = -1; + break; + default: passthrough: SPDK_TRACELOG(SPDK_TRACE_NVMF, "RAW Passthrough: Admin Opcode %x for ctrlr %p\n", diff --git a/lib/nvmf/session.h b/lib/nvmf/session.h index 2a07a4fa1..78989bf5b 100644 --- a/lib/nvmf/session.h +++ b/lib/nvmf/session.h @@ -56,13 +56,6 @@ struct nvmf_connection_entry { /* define a virtual controller limit to the number of QPs supported */ #define MAX_SESSION_IO_QUEUES 64 -struct nvmf_io_queue { - uint16_t sq_size; - uint16_t sq_active; - uint16_t cq_size; - uint16_t cq_active; -}; - struct nvmf_vc_features { uint32_t arb; /* arbitration */ uint32_t pm; /* power management */ @@ -92,7 +85,6 @@ struct nvmf_session { uint16_t cntlid; uint32_t max_io_queues; /* maximum supported by backend NVMe library */ - struct nvmf_io_queue qps[MAX_SESSION_IO_QUEUES]; int active_queues; int is_valid; struct spdk_nvmf_ctrlr_properties vcprop; /* virtual controller properties */