0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #ifndef SCSI_SRP_H
0036 #define SCSI_SRP_H
0037
0038
0039
0040
0041
0042
0043
0044 #include <linux/types.h>
0045 #include <scsi/scsi.h>
0046
0047 enum {
0048 SRP_LOGIN_REQ = 0x00,
0049 SRP_TSK_MGMT = 0x01,
0050 SRP_CMD = 0x02,
0051 SRP_I_LOGOUT = 0x03,
0052 SRP_LOGIN_RSP = 0xc0,
0053 SRP_RSP = 0xc1,
0054 SRP_LOGIN_REJ = 0xc2,
0055 SRP_T_LOGOUT = 0x80,
0056 SRP_CRED_REQ = 0x81,
0057 SRP_AER_REQ = 0x82,
0058 SRP_CRED_RSP = 0x41,
0059 SRP_AER_RSP = 0x42
0060 };
0061
0062 enum {
0063 SRP_BUF_FORMAT_DIRECT = 1 << 1,
0064 SRP_BUF_FORMAT_INDIRECT = 1 << 2
0065 };
0066
0067 enum {
0068 SRP_NO_DATA_DESC = 0,
0069 SRP_DATA_DESC_DIRECT = 1,
0070 SRP_DATA_DESC_INDIRECT = 2,
0071 SRP_DATA_DESC_IMM = 3,
0072 };
0073
0074 enum {
0075 SRP_TSK_ABORT_TASK = 0x01,
0076 SRP_TSK_ABORT_TASK_SET = 0x02,
0077 SRP_TSK_CLEAR_TASK_SET = 0x04,
0078 SRP_TSK_LUN_RESET = 0x08,
0079 SRP_TSK_CLEAR_ACA = 0x40
0080 };
0081
0082 enum srp_login_rej_reason {
0083 SRP_LOGIN_REJ_UNABLE_ESTABLISH_CHANNEL = 0x00010000,
0084 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES = 0x00010001,
0085 SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE = 0x00010002,
0086 SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL = 0x00010003,
0087 SRP_LOGIN_REJ_UNSUPPORTED_DESCRIPTOR_FMT = 0x00010004,
0088 SRP_LOGIN_REJ_MULTI_CHANNEL_UNSUPPORTED = 0x00010005,
0089 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED = 0x00010006
0090 };
0091
0092 enum {
0093 SRP_REV10_IB_IO_CLASS = 0xff00,
0094 SRP_REV16A_IB_IO_CLASS = 0x0100
0095 };
0096
0097 struct srp_direct_buf {
0098 __be64 va;
0099 __be32 key;
0100 __be32 len;
0101 };
0102
0103
0104
0105
0106
0107
0108
0109 struct srp_indirect_buf {
0110 struct srp_direct_buf table_desc __packed __aligned(4);
0111 __be32 len;
0112 struct srp_direct_buf desc_list[] __packed __aligned(4);
0113 };
0114
0115
0116 struct srp_imm_buf {
0117 __be32 len;
0118 };
0119
0120
0121 enum {
0122 SRP_MULTICHAN_SINGLE = 0,
0123 SRP_MULTICHAN_MULTI = 1,
0124 SRP_IMMED_REQUESTED = 0x80,
0125 };
0126
0127 struct srp_login_req {
0128 u8 opcode;
0129 u8 reserved1[7];
0130 u64 tag;
0131 __be32 req_it_iu_len;
0132 u8 reserved2[4];
0133 __be16 req_buf_fmt;
0134 u8 req_flags;
0135 u8 reserved3[1];
0136 __be16 imm_data_offset;
0137 u8 reserved4[2];
0138 u8 initiator_port_id[16];
0139 u8 target_port_id[16];
0140 };
0141
0142
0143
0144
0145
0146
0147
0148
0149 struct srp_login_req_rdma {
0150 u64 tag;
0151 __be16 req_buf_fmt;
0152 u8 req_flags;
0153 u8 opcode;
0154 __be32 req_it_iu_len;
0155 u8 initiator_port_id[16];
0156 u8 target_port_id[16];
0157 __be16 imm_data_offset;
0158 u8 reserved[6];
0159 };
0160
0161
0162 enum {
0163 SRP_LOGIN_RSP_MULTICHAN_NO_CHAN = 0x0,
0164 SRP_LOGIN_RSP_MULTICHAN_TERMINATED = 0x1,
0165 SRP_LOGIN_RSP_MULTICHAN_MAINTAINED = 0x2,
0166 SRP_LOGIN_RSP_IMMED_SUPP = 0x80,
0167 };
0168
0169
0170
0171
0172
0173
0174 struct srp_login_rsp {
0175 u8 opcode;
0176 u8 reserved1[3];
0177 __be32 req_lim_delta;
0178 u64 tag __packed __aligned(4);
0179 __be32 max_it_iu_len;
0180 __be32 max_ti_iu_len;
0181 __be16 buf_fmt;
0182 u8 rsp_flags;
0183 u8 reserved2[25];
0184 };
0185
0186 struct srp_login_rej {
0187 u8 opcode;
0188 u8 reserved1[3];
0189 __be32 reason;
0190 u64 tag;
0191 u8 reserved2[8];
0192 __be16 buf_fmt;
0193 u8 reserved3[6];
0194 };
0195
0196 struct srp_i_logout {
0197 u8 opcode;
0198 u8 reserved[7];
0199 u64 tag;
0200 };
0201
0202 struct srp_t_logout {
0203 u8 opcode;
0204 u8 sol_not;
0205 u8 reserved[2];
0206 __be32 reason;
0207 u64 tag;
0208 };
0209
0210 struct srp_tsk_mgmt {
0211 u8 opcode;
0212 u8 sol_not;
0213 u8 reserved1[6];
0214 u64 tag;
0215 u8 reserved2[4];
0216 struct scsi_lun lun;
0217 u8 reserved3[2];
0218 u8 tsk_mgmt_func;
0219 u8 reserved4;
0220 u64 task_tag;
0221 u8 reserved5[8];
0222 };
0223
0224 struct srp_cmd {
0225 u8 opcode;
0226 u8 sol_not;
0227 u8 reserved1[3];
0228 u8 buf_fmt;
0229 u8 data_out_desc_cnt;
0230 u8 data_in_desc_cnt;
0231 u64 tag;
0232 u8 reserved2[4];
0233 struct scsi_lun lun;
0234 u8 reserved3;
0235 u8 task_attr;
0236 u8 reserved4;
0237 u8 add_cdb_len;
0238 u8 cdb[16];
0239 u8 add_data[];
0240 };
0241
0242 enum {
0243 SRP_RSP_FLAG_RSPVALID = 1 << 0,
0244 SRP_RSP_FLAG_SNSVALID = 1 << 1,
0245 SRP_RSP_FLAG_DOOVER = 1 << 2,
0246 SRP_RSP_FLAG_DOUNDER = 1 << 3,
0247 SRP_RSP_FLAG_DIOVER = 1 << 4,
0248 SRP_RSP_FLAG_DIUNDER = 1 << 5
0249 };
0250
0251
0252
0253
0254
0255
0256 struct srp_rsp {
0257 u8 opcode;
0258 u8 sol_not;
0259 u8 reserved1[2];
0260 __be32 req_lim_delta;
0261 u64 tag __packed __aligned(4);
0262 u8 reserved2[2];
0263 u8 flags;
0264 u8 status;
0265 __be32 data_out_res_cnt;
0266 __be32 data_in_res_cnt;
0267 __be32 sense_data_len;
0268 __be32 resp_data_len;
0269 u8 data[];
0270 };
0271
0272 struct srp_cred_req {
0273 u8 opcode;
0274 u8 sol_not;
0275 u8 reserved[2];
0276 __be32 req_lim_delta;
0277 u64 tag;
0278 };
0279
0280 struct srp_cred_rsp {
0281 u8 opcode;
0282 u8 reserved[7];
0283 u64 tag;
0284 };
0285
0286
0287
0288
0289
0290
0291 struct srp_aer_req {
0292 u8 opcode;
0293 u8 sol_not;
0294 u8 reserved[2];
0295 __be32 req_lim_delta;
0296 u64 tag __packed __aligned(4);
0297 u32 reserved2;
0298 struct scsi_lun lun;
0299 __be32 sense_data_len;
0300 u32 reserved3;
0301 u8 sense_data[];
0302 };
0303
0304 struct srp_aer_rsp {
0305 u8 opcode;
0306 u8 reserved[7];
0307 u64 tag;
0308 };
0309
0310 #endif