aboutsummaryrefslogtreecommitdiff
path: root/sys/cam
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2023-07-21 04:22:37 +0000
committerWarner Losh <imp@FreeBSD.org>2023-07-21 04:32:31 +0000
commit774ab87cf27beb3669693f14b9c89ebaf542eaf3 (patch)
tree47ca55ac95780a5ff9d1ce1f24c4044053f0ea45 /sys/cam
parent0732617ec174854c0875bb7171d850473c61569f (diff)
downloadsrc-774ab87cf27beb3669693f14b9c89ebaf542eaf3.tar.gz
src-774ab87cf27beb3669693f14b9c89ebaf542eaf3.zip
cam: Add CAM_NVME_STATUS_ERROR error code
Add CAM_NVME_STATUS_ERROR error code. Flag all NVME commands that completed with an error status as CAM_NVME_STATUS_ERROR (a new value) instaead of CAM_REQ_CMP_ERR. This indicates to the upper layers of CAM that the 'cpl' field for nvmeio CCBs is valid and can be examined for error recovery, if desired. No functional change. nda will still see these as errors, call ndaerror() to get the error recovery action, etc. cam_periph_error will select the same case as before (even w/o the change, though the change makes it explicit). Sponsored by: Netflix Reviewed by: chuck, mav, jhb Differential Revision: https://reviews.freebsd.org/D41085
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/cam.h7
-rw-r--r--sys/cam/cam_periph.c1
-rw-r--r--sys/cam/nvme/nvme_da.c1
3 files changed, 8 insertions, 1 deletions
diff --git a/sys/cam/cam.h b/sys/cam/cam.h
index 99f7b6a7f5c2..eacf3a248ce9 100644
--- a/sys/cam/cam.h
+++ b/sys/cam/cam.h
@@ -240,7 +240,12 @@ typedef enum {
CAM_REQ_SOFTTIMEOUT = 0x1f,
/*
- * 0x20 - 0x32 are unassigned
+ * NVME error, look at errro code in CCB
+ */
+ CAM_NVME_STATUS_ERROR = 0x20,
+
+ /*
+ * 0x21 - 0x32 are unassigned
*/
/* Initiator Detected Error */
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index fe256e84cd2c..8defdc9ecbe6 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -1996,6 +1996,7 @@ cam_periph_error(union ccb *ccb, cam_flags camflags,
relsim_flags = RELSIM_RELEASE_AFTER_TIMEOUT;
/* FALLTHROUGH */
case CAM_ATA_STATUS_ERROR:
+ case CAM_NVME_STATUS_ERROR:
case CAM_SMP_STATUS_ERROR:
case CAM_REQ_CMP_ERR:
case CAM_CMD_TIMEOUT:
diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
index f2fb1b79f452..9beef786f320 100644
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -1285,6 +1285,7 @@ ndaerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags)
#endif
break;
case CAM_REQ_CMP_ERR:
+ case CAM_NVME_STATUS_ERROR:
#ifdef CAM_IO_STATS
softc->errors++;
#endif