History

Merge branch 'for-5.5/drivers' into for-5.5/zoned

* for-5.5/drivers: (38 commits) null_blk: add zone open, close, and finish support dm: add zone open, close and finish support nvme: Fix parsing of ANA log page nvmet: stop using bio_set_op_attrs nvmet: add plugging for read/write when ns is bdev nvmet: clean up command parsing a bit nvme-pci: Spelling s/resdicovered/rediscovered/ nvmet: fill discovery controller sn, fr and mn correctly nvmet: Open code nvmet_req_execute() nvmet: Remove the data_len field from the nvmet_req struct nvmet: Introduce nvmet_dsm_len() helper nvmet: Cleanup discovery execute handlers nvmet: Introduce common execute function for get_log_page and identify nvmet-tcp: Don't set the request's data_len nvmet-tcp: Don't check data_len in nvmet_tcp_map_data() nvme: Introduce nvme_lba_to_sect() nvme: Cleanup and rename nvme_block_nr() nvme: resync include/linux/nvme.h with nvmecli nvme: move common call to nvme_cleanup_cmd to core layer nvme: introduce "Command Aborted By host" status code ...

Jens Axboe committed 7 years ago

Commit d29510d2 parents 6952a7f da644b237 files · +713 −339Browse files

Showing the changes to include/linux (2 of 37 files). Show all

Unified · Split

2 files
  1. include/linux/nvme-fc.h +137 −45
  2. include/linux/nvme.h +51 −3
