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
74 SRP_TSK_ABORT_TASK = 0x01,
75 SRP_TSK_ABORT_TASK_SET = 0x02,
76 SRP_TSK_CLEAR_TASK_SET = 0x04,
77 SRP_TSK_LUN_RESET = 0x08,
78 SRP_TSK_CLEAR_ACA = 0x40
81 enum srp_login_rej_reason {
82 SRP_LOGIN_REJ_UNABLE_ESTABLISH_CHANNEL = 0x00010000,
83 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES = 0x00010001,
84 SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE = 0x00010002,
85 SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL = 0x00010003,
86 SRP_LOGIN_REJ_UNSUPPORTED_DESCRIPTOR_FMT = 0x00010004,
87 SRP_LOGIN_REJ_MULTI_CHANNEL_UNSUPPORTED = 0x00010005,
88 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED = 0x00010006
92 SRP_REV10_IB_IO_CLASS = 0xff00,
93 SRP_REV16A_IB_IO_CLASS = 0x0100
96 struct srp_direct_buf {
103 * We need the packed attribute because the SRP spec puts the list of
104 * descriptors at an offset of 20, which is not aligned to the size of
105 * struct srp_direct_buf. The whole structure must be packed to avoid
106 * having the 20-byte structure padded to 24 bytes on 64-bit architectures.
108 struct srp_indirect_buf {
109 struct srp_direct_buf table_desc;
111 struct srp_direct_buf desc_list[0];
112 } __attribute__((packed));
115 SRP_MULTICHAN_SINGLE = 0,
116 SRP_MULTICHAN_MULTI = 1
119 struct srp_login_req {
123 __be32 req_it_iu_len;
128 u8 initiator_port_id[16];
129 u8 target_port_id[16];
133 * struct srp_login_req_rdma - RDMA/CM login parameters.
135 * RDMA/CM over InfiniBand can only carry 92 - 36 = 56 bytes of private
136 * data. The %srp_login_req_rdma structure contains the same information as
137 * %srp_login_req but with the reserved data removed.
139 struct srp_login_req_rdma {
144 __be32 req_it_iu_len;
145 u8 initiator_port_id[16];
146 u8 target_port_id[16];
150 * The SRP spec defines the size of the LOGIN_RSP structure to be 52
151 * bytes, so it needs to be packed to avoid having it padded to 56
152 * bytes on 64-bit architectures.
154 struct srp_login_rsp {
157 __be32 req_lim_delta;
159 __be32 max_it_iu_len;
160 __be32 max_ti_iu_len;
164 } __attribute__((packed));
166 struct srp_login_rej {
176 struct srp_i_logout {
182 struct srp_t_logout {
191 * We need the packed attribute because the SRP spec only aligns the
192 * 8-byte LUN field to 4 bytes.
194 struct srp_tsk_mgmt {
209 * We need the packed attribute because the SRP spec only aligns the
210 * 8-byte LUN field to 4 bytes.
217 u8 data_out_desc_cnt;
231 SRP_RSP_FLAG_RSPVALID = 1 << 0,
232 SRP_RSP_FLAG_SNSVALID = 1 << 1,
233 SRP_RSP_FLAG_DOOVER = 1 << 2,
234 SRP_RSP_FLAG_DOUNDER = 1 << 3,
235 SRP_RSP_FLAG_DIOVER = 1 << 4,
236 SRP_RSP_FLAG_DIUNDER = 1 << 5
240 * The SRP spec defines the size of the RSP structure to be 36 bytes,
241 * so it needs to be packed to avoid having it padded to 40 bytes on
242 * 64-bit architectures.
248 __be32 req_lim_delta;
253 __be32 data_out_res_cnt;
254 __be32 data_in_res_cnt;
255 __be32 sense_data_len;
256 __be32 resp_data_len;
258 } __attribute__((packed));
260 struct srp_cred_req {
264 __be32 req_lim_delta;
268 struct srp_cred_rsp {
275 * The SRP spec defines the fixed portion of the AER_REQ structure to be
276 * 36 bytes, so it needs to be packed to avoid having it padded to 40 bytes
277 * on 64-bit architectures.
283 __be32 req_lim_delta;
287 __be32 sense_data_len;
290 } __attribute__((packed));
298 #endif /* SCSI_SRP_H */