nvme: use poll_group_process_completions in connect_qpair

If a qpair is part of a poll group and it's not configured in the async
mode, it should be using poll group's process_completions variant.

Additionally, connecting qpairs to the poll group was moved up, so that
qpairs are already on the connected qpairs queue when waiting for the
connection to complete.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I08f75bd61a566d1ab60029b6202d9337df75733f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9074
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
This commit is contained in:
Konrad Sztyber 2021-08-03 17:13:26 +02:00 committed by Tomasz Zawadzki
parent 98b483a35e
commit 3ada37faa3
2 changed files with 22 additions and 12 deletions

View File

@ -350,7 +350,7 @@ nvme_transport_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_
}
static void
nvme_transport_connect_qpair_fail(struct spdk_nvme_qpair *qpair)
nvme_transport_connect_qpair_fail(struct spdk_nvme_qpair *qpair, void *unused)
{
struct spdk_nvme_ctrlr *ctrlr = qpair->ctrlr;
@ -380,16 +380,6 @@ nvme_transport_ctrlr_connect_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nv
goto err;
}
if (!qpair->async) {
/* Busy wait until the qpair exits the connecting state */
while (nvme_qpair_get_state(qpair) == NVME_QPAIR_CONNECTING) {
rc = spdk_nvme_qpair_process_completions(qpair, 0);
if (rc < 0) {
goto err;
}
}
}
if (qpair->poll_group) {
rc = nvme_poll_group_connect_qpair(qpair);
if (rc) {
@ -397,9 +387,26 @@ nvme_transport_ctrlr_connect_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nv
}
}
if (!qpair->async) {
/* Busy wait until the qpair exits the connecting state */
while (nvme_qpair_get_state(qpair) == NVME_QPAIR_CONNECTING) {
if (qpair->poll_group) {
rc = spdk_nvme_poll_group_process_completions(
qpair->poll_group->group, 0,
nvme_transport_connect_qpair_fail);
} else {
rc = spdk_nvme_qpair_process_completions(qpair, 0);
}
if (rc < 0) {
goto err;
}
}
}
return 0;
err:
nvme_transport_connect_qpair_fail(qpair);
nvme_transport_connect_qpair_fail(qpair, NULL);
return rc;
}

View File

@ -46,6 +46,9 @@ DEFINE_STUB(spdk_nvme_transport_id_trtype_str, const char *,
(enum spdk_nvme_transport_type trtype), NULL);
DEFINE_STUB(spdk_nvme_qpair_process_completions, int32_t, (struct spdk_nvme_qpair *qpair,
uint32_t max_completions), 0);
DEFINE_STUB(spdk_nvme_poll_group_process_completions, int64_t, (struct spdk_nvme_poll_group *group,
uint32_t completions_per_qpair,
spdk_nvme_disconnected_qpair_cb disconnected_qpair_cb), 0);
static void
ut_construct_transport(struct spdk_nvme_transport *transport, const char name[])