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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10040
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
This commit is contained in:
Changpeng Liu 2021-10-28 18:02:32 +08:00 committed by Jim Harris
parent 61dadf29d1
commit 13f7510f1a
2 changed files with 21 additions and 0 deletions

View File

@ -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)
{

View File

@ -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