nvmf: move qid check to nvmf_ctrlr_add_io_qpair
The max qid check is only needed in the add_io_qpair function, since an admin qpair could never fail this check. Upcoming patches will retry a duplicate QID check after a short period of time. This patch helps make the upcoming code path more clear, since there is no need to do this max qid check more than once. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I95f69fc39ae7989d51d36b0d04b5d9a4087a7c4a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17360 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
This commit is contained in:
parent
70885bd62c
commit
3b54b0d70a
@ -216,15 +216,6 @@ ctrlr_add_qpair_and_update_rsp(struct spdk_nvmf_qpair *qpair,
|
|||||||
{
|
{
|
||||||
assert(ctrlr->admin_qpair->group->thread == spdk_get_thread());
|
assert(ctrlr->admin_qpair->group->thread == spdk_get_thread());
|
||||||
|
|
||||||
/* check if we would exceed ctrlr connection limit */
|
|
||||||
if (qpair->qid >= spdk_bit_array_capacity(ctrlr->qpair_mask)) {
|
|
||||||
SPDK_ERRLOG("Requested QID %u but Max QID is %u\n",
|
|
||||||
qpair->qid, spdk_bit_array_capacity(ctrlr->qpair_mask) - 1);
|
|
||||||
rsp->status.sct = SPDK_NVME_SCT_COMMAND_SPECIFIC;
|
|
||||||
rsp->status.sc = SPDK_NVME_SC_INVALID_QUEUE_IDENTIFIER;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (spdk_bit_array_get(ctrlr->qpair_mask, qpair->qid)) {
|
if (spdk_bit_array_get(ctrlr->qpair_mask, qpair->qid)) {
|
||||||
SPDK_ERRLOG("Got I/O connect with duplicate QID %u\n", qpair->qid);
|
SPDK_ERRLOG("Got I/O connect with duplicate QID %u\n", qpair->qid);
|
||||||
rsp->status.sct = SPDK_NVME_SCT_COMMAND_SPECIFIC;
|
rsp->status.sct = SPDK_NVME_SCT_COMMAND_SPECIFIC;
|
||||||
@ -592,6 +583,15 @@ nvmf_ctrlr_add_io_qpair(void *ctx)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check if we would exceed ctrlr connection limit */
|
||||||
|
if (qpair->qid >= spdk_bit_array_capacity(ctrlr->qpair_mask)) {
|
||||||
|
SPDK_ERRLOG("Requested QID %u but Max QID is %u\n",
|
||||||
|
qpair->qid, spdk_bit_array_capacity(ctrlr->qpair_mask) - 1);
|
||||||
|
rsp->status.sct = SPDK_NVME_SCT_COMMAND_SPECIFIC;
|
||||||
|
rsp->status.sc = SPDK_NVME_SC_INVALID_QUEUE_IDENTIFIER;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
ctrlr_add_qpair_and_update_rsp(qpair, ctrlr, rsp);
|
ctrlr_add_qpair_and_update_rsp(qpair, ctrlr, rsp);
|
||||||
end:
|
end:
|
||||||
spdk_nvmf_request_complete(req);
|
spdk_nvmf_request_complete(req);
|
||||||
|
Loading…
Reference in New Issue
Block a user