From 073f2dd8f28d4ced17ea736535919ff8e314f6cf Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Mon, 15 Oct 2018 15:38:11 -0700 Subject: [PATCH] nvme: do not retry AER if ASYNC_LIMIT_EXCEEDED received This indicates an out-of-spec device, so just print an error message but don't bother retrying the AER. While here, add status code type (sct) check for the other status code check when an AER fails - it is not enough to compare just the status code. Signed-off-by: Jim Harris Change-Id: Ibd26549aa08d3eb4814c239b6b2c6fe95e069a54 Reviewed-on: https://review.gerrithub.io/429533 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker --- lib/nvme/nvme_ctrlr.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 7a1674e4f..d92615cbd 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -1437,7 +1437,8 @@ nvme_ctrlr_async_event_cb(void *arg, const struct spdk_nvme_cpl *cpl) union spdk_nvme_async_event_completion event; int rc; - if (cpl->status.sc == SPDK_NVME_SC_ABORTED_SQ_DELETION) { + if (cpl->status.sct == SPDK_NVME_SCT_GENERIC && + cpl->status.sc == SPDK_NVME_SC_ABORTED_SQ_DELETION) { /* * This is simulated when controller is being shut down, to * effectively abort outstanding asynchronous event requests @@ -1447,6 +1448,18 @@ nvme_ctrlr_async_event_cb(void *arg, const struct spdk_nvme_cpl *cpl) return; } + if (cpl->status.sct == SPDK_NVME_SCT_COMMAND_SPECIFIC && + cpl->status.sc == SPDK_NVME_SC_ASYNC_EVENT_REQUEST_LIMIT_EXCEEDED) { + /* + * SPDK will only send as many AERs as the device says it supports, + * so this status code indicates an out-of-spec device. Do not repost + * the request in this case. + */ + SPDK_ERRLOG("Controller appears out-of-spec for asynchronous event request\n" + "handling. Do not repost this AER.\n"); + return; + } + event.raw = cpl->cdw0; if ((event.bits.async_event_type == SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE) && (event.bits.async_event_info == SPDK_NVME_ASYNC_EVENT_NS_ATTR_CHANGED)) {