2 * Copyright (c) 2005 Cisco Systems. All rights reserved.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39 * Structures and constants for the SCSI RDMA Protocol (SRP) as
40 * defined by the INCITS T10 committee. This file was written using
41 * draft Revision 16a of the SRP standard.
44 #include <linux/types.h>
45 #include <scsi/scsi.h>
63 SRP_BUF_FORMAT_DIRECT
= 1 << 1,
64 SRP_BUF_FORMAT_INDIRECT
= 1 << 2
69 SRP_DATA_DESC_DIRECT
= 1,
70 SRP_DATA_DESC_INDIRECT
= 2,
71 SRP_DATA_DESC_IMM
= 3, /* new in SRP2 */
75 SRP_TSK_ABORT_TASK
= 0x01,
76 SRP_TSK_ABORT_TASK_SET
= 0x02,
77 SRP_TSK_CLEAR_TASK_SET
= 0x04,
78 SRP_TSK_LUN_RESET
= 0x08,
79 SRP_TSK_CLEAR_ACA
= 0x40
82 enum srp_login_rej_reason
{
83 SRP_LOGIN_REJ_UNABLE_ESTABLISH_CHANNEL
= 0x00010000,
84 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES
= 0x00010001,
85 SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE
= 0x00010002,
86 SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL
= 0x00010003,
87 SRP_LOGIN_REJ_UNSUPPORTED_DESCRIPTOR_FMT
= 0x00010004,
88 SRP_LOGIN_REJ_MULTI_CHANNEL_UNSUPPORTED
= 0x00010005,
89 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED
= 0x00010006
93 SRP_REV10_IB_IO_CLASS
= 0xff00,
94 SRP_REV16A_IB_IO_CLASS
= 0x0100
97 struct srp_direct_buf
{
104 * We need the packed attribute because the SRP spec puts the list of
105 * descriptors at an offset of 20, which is not aligned to the size of
106 * struct srp_direct_buf. The whole structure must be packed to avoid
107 * having the 20-byte structure padded to 24 bytes on 64-bit architectures.
109 struct srp_indirect_buf
{
110 struct srp_direct_buf table_desc
;
112 struct srp_direct_buf desc_list
[];
113 } __attribute__((packed
));
115 /* Immediate data buffer descriptor as defined in SRP2. */
120 /* srp_login_req.flags */
122 SRP_MULTICHAN_SINGLE
= 0,
123 SRP_MULTICHAN_MULTI
= 1,
124 SRP_IMMED_REQUESTED
= 0x80, /* new in SRP2 */
127 struct srp_login_req
{
131 __be32 req_it_iu_len
;
136 __be16 imm_data_offset
; /* new in SRP2 */
138 u8 initiator_port_id
[16];
139 u8 target_port_id
[16];
143 * struct srp_login_req_rdma - RDMA/CM login parameters.
145 * RDMA/CM over InfiniBand can only carry 92 - 36 = 56 bytes of private
146 * data. The %srp_login_req_rdma structure contains the same information as
147 * %srp_login_req but with the reserved data removed.
149 struct srp_login_req_rdma
{
154 __be32 req_it_iu_len
;
155 u8 initiator_port_id
[16];
156 u8 target_port_id
[16];
157 __be16 imm_data_offset
;
161 /* srp_login_rsp.rsp_flags */
163 SRP_LOGIN_RSP_MULTICHAN_NO_CHAN
= 0x0,
164 SRP_LOGIN_RSP_MULTICHAN_TERMINATED
= 0x1,
165 SRP_LOGIN_RSP_MULTICHAN_MAINTAINED
= 0x2,
166 SRP_LOGIN_RSP_IMMED_SUPP
= 0x80, /* new in SRP2 */
170 * The SRP spec defines the size of the LOGIN_RSP structure to be 52
171 * bytes, so it needs to be packed to avoid having it padded to 56
172 * bytes on 64-bit architectures.
174 struct srp_login_rsp
{
177 __be32 req_lim_delta
;
179 __be32 max_it_iu_len
;
180 __be32 max_ti_iu_len
;
184 } __attribute__((packed
));
186 struct srp_login_rej
{
196 struct srp_i_logout
{
202 struct srp_t_logout
{
211 * We need the packed attribute because the SRP spec only aligns the
212 * 8-byte LUN field to 4 bytes.
214 struct srp_tsk_mgmt
{
229 * We need the packed attribute because the SRP spec only aligns the
230 * 8-byte LUN field to 4 bytes.
237 u8 data_out_desc_cnt
;
251 SRP_RSP_FLAG_RSPVALID
= 1 << 0,
252 SRP_RSP_FLAG_SNSVALID
= 1 << 1,
253 SRP_RSP_FLAG_DOOVER
= 1 << 2,
254 SRP_RSP_FLAG_DOUNDER
= 1 << 3,
255 SRP_RSP_FLAG_DIOVER
= 1 << 4,
256 SRP_RSP_FLAG_DIUNDER
= 1 << 5
260 * The SRP spec defines the size of the RSP structure to be 36 bytes,
261 * so it needs to be packed to avoid having it padded to 40 bytes on
262 * 64-bit architectures.
268 __be32 req_lim_delta
;
273 __be32 data_out_res_cnt
;
274 __be32 data_in_res_cnt
;
275 __be32 sense_data_len
;
276 __be32 resp_data_len
;
278 } __attribute__((packed
));
280 struct srp_cred_req
{
284 __be32 req_lim_delta
;
288 struct srp_cred_rsp
{
295 * The SRP spec defines the fixed portion of the AER_REQ structure to be
296 * 36 bytes, so it needs to be packed to avoid having it padded to 40 bytes
297 * on 64-bit architectures.
303 __be32 req_lim_delta
;
307 __be32 sense_data_len
;
310 } __attribute__((packed
));
318 #endif /* SCSI_SRP_H */