include/linux/nvme-fc.h+137−45
@@ -4,33 +4,60 @@ · 3 unmodified lines
44 */
55
66 /*
7− * This file contains definitions relative to FC-NVME r1.14 (16-020vB).
8− * The fcnvme_lsdesc_cr_assoc_cmd struct reflects expected r1.16 content.
7+ * This file contains definitions relative to FC-NVME-2 r1.06
8+ * (T11-2019-00210-v001).
99 */
1010
1111 #ifndef _NVME_FC_H
1212 #define _NVME_FC_H 1
1313
14+#include <uapi/scsi/fc/fc_fs.h>
1415
15−#define NVME_CMD_SCSI_ID 0xFD
16+#define NVME_CMD_FORMAT_ID 0xFD
1617 #define NVME_CMD_FC_ID FC_TYPE_NVME
1718
1819 /* FC-NVME Cmd IU Flags */
19−#define FCNVME_CMD_FLAGS_DIRMASK 0x03
20−#define FCNVME_CMD_FLAGS_WRITE 0x01
21−#define FCNVME_CMD_FLAGS_READ 0x02
20+enum {
21+ FCNVME_CMD_FLAGS_DIRMASK = 0x03,
22+ FCNVME_CMD_FLAGS_WRITE = (1 << 0),
23+ FCNVME_CMD_FLAGS_READ = (1 << 1),
24+
25+ FCNVME_CMD_FLAGS_PICWP = (1 << 2),
26+};
27+
28+enum {
29+ FCNVME_CMD_CAT_MASK = 0x0F,
30+ FCNVME_CMD_CAT_ADMINQ = 0x01,
31+ FCNVME_CMD_CAT_CSSMASK = 0x07,
32+ FCNVME_CMD_CAT_CSSFLAG = 0x08,
33+};
34+
35+static inline __u8 fccmnd_set_cat_admin(__u8 rsv_cat)
36+{
37+ return (rsv_cat & ~FCNVME_CMD_CAT_MASK) | FCNVME_CMD_CAT_ADMINQ;
38+}
39+
40+static inline __u8 fccmnd_set_cat_css(__u8 rsv_cat, __u8 css)
41+{
42+ return (rsv_cat & ~FCNVME_CMD_CAT_MASK) | FCNVME_CMD_CAT_CSSFLAG |
43+ (css & FCNVME_CMD_CAT_CSSMASK);
44+}
2245
2346 struct nvme_fc_cmd_iu {
24− __u8 scsi_id;
47+ __u8 format_id;
2548 __u8 fc_id;
2649 __be16 iu_len;
27− __u8 rsvd4[3];
50+ __u8 rsvd4[2];
51+ __u8 rsv_cat;
2852 __u8 flags;
2953 __be64 connection_id;
3054 __be32 csn;
3155 __be32 data_len;
3256 struct nvme_command sqe;
33− __be32 rsvd88[2];
57+ __u8 dps;
58+ __u8 lbads;
59+ __be16 ms;
60+ __be32 rsvd92;
3461 };
3562
3663 #define NVME_FC_SIZEOF_ZEROS_RSP 12
@@ -38,11 +65,12 @@ struct nvme_fc_cmd_iu { · 1 unmodified line
3865 enum {
3966 FCNVME_SC_SUCCESS = 0,
4067 FCNVME_SC_INVALID_FIELD = 1,
41− FCNVME_SC_INVALID_CONNID = 2,
68+ /* reserved 2 */
69+ FCNVME_SC_ILL_CONN_PARAMS = 3,
4270 };
4371
4472 struct nvme_fc_ersp_iu {
45− __u8 status_code;
73+ __u8 ersp_result;
4674 __u8 rsvd1;
4775 __be16 iu_len;
4876 __be32 rsn;
@@ -53,14 +81,44 @@ struct nvme_fc_ersp_iu { · 4 unmodified lines
5381 };
5482
5583
56−/* FC-NVME Link Services */
84+#define FCNVME_NVME_SR_OPCODE 0x01
85+
86+struct nvme_fc_nvme_sr_iu {
87+ __u8 fc_id;
88+ __u8 opcode;
89+ __u8 rsvd2;
90+ __u8 retry_rctl;
91+ __be32 rsvd4;
92+};
93+
94+
95+enum {
96+ FCNVME_SRSTAT_ACC = 0x0,
97+ FCNVME_SRSTAT_INV_FCID = 0x1,
98+ /* reserved 0x2 */
99+ FCNVME_SRSTAT_LOGICAL_ERR = 0x3,
100+ FCNVME_SRSTAT_INV_QUALIF = 0x4,
101+ FCNVME_SRSTAT_UNABL2PERFORM = 0x9,
102+};
103+
104+struct nvme_fc_nvme_sr_rsp_iu {
105+ __u8 fc_id;
106+ __u8 opcode;
107+ __u8 rsvd2;
108+ __u8 status;
109+ __be32 rsvd4;
110+};
111+
112+
113+/* FC-NVME Link Services - LS cmd values (w0 bits 31:24) */
57114 enum {
58115 FCNVME_LS_RSVD = 0,
59116 FCNVME_LS_RJT = 1,
60117 FCNVME_LS_ACC = 2,
61− FCNVME_LS_CREATE_ASSOCIATION = 3,
62− FCNVME_LS_CREATE_CONNECTION = 4,
63− FCNVME_LS_DISCONNECT = 5,
118+ FCNVME_LS_CREATE_ASSOCIATION = 3, /* Create Association */
119+ FCNVME_LS_CREATE_CONNECTION = 4, /* Create I/O Connection */
120+ FCNVME_LS_DISCONNECT_ASSOC = 5, /* Disconnect Association */
121+ FCNVME_LS_DISCONNECT_CONN = 6, /* Disconnect Connection */
64122 };
65123
66124 /* FC-NVME Link Service Descriptors */
@@ -117,14 +175,17 @@ enum fcnvme_ls_rjt_reason { · 50 unmodified lines
117175 FCNVME_RJT_RC_UNSUP = 0x0b,
118176 /* command not supported */
119177
120− FCNVME_RJT_RC_INPROG = 0x0e,
121− /* command already in progress */
122−
123178 FCNVME_RJT_RC_INV_ASSOC = 0x40,
124− /* Invalid Association ID*/
179+ /* Invalid Association ID */
125180
126181 FCNVME_RJT_RC_INV_CONN = 0x41,
127− /* Invalid Connection ID*/
182+ /* Invalid Connection ID */
183+
184+ FCNVME_RJT_RC_INV_PARAM = 0x42,
185+ /* Invalid Parameters */
186+
187+ FCNVME_RJT_RC_INSUF_RES = 0x43,
188+ /* Insufficient Resources */
128189
129190 FCNVME_RJT_RC_VENDOR = 0xff,
130191 /* vendor specific error */
@@ -138,14 +199,32 @@ enum fcnvme_ls_rjt_explan { · 7 unmodified lines
138199 FCNVME_RJT_EXP_OXID_RXID = 0x17,
139200 /* invalid OX_ID-RX_ID combination */
140201
141− FCNVME_RJT_EXP_INSUF_RES = 0x29,
142− /* insufficient resources */
143−
144202 FCNVME_RJT_EXP_UNAB_DATA = 0x2a,
145203 /* unable to supply requested data */
146204
147205 FCNVME_RJT_EXP_INV_LEN = 0x2d,
148206 /* Invalid payload length */
207+
208+ FCNVME_RJT_EXP_INV_ERSP_RAT = 0x40,
209+ /* Invalid NVMe_ERSP Ratio */
210+
211+ FCNVME_RJT_EXP_INV_CTLR_ID = 0x41,
212+ /* Invalid Controller ID */
213+
214+ FCNVME_RJT_EXP_INV_QUEUE_ID = 0x42,
215+ /* Invalid Queue ID */
216+
217+ FCNVME_RJT_EXP_INV_SQSIZE = 0x43,
218+ /* Invalid Submission Queue Size */
219+
220+ FCNVME_RJT_EXP_INV_HOSTID = 0x44,
221+ /* Invalid HOST ID */
222+
223+ FCNVME_RJT_EXP_INV_HOSTNQN = 0x45,
224+ /* Invalid HOSTNQN */
225+
226+ FCNVME_RJT_EXP_INV_SUBNQN = 0x46,
227+ /* Invalid SUBNQN */
149228 };
150229
151230 /* FCNVME_LSDESC_RJT */
@@ -209,21 +288,11 @@ struct fcnvme_lsdesc_cr_conn_cmd { · 57 unmodified lines
209288 __be32 rsvd52;
210289 };
211290
212−/* Disconnect Scope Values */
213−enum {
214− FCNVME_DISCONN_ASSOCIATION = 0,
215− FCNVME_DISCONN_CONNECTION = 1,
216−};
217−
218291 /* FCNVME_LSDESC_DISCONN_CMD */
219292 struct fcnvme_lsdesc_disconn_cmd {
220293 __be32 desc_tag; /* FCNVME_LSDESC_xxx */
221294 __be32 desc_len;
222− u8 rsvd8[3];
223− /* note: scope is really a 1 bit field */
224− u8 scope; /* FCNVME_DISCONN_xxx */
225− __be32 rsvd12;
226− __be64 id;
295+ __be32 rsvd8[4];
227296 };
228297
229298 /* FCNVME_LSDESC_CONN_ID */
@@ -242,9 +311,14 @@ struct fcnvme_lsdesc_assoc_id { · 12 unmodified lines
242311
243312 /* r_ctl values */
244313 enum {
245− FCNVME_RS_RCTL_DATA = 1,
246− FCNVME_RS_RCTL_XFER_RDY = 5,
247− FCNVME_RS_RCTL_RSP = 8,
314+ FCNVME_RS_RCTL_CMND = 0x6,
315+ FCNVME_RS_RCTL_DATA = 0x1,
316+ FCNVME_RS_RCTL_CONF = 0x3,
317+ FCNVME_RS_RCTL_SR = 0x9,
318+ FCNVME_RS_RCTL_XFER_RDY = 0x5,
319+ FCNVME_RS_RCTL_RSP = 0x7,
320+ FCNVME_RS_RCTL_ERSP = 0x8,
321+ FCNVME_RS_RCTL_SR_RSP = 0xA,
248322 };
249323
250324
@@ -264,7 +338,10 @@ struct fcnvme_ls_acc_hdr { · 13 unmodified lines
264338 struct fcnvme_ls_rqst_w0 w0;
265339 __be32 desc_list_len;
266340 struct fcnvme_lsdesc_rqst rqst;
267− /* Followed by cmd-specific ACC descriptors, see next definitions */
341+ /*
342+ * Followed by cmd-specific ACCEPT descriptors, see xxx_acc
343+ * definitions below
344+ */
268345 };
269346
270347 /* FCNVME_LS_CREATE_ASSOCIATION */
@@ -302,25 +379,39 @@ struct fcnvme_ls_cr_conn_acc { · 31 unmodified lines
302379 struct fcnvme_lsdesc_conn_id connectid;
303380 };
304381
305−/* FCNVME_LS_DISCONNECT */
306−struct fcnvme_ls_disconnect_rqst {
382+/* FCNVME_LS_DISCONNECT_ASSOC */
383+struct fcnvme_ls_disconnect_assoc_rqst {
307384 struct fcnvme_ls_rqst_w0 w0;
308385 __be32 desc_list_len;
309386 struct fcnvme_lsdesc_assoc_id associd;
310387 struct fcnvme_lsdesc_disconn_cmd discon_cmd;
311388 };
312389
313−struct fcnvme_ls_disconnect_acc {
390+struct fcnvme_ls_disconnect_assoc_acc {
391+ struct fcnvme_ls_acc_hdr hdr;
392+};
393+
394+
395+/* FCNVME_LS_DISCONNECT_CONN */
396+struct fcnvme_ls_disconnect_conn_rqst {
397+ struct fcnvme_ls_rqst_w0 w0;
398+ __be32 desc_list_len;
399+ struct fcnvme_lsdesc_assoc_id associd;
400+ struct fcnvme_lsdesc_disconn_cmd connectid;
401+};
402+
403+struct fcnvme_ls_disconnect_conn_acc {
314404 struct fcnvme_ls_acc_hdr hdr;
315405 };
316406
317407
318408 /*
319− * Yet to be defined in FC-NVME:
409+ * Default R_A_TOV is pulled in from fc_fs.h but needs conversion
410+ * from ms to seconds for our use.
320411 */
321−#define NVME_FC_CONNECT_TIMEOUT_SEC 2 /* 2 seconds */
322−#define NVME_FC_LS_TIMEOUT_SEC 2 /* 2 seconds */
323−#define NVME_FC_TGTOP_TIMEOUT_SEC 2 /* 2 seconds */
412+#define FC_TWO_TIMES_R_A_TOV (2 * (FC_DEF_R_A_TOV / 1000))
413+#define NVME_FC_LS_TIMEOUT_SEC FC_TWO_TIMES_R_A_TOV
414+#define NVME_FC_TGTOP_TIMEOUT_SEC FC_TWO_TIMES_R_A_TOV
324415
325416 /*
326417 * TRADDR string must be of form "nn-<16hexdigits>:pn-<16hexdigits>"
@@ -328,6 +419,7 @@ struct fcnvme_ls_disconnect_acc { · 1 unmodified line
328419 * infront of the <16hexdigits>. Without is considered the "min" string
329420 * and with is considered the "max" string. The hexdigits may be upper
330421 * or lower case.
422+ * Note: FC-NVME-2 standard requires a "0x" prefix.
331423 */
332424 #define NVME_FC_TRADDR_NNLEN 3 /* "?n-" */
333425 #define NVME_FC_TRADDR_OXNNLEN 5 /* "?n-0x" */
include/linux/nvme.h+51−3
@@ -107,8 +107,22 @@ enum { · 106 unmodified lines
107107 NVME_REG_AQA = 0x0024, /* Admin Queue Attributes */
108108 NVME_REG_ASQ = 0x0028, /* Admin SQ Base Address */
109109 NVME_REG_ACQ = 0x0030, /* Admin CQ Base Address */
110− NVME_REG_CMBLOC = 0x0038, /* Controller Memory Buffer Location */
110+ NVME_REG_CMBLOC = 0x0038, /* Controller Memory Buffer Location */
111111 NVME_REG_CMBSZ = 0x003c, /* Controller Memory Buffer Size */
112+ NVME_REG_BPINFO = 0x0040, /* Boot Partition Information */
113+ NVME_REG_BPRSEL = 0x0044, /* Boot Partition Read Select */
114+ NVME_REG_BPMBL = 0x0048, /* Boot Partition Memory Buffer
115+ * Location
116+ */
117+ NVME_REG_PMRCAP = 0x0e00, /* Persistent Memory Capabilities */
118+ NVME_REG_PMRCTL = 0x0e04, /* Persistent Memory Region Control */
119+ NVME_REG_PMRSTS = 0x0e08, /* Persistent Memory Region Status */
120+ NVME_REG_PMREBS = 0x0e0c, /* Persistent Memory Region Elasticity
121+ * Buffer Size
122+ */
123+ NVME_REG_PMRSWTP = 0x0e10, /* Persistent Memory Region Sustained
124+ * Write Throughput
125+ */
112126 NVME_REG_DBS = 0x1000, /* SQ 0 Tail Doorbell */
113127 };
114128
@@ -295,6 +309,14 @@ enum { · 180 unmodified lines
295309 NVME_CTRL_OACS_DIRECTIVES = 1 << 5,
296310 NVME_CTRL_OACS_DBBUF_SUPP = 1 << 8,
297311 NVME_CTRL_LPA_CMD_EFFECTS_LOG = 1 << 1,
312+ NVME_CTRL_CTRATT_128_ID = 1 << 0,
313+ NVME_CTRL_CTRATT_NON_OP_PSP = 1 << 1,
314+ NVME_CTRL_CTRATT_NVM_SETS = 1 << 2,
315+ NVME_CTRL_CTRATT_READ_RECV_LVLS = 1 << 3,
316+ NVME_CTRL_CTRATT_ENDURANCE_GROUPS = 1 << 4,
317+ NVME_CTRL_CTRATT_PREDICTABLE_LAT = 1 << 5,
318+ NVME_CTRL_CTRATT_NAMESPACE_GRANULARITY = 1 << 7,
319+ NVME_CTRL_CTRATT_UUID_LIST = 1 << 9,
298320 };
299321
300322 struct nvme_lbaf {
@@ -352,6 +374,9 @@ enum { · 51 unmodified lines
352374 NVME_ID_CNS_NS_PRESENT = 0x11,
353375 NVME_ID_CNS_CTRL_NS_LIST = 0x12,
354376 NVME_ID_CNS_CTRL_LIST = 0x13,
377+ NVME_ID_CNS_SCNDRY_CTRL_LIST = 0x15,
378+ NVME_ID_CNS_NS_GRANULARITY = 0x16,
379+ NVME_ID_CNS_UUID_LIST = 0x17,
355380 };
356381
357382 enum {
@@ -409,7 +434,8 @@ struct nvme_smart_log { · 51 unmodified lines
409434 __u8 avail_spare;
410435 __u8 spare_thresh;
411436 __u8 percent_used;
412− __u8 rsvd6[26];
437+ __u8 endu_grp_crit_warn_sumry;
438+ __u8 rsvd7[25];
413439 __u8 data_units_read[16];
414440 __u8 data_units_written[16];
415441 __u8 host_reads[16];
@@ -423,7 +449,11 @@ struct nvme_smart_log { · 7 unmodified lines
423449 __le32 warning_temp_time;
424450 __le32 critical_comp_time;
425451 __le16 temp_sensor[8];
426− __u8 rsvd216[296];
452+ __le32 thm_temp1_trans_count;
453+ __le32 thm_temp2_trans_count;
454+ __le32 thm_temp1_total_time;
455+ __le32 thm_temp2_total_time;
456+ __u8 rsvd232[280];
427457 };
428458
429459 struct nvme_fw_slot_info_log {
@@ -440,6 +470,7 @@ enum { · 10 unmodified lines
440470 NVME_CMD_EFFECTS_NIC = 1 << 3,
441471 NVME_CMD_EFFECTS_CCC = 1 << 4,
442472 NVME_CMD_EFFECTS_CSE_MASK = 3 << 16,
473+ NVME_CMD_EFFECTS_UUID_SEL = 1 << 19,
443474 };
444475
445476 struct nvme_effects_log {
@@ -563,6 +594,7 @@ enum nvme_opcode { · 117 unmodified lines
563594 nvme_cmd_compare = 0x05,
564595 nvme_cmd_write_zeroes = 0x08,
565596 nvme_cmd_dsm = 0x09,
597+ nvme_cmd_verify = 0x0c,
566598 nvme_cmd_resv_register = 0x0d,
567599 nvme_cmd_resv_report = 0x0e,
568600 nvme_cmd_resv_acquire = 0x11,
@@ -806,10 +838,14 @@ enum nvme_admin_opcode { · 237 unmodified lines
806838 nvme_admin_ns_mgmt = 0x0d,
807839 nvme_admin_activate_fw = 0x10,
808840 nvme_admin_download_fw = 0x11,
841+ nvme_admin_dev_self_test = 0x14,
809842 nvme_admin_ns_attach = 0x15,
810843 nvme_admin_keep_alive = 0x18,
811844 nvme_admin_directive_send = 0x19,
812845 nvme_admin_directive_recv = 0x1a,
846+ nvme_admin_virtual_mgmt = 0x1c,
847+ nvme_admin_nvme_mi_send = 0x1d,
848+ nvme_admin_nvme_mi_recv = 0x1e,
813849 nvme_admin_dbbuf = 0x7C,
814850 nvme_admin_format_nvm = 0x80,
815851 nvme_admin_security_send = 0x81,
@@ -873,6 +909,7 @@ enum { · 57 unmodified lines
873909 NVME_FEAT_PLM_CONFIG = 0x13,
874910 NVME_FEAT_PLM_WINDOW = 0x14,
875911 NVME_FEAT_HOST_BEHAVIOR = 0x16,
912+ NVME_FEAT_SANITIZE = 0x17,
876913 NVME_FEAT_SW_PROGRESS = 0x80,
877914 NVME_FEAT_HOST_ID = 0x81,
878915 NVME_FEAT_RESV_MASK = 0x82,
@@ -883,6 +920,10 @@ enum { · 4 unmodified lines
883920 NVME_LOG_FW_SLOT = 0x03,
884921 NVME_LOG_CHANGED_NS = 0x04,
885922 NVME_LOG_CMD_EFFECTS = 0x05,
923+ NVME_LOG_DEVICE_SELF_TEST = 0x06,
924+ NVME_LOG_TELEMETRY_HOST = 0x07,
925+ NVME_LOG_TELEMETRY_CTRL = 0x08,
926+ NVME_LOG_ENDURANCE_GROUP = 0x09,
886927 NVME_LOG_ANA = 0x0c,
887928 NVME_LOG_DISC = 0x70,
888929 NVME_LOG_RESERVATION = 0x80,
@@ -1290,7 +1331,11 @@ enum { · 401 unmodified lines
12901331 NVME_SC_SGL_INVALID_OFFSET = 0x16,
12911332 NVME_SC_SGL_INVALID_SUBTYPE = 0x17,
12921333
1334+ NVME_SC_SANITIZE_FAILED = 0x1C,
1335+ NVME_SC_SANITIZE_IN_PROGRESS = 0x1D,
1336+
12931337 NVME_SC_NS_WRITE_PROTECTED = 0x20,
1338+ NVME_SC_CMD_INTERRUPTED = 0x21,
12941339
12951340 NVME_SC_LBA_RANGE = 0x80,
12961341 NVME_SC_CAP_EXCEEDED = 0x81,
@@ -1328,6 +1373,8 @@ enum { · 31 unmodified lines
13281373 NVME_SC_NS_NOT_ATTACHED = 0x11a,
13291374 NVME_SC_THIN_PROV_NOT_SUPP = 0x11b,
13301375 NVME_SC_CTRL_LIST_INVALID = 0x11c,
1376+ NVME_SC_BP_WRITE_PROHIBITED = 0x11e,
1377+ NVME_SC_PMR_SAN_PROHIBITED = 0x123,
13311378
13321379 /*
13331380 * I/O Command Set Specific - NVM commands:
@@ -1368,6 +1415,7 @@ enum { · 34 unmodified lines
13681415 NVME_SC_ANA_INACCESSIBLE = 0x302,
13691416 NVME_SC_ANA_TRANSITION = 0x303,
13701417 NVME_SC_HOST_PATH_ERROR = 0x370,
1418+ NVME_SC_HOST_ABORTED_CMD = 0x371,
13711419
13721420 NVME_SC_CRD = 0x1800,
13731421 NVME_SC_DNR = 0x4000,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t