Commit 13f7510f authored by Changpeng Liu's avatar Changpeng Liu Committed by Jim Harris
Browse files

nvmf/ctrlr: save AER commands ID



When doing live migration we need to restore the AER commands
in the destination VM, so here to provide an API to save
these CIDs and the transport layer can save the value.

After migration in destination VM, we should allocate
new AER requests based on CIDs in vfio-user.

Change-Id: I5881f833bbfacb0f030a2b135b4dd47726240378
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10040


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
parent 61dadf29
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1903,6 +1903,25 @@ nvmf_ctrlr_set_features_number_of_queues(struct spdk_nvmf_request *req)
	return SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE;
}

int
nvmf_ctrlr_save_aers(struct spdk_nvmf_ctrlr *ctrlr, uint16_t *aer_cids,
		     uint16_t max_aers)
{
	struct spdk_nvmf_request *req;
	uint16_t i;

	if (!aer_cids || max_aers < ctrlr->nr_aer_reqs) {
		return -EINVAL;
	}

	for (i = 0; i < ctrlr->nr_aer_reqs; i++) {
		req = ctrlr->aer_req[i];
		aer_cids[i] = req->cmd->nvme_cmd.cid;
	}

	return ctrlr->nr_aer_reqs;
}

static int
nvmf_ctrlr_set_features_async_event_configuration(struct spdk_nvmf_request *req)
{
+2 −0
Original line number Diff line number Diff line
@@ -449,6 +449,8 @@ void nvmf_ctrlr_reservation_notice_log(struct spdk_nvmf_ctrlr *ctrlr,
 * the host to send a subsequent AER.
 */
void nvmf_ctrlr_abort_aer(struct spdk_nvmf_ctrlr *ctrlr);
int nvmf_ctrlr_save_aers(struct spdk_nvmf_ctrlr *ctrlr, uint16_t *aer_cids,
			 uint16_t max_aers);

/*
 * Abort zero-copy requests that already got the buffer (received zcopy_start cb), but haven't