Christoph Hellwig | 8638b24 | 2019-02-18 09:33:28 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2016 Avago Technologies. All rights reserved. |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | /* |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 7 | * This file contains definitions relative to FC-NVME-2 r1.06 |
| 8 | * (T11-2019-00210-v001). |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #ifndef _NVME_FC_H |
| 12 | #define _NVME_FC_H 1 |
| 13 | |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 14 | #include <uapi/scsi/fc/fc_fs.h> |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 15 | |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 16 | #define NVME_CMD_FORMAT_ID 0xFD |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 17 | #define NVME_CMD_FC_ID FC_TYPE_NVME |
| 18 | |
| 19 | /* FC-NVME Cmd IU Flags */ |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 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 | } |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 45 | |
| 46 | struct nvme_fc_cmd_iu { |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 47 | __u8 format_id; |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 48 | __u8 fc_id; |
| 49 | __be16 iu_len; |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 50 | __u8 rsvd4[2]; |
| 51 | __u8 rsv_cat; |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 52 | __u8 flags; |
| 53 | __be64 connection_id; |
| 54 | __be32 csn; |
| 55 | __be32 data_len; |
| 56 | struct nvme_command sqe; |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 57 | __u8 dps; |
| 58 | __u8 lbads; |
| 59 | __be16 ms; |
| 60 | __be32 rsvd92; |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | #define NVME_FC_SIZEOF_ZEROS_RSP 12 |
| 64 | |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 65 | enum { |
| 66 | FCNVME_SC_SUCCESS = 0, |
| 67 | FCNVME_SC_INVALID_FIELD = 1, |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 68 | /* reserved 2 */ |
| 69 | FCNVME_SC_ILL_CONN_PARAMS = 3, |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 70 | }; |
| 71 | |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 72 | struct nvme_fc_ersp_iu { |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 73 | __u8 ersp_result; |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 74 | __u8 rsvd1; |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 75 | __be16 iu_len; |
| 76 | __be32 rsn; |
| 77 | __be32 xfrd_len; |
| 78 | __be32 rsvd12; |
| 79 | struct nvme_completion cqe; |
| 80 | /* for now - no additional payload */ |
| 81 | }; |
| 82 | |
| 83 | |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 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) */ |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 114 | enum { |
| 115 | FCNVME_LS_RSVD = 0, |
| 116 | FCNVME_LS_RJT = 1, |
| 117 | FCNVME_LS_ACC = 2, |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 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 */ |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 122 | }; |
| 123 | |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 124 | /* FC-NVME Link Service Descriptors */ |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 125 | enum { |
| 126 | FCNVME_LSDESC_RSVD = 0x0, |
| 127 | FCNVME_LSDESC_RQST = 0x1, |
| 128 | FCNVME_LSDESC_RJT = 0x2, |
| 129 | FCNVME_LSDESC_CREATE_ASSOC_CMD = 0x3, |
| 130 | FCNVME_LSDESC_CREATE_CONN_CMD = 0x4, |
| 131 | FCNVME_LSDESC_DISCONN_CMD = 0x5, |
| 132 | FCNVME_LSDESC_CONN_ID = 0x6, |
| 133 | FCNVME_LSDESC_ASSOC_ID = 0x7, |
| 134 | }; |
| 135 | |
| 136 | |
| 137 | /* ********** start of Link Service Descriptors ********** */ |
| 138 | |
| 139 | |
| 140 | /* |
| 141 | * fills in length of a descriptor. Struture minus descriptor header |
| 142 | */ |
| 143 | static inline __be32 fcnvme_lsdesc_len(size_t sz) |
| 144 | { |
| 145 | return cpu_to_be32(sz - (2 * sizeof(u32))); |
| 146 | } |
| 147 | |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 148 | struct fcnvme_ls_rqst_w0 { |
| 149 | u8 ls_cmd; /* FCNVME_LS_xxx */ |
| 150 | u8 zeros[3]; |
| 151 | }; |
| 152 | |
| 153 | /* FCNVME_LSDESC_RQST */ |
| 154 | struct fcnvme_lsdesc_rqst { |
| 155 | __be32 desc_tag; /* FCNVME_LSDESC_xxx */ |
| 156 | __be32 desc_len; |
| 157 | struct fcnvme_ls_rqst_w0 w0; |
| 158 | __be32 rsvd12; |
| 159 | }; |
| 160 | |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 161 | /* FC-NVME LS RJT reason_code values */ |
| 162 | enum fcnvme_ls_rjt_reason { |
| 163 | FCNVME_RJT_RC_NONE = 0, |
| 164 | /* no reason - not to be sent */ |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 165 | |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 166 | FCNVME_RJT_RC_INVAL = 0x01, |
| 167 | /* invalid NVMe_LS command code */ |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 168 | |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 169 | FCNVME_RJT_RC_LOGIC = 0x03, |
| 170 | /* logical error */ |
| 171 | |
| 172 | FCNVME_RJT_RC_UNAB = 0x09, |
| 173 | /* unable to perform command request */ |
| 174 | |
| 175 | FCNVME_RJT_RC_UNSUP = 0x0b, |
| 176 | /* command not supported */ |
| 177 | |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 178 | FCNVME_RJT_RC_INV_ASSOC = 0x40, |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 179 | /* Invalid Association ID */ |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 180 | |
| 181 | FCNVME_RJT_RC_INV_CONN = 0x41, |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 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 */ |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 189 | |
| 190 | FCNVME_RJT_RC_VENDOR = 0xff, |
| 191 | /* vendor specific error */ |
| 192 | }; |
| 193 | |
| 194 | /* FC-NVME LS RJT reason_explanation values */ |
| 195 | enum fcnvme_ls_rjt_explan { |
| 196 | FCNVME_RJT_EXP_NONE = 0x00, |
| 197 | /* No additional explanation */ |
| 198 | |
| 199 | FCNVME_RJT_EXP_OXID_RXID = 0x17, |
| 200 | /* invalid OX_ID-RX_ID combination */ |
| 201 | |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 202 | FCNVME_RJT_EXP_UNAB_DATA = 0x2a, |
| 203 | /* unable to supply requested data */ |
| 204 | |
| 205 | FCNVME_RJT_EXP_INV_LEN = 0x2d, |
| 206 | /* Invalid payload length */ |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 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 */ |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 228 | }; |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 229 | |
| 230 | /* FCNVME_LSDESC_RJT */ |
| 231 | struct fcnvme_lsdesc_rjt { |
| 232 | __be32 desc_tag; /* FCNVME_LSDESC_xxx */ |
| 233 | __be32 desc_len; |
| 234 | u8 rsvd8; |
| 235 | |
| 236 | /* |
| 237 | * Reject reason and explanaction codes are generic |
| 238 | * to ELs's from LS-3. |
| 239 | */ |
James Smart | 0f222cc | 2017-03-23 20:41:22 -0700 | [diff] [blame] | 240 | u8 reason_code; /* fcnvme_ls_rjt_reason */ |
| 241 | u8 reason_explanation; /* fcnvme_ls_rjt_explan */ |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 242 | |
| 243 | u8 vendor; |
| 244 | __be32 rsvd12; |
| 245 | }; |
| 246 | |
| 247 | |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 248 | #define FCNVME_ASSOC_HOSTNQN_LEN 256 |
| 249 | #define FCNVME_ASSOC_SUBNQN_LEN 256 |
| 250 | |
| 251 | /* FCNVME_LSDESC_CREATE_ASSOC_CMD */ |
| 252 | struct fcnvme_lsdesc_cr_assoc_cmd { |
| 253 | __be32 desc_tag; /* FCNVME_LSDESC_xxx */ |
| 254 | __be32 desc_len; |
| 255 | __be16 ersp_ratio; |
| 256 | __be16 rsvd10; |
| 257 | __be32 rsvd12[9]; |
| 258 | __be16 cntlid; |
| 259 | __be16 sqsize; |
| 260 | __be32 rsvd52; |
Christoph Hellwig | 8e41226 | 2017-05-17 09:54:27 +0200 | [diff] [blame] | 261 | uuid_t hostid; |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 262 | u8 hostnqn[FCNVME_ASSOC_HOSTNQN_LEN]; |
| 263 | u8 subnqn[FCNVME_ASSOC_SUBNQN_LEN]; |
James Smart | d1438ad | 2017-07-07 18:08:25 -0700 | [diff] [blame] | 264 | __be32 rsvd584[108]; /* pad to 1016 bytes, |
| 265 | * which makes overall LS rqst |
| 266 | * payload 1024 bytes |
| 267 | */ |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 268 | }; |
| 269 | |
James Smart | d1438ad | 2017-07-07 18:08:25 -0700 | [diff] [blame] | 270 | #define FCNVME_LSDESC_CRA_CMD_DESC_MINLEN \ |
| 271 | offsetof(struct fcnvme_lsdesc_cr_assoc_cmd, rsvd584) |
| 272 | |
| 273 | #define FCNVME_LSDESC_CRA_CMD_DESC_MIN_DESCLEN \ |
| 274 | (FCNVME_LSDESC_CRA_CMD_DESC_MINLEN - \ |
| 275 | offsetof(struct fcnvme_lsdesc_cr_assoc_cmd, ersp_ratio)) |
| 276 | |
| 277 | |
| 278 | |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 279 | /* FCNVME_LSDESC_CREATE_CONN_CMD */ |
| 280 | struct fcnvme_lsdesc_cr_conn_cmd { |
| 281 | __be32 desc_tag; /* FCNVME_LSDESC_xxx */ |
| 282 | __be32 desc_len; |
| 283 | __be16 ersp_ratio; |
| 284 | __be16 rsvd10; |
| 285 | __be32 rsvd12[9]; |
| 286 | __be16 qid; |
| 287 | __be16 sqsize; |
| 288 | __be32 rsvd52; |
| 289 | }; |
| 290 | |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 291 | /* FCNVME_LSDESC_DISCONN_CMD */ |
| 292 | struct fcnvme_lsdesc_disconn_cmd { |
| 293 | __be32 desc_tag; /* FCNVME_LSDESC_xxx */ |
| 294 | __be32 desc_len; |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 295 | __be32 rsvd8[4]; |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 296 | }; |
| 297 | |
| 298 | /* FCNVME_LSDESC_CONN_ID */ |
| 299 | struct fcnvme_lsdesc_conn_id { |
| 300 | __be32 desc_tag; /* FCNVME_LSDESC_xxx */ |
| 301 | __be32 desc_len; |
| 302 | __be64 connection_id; |
| 303 | }; |
| 304 | |
| 305 | /* FCNVME_LSDESC_ASSOC_ID */ |
| 306 | struct fcnvme_lsdesc_assoc_id { |
| 307 | __be32 desc_tag; /* FCNVME_LSDESC_xxx */ |
| 308 | __be32 desc_len; |
| 309 | __be64 association_id; |
| 310 | }; |
| 311 | |
| 312 | /* r_ctl values */ |
| 313 | enum { |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 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, |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 322 | }; |
| 323 | |
| 324 | |
| 325 | /* ********** start of Link Services ********** */ |
| 326 | |
| 327 | |
| 328 | /* FCNVME_LS_RJT */ |
| 329 | struct fcnvme_ls_rjt { |
| 330 | struct fcnvme_ls_rqst_w0 w0; |
| 331 | __be32 desc_list_len; |
| 332 | struct fcnvme_lsdesc_rqst rqst; |
| 333 | struct fcnvme_lsdesc_rjt rjt; |
| 334 | }; |
| 335 | |
| 336 | /* FCNVME_LS_ACC */ |
| 337 | struct fcnvme_ls_acc_hdr { |
| 338 | struct fcnvme_ls_rqst_w0 w0; |
| 339 | __be32 desc_list_len; |
| 340 | struct fcnvme_lsdesc_rqst rqst; |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 341 | /* |
| 342 | * Followed by cmd-specific ACCEPT descriptors, see xxx_acc |
| 343 | * definitions below |
| 344 | */ |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 345 | }; |
| 346 | |
| 347 | /* FCNVME_LS_CREATE_ASSOCIATION */ |
| 348 | struct fcnvme_ls_cr_assoc_rqst { |
| 349 | struct fcnvme_ls_rqst_w0 w0; |
| 350 | __be32 desc_list_len; |
| 351 | struct fcnvme_lsdesc_cr_assoc_cmd assoc_cmd; |
| 352 | }; |
| 353 | |
James Smart | d1438ad | 2017-07-07 18:08:25 -0700 | [diff] [blame] | 354 | #define FCNVME_LSDESC_CRA_RQST_MINLEN \ |
| 355 | (offsetof(struct fcnvme_ls_cr_assoc_rqst, assoc_cmd) + \ |
| 356 | FCNVME_LSDESC_CRA_CMD_DESC_MINLEN) |
| 357 | |
| 358 | #define FCNVME_LSDESC_CRA_RQST_MIN_LISTLEN \ |
| 359 | FCNVME_LSDESC_CRA_CMD_DESC_MINLEN |
| 360 | |
| 361 | |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 362 | struct fcnvme_ls_cr_assoc_acc { |
| 363 | struct fcnvme_ls_acc_hdr hdr; |
| 364 | struct fcnvme_lsdesc_assoc_id associd; |
| 365 | struct fcnvme_lsdesc_conn_id connectid; |
| 366 | }; |
| 367 | |
| 368 | |
| 369 | /* FCNVME_LS_CREATE_CONNECTION */ |
| 370 | struct fcnvme_ls_cr_conn_rqst { |
| 371 | struct fcnvme_ls_rqst_w0 w0; |
| 372 | __be32 desc_list_len; |
| 373 | struct fcnvme_lsdesc_assoc_id associd; |
| 374 | struct fcnvme_lsdesc_cr_conn_cmd connect_cmd; |
| 375 | }; |
| 376 | |
| 377 | struct fcnvme_ls_cr_conn_acc { |
| 378 | struct fcnvme_ls_acc_hdr hdr; |
| 379 | struct fcnvme_lsdesc_conn_id connectid; |
| 380 | }; |
| 381 | |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 382 | /* FCNVME_LS_DISCONNECT_ASSOC */ |
| 383 | struct fcnvme_ls_disconnect_assoc_rqst { |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 384 | struct fcnvme_ls_rqst_w0 w0; |
| 385 | __be32 desc_list_len; |
| 386 | struct fcnvme_lsdesc_assoc_id associd; |
| 387 | struct fcnvme_lsdesc_disconn_cmd discon_cmd; |
| 388 | }; |
| 389 | |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 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 { |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 404 | struct fcnvme_ls_acc_hdr hdr; |
| 405 | }; |
| 406 | |
| 407 | |
| 408 | /* |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 409 | * Default R_A_TOV is pulled in from fc_fs.h but needs conversion |
| 410 | * from ms to seconds for our use. |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 411 | */ |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 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 |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 415 | |
James Smart | 9c5358e | 2017-07-17 13:59:39 -0700 | [diff] [blame] | 416 | /* |
| 417 | * TRADDR string must be of form "nn-<16hexdigits>:pn-<16hexdigits>" |
| 418 | * the string is allowed to be specified with or without a "0x" prefix |
| 419 | * infront of the <16hexdigits>. Without is considered the "min" string |
| 420 | * and with is considered the "max" string. The hexdigits may be upper |
| 421 | * or lower case. |
James Smart | f165836 | 2019-09-27 14:51:34 -0700 | [diff] [blame] | 422 | * Note: FC-NVME-2 standard requires a "0x" prefix. |
James Smart | 9c5358e | 2017-07-17 13:59:39 -0700 | [diff] [blame] | 423 | */ |
| 424 | #define NVME_FC_TRADDR_NNLEN 3 /* "?n-" */ |
| 425 | #define NVME_FC_TRADDR_OXNNLEN 5 /* "?n-0x" */ |
| 426 | #define NVME_FC_TRADDR_HEXNAMELEN 16 |
| 427 | #define NVME_FC_TRADDR_MINLENGTH \ |
| 428 | (2 * (NVME_FC_TRADDR_NNLEN + NVME_FC_TRADDR_HEXNAMELEN) + 1) |
| 429 | #define NVME_FC_TRADDR_MAXLENGTH \ |
| 430 | (2 * (NVME_FC_TRADDR_OXNNLEN + NVME_FC_TRADDR_HEXNAMELEN) + 1) |
| 431 | #define NVME_FC_TRADDR_MIN_PN_OFFSET \ |
| 432 | (NVME_FC_TRADDR_NNLEN + NVME_FC_TRADDR_HEXNAMELEN + 1) |
| 433 | #define NVME_FC_TRADDR_MAX_PN_OFFSET \ |
| 434 | (NVME_FC_TRADDR_OXNNLEN + NVME_FC_TRADDR_HEXNAMELEN + 1) |
| 435 | |
James Smart | b1ad1475 | 2016-12-02 00:28:40 -0800 | [diff] [blame] | 436 | |
| 437 | #endif /* _NVME_FC_H */ |