[PATCH RFC V2 1/7] nvme: add definitions for cancel command
Maurizio Lombardi
mlombard at redhat.com
Thu Sep 12 01:15:04 PDT 2024
From: John Meneghini <jmeneghi at redhat.com>
Add new definitions needed to support TP4097a.
Signed-off-by: John Meneghini <jmeneghi at redhat.com>
Signed-off-by: Maurizio Lombardi <mlombard at redhat.com>
---
drivers/nvme/host/constants.c | 1 +
drivers/nvme/host/core.c | 1 +
include/linux/nvme.h | 22 ++++++++++++++++++++++
3 files changed, 24 insertions(+)
diff --git a/drivers/nvme/host/constants.c b/drivers/nvme/host/constants.c
index 2b9e6cfaf2a8..ff6e965b372d 100644
--- a/drivers/nvme/host/constants.c
+++ b/drivers/nvme/host/constants.c
@@ -19,6 +19,7 @@ static const char * const nvme_ops[] = {
[nvme_cmd_resv_report] = "Reservation Report",
[nvme_cmd_resv_acquire] = "Reservation Acquire",
[nvme_cmd_resv_release] = "Reservation Release",
+ [nvme_cmd_cancel] = "Cancel",
[nvme_cmd_zone_mgmt_send] = "Zone Management Send",
[nvme_cmd_zone_mgmt_recv] = "Zone Management Receive",
[nvme_cmd_zone_append] = "Zone Append",
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 983909a600ad..3768b1d778fb 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4964,6 +4964,7 @@ static inline void _nvme_check_size(void)
BUILD_BUG_ON(sizeof(struct nvme_dsm_cmd) != 64);
BUILD_BUG_ON(sizeof(struct nvme_write_zeroes_cmd) != 64);
BUILD_BUG_ON(sizeof(struct nvme_abort_cmd) != 64);
+ BUILD_BUG_ON(sizeof(struct nvme_cancel_cmd) != 64);
BUILD_BUG_ON(sizeof(struct nvme_get_log_page_command) != 64);
BUILD_BUG_ON(sizeof(struct nvme_command) != 64);
BUILD_BUG_ON(sizeof(struct nvme_id_ctrl) != NVME_IDENTIFY_DATA_SIZE);
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 7b2ae2e43544..439f2abb6542 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -28,6 +28,9 @@
/* Special NSSR value, 'NVMe' */
#define NVME_SUBSYS_RESET 0x4E564D65
+/* Maximum number of reserved commands for Cancel */
+#define NVME_RSV_CANCEL_MAX 2
+
enum nvme_subsys_type {
/* Referral to another discovery type target subsystem */
NVME_NQN_DISC = 1,
@@ -844,6 +847,7 @@ enum nvme_opcode {
nvme_cmd_resv_report = 0x0e,
nvme_cmd_resv_acquire = 0x11,
nvme_cmd_resv_release = 0x15,
+ nvme_cmd_cancel = 0x18,
nvme_cmd_zone_mgmt_send = 0x79,
nvme_cmd_zone_mgmt_recv = 0x7a,
nvme_cmd_zone_append = 0x7d,
@@ -1357,6 +1361,22 @@ struct nvme_abort_cmd {
__u32 rsvd11[5];
};
+struct nvme_cancel_cmd {
+ __u8 opcode;
+ __u8 flags;
+ __u16 command_id;
+ __le32 nsid;
+ __u32 rsvd1[8];
+ __le16 sqid;
+ __u16 cid;
+ __u8 action;
+ __u8 rsvd11[3];
+ __u32 rsvd12[4];
+};
+
+#define NVME_CANCEL_ACTION_MUL_CMD 1
+#define NVME_CANCEL_ACTION_SINGLE_CMD 0
+
struct nvme_download_firmware {
__u8 opcode;
__u8 flags;
@@ -1812,6 +1832,7 @@ struct nvme_command {
struct nvme_zone_mgmt_send_cmd zms;
struct nvme_zone_mgmt_recv_cmd zmr;
struct nvme_abort_cmd abort;
+ struct nvme_cancel_cmd cancel;
struct nvme_get_log_page_command get_log_page;
struct nvmf_common_command fabrics;
struct nvmf_connect_command connect;
@@ -1954,6 +1975,7 @@ enum {
NVME_SC_INVALID_PI = 0x181,
NVME_SC_READ_ONLY = 0x182,
NVME_SC_ONCS_NOT_SUPPORTED = 0x183,
+ NVME_SC_INVALID_CID = 0x184,
/*
* I/O Command Set Specific - Fabrics commands:
--
2.43.5
More information about the Linux-nvme
mailing list