summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ibmvscsi/srp.h
blob: e952c1cd9740d18ca206846fb9e2a053d4e2a79a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*****************************************************************************/
/* srp.h -- SCSI RDMA Protocol definitions                                   */
/*                                                                           */
/* Written By: Colin Devilbis, IBM Corporation                               */
/*                                                                           */
/* Copyright (C) 2003 IBM Corporation                                        */
/*                                                                           */
/* This program is free software; you can redistribute it and/or modify      */
/* it under the terms of the GNU General Public License as published by      */
/* the Free Software Foundation; either version 2 of the License, or         */
/* (at your option) any later version.                                       */
/*                                                                           */
/* This program is distributed in the hope that it will be useful,           */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of            */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             */
/* GNU General Public License for more details.                              */
/*                                                                           */
/* You should have received a copy of the GNU General Public License         */
/* along with this program; if not, write to the Free Software               */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
/*                                                                           */
/*                                                                           */
/* This file contains structures and definitions for the SCSI RDMA Protocol  */
/* (SRP) as defined in the T10 standard available at www.t10.org.  This      */
/* file was based on the 16a version of the standard                         */
/*                                                                           */
/*****************************************************************************/
#ifndef SRP_H
#define SRP_H

#define PACKED __attribute__((packed))

enum srp_types {
	SRP_LOGIN_REQ_TYPE = 0x00,
	SRP_LOGIN_RSP_TYPE = 0xC0,
	SRP_LOGIN_REJ_TYPE = 0x80,
	SRP_I_LOGOUT_TYPE = 0x03,
	SRP_T_LOGOUT_TYPE = 0x80,
	SRP_TSK_MGMT_TYPE = 0x01,
	SRP_CMD_TYPE = 0x02,
	SRP_RSP_TYPE = 0xC1,
	SRP_CRED_REQ_TYPE = 0x81,
	SRP_CRED_RSP_TYPE = 0x41,
	SRP_AER_REQ_TYPE = 0x82,
	SRP_AER_RSP_TYPE = 0x42
};

enum srp_descriptor_formats {
	SRP_NO_BUFFER = 0x00,
	SRP_DIRECT_BUFFER = 0x01,
	SRP_INDIRECT_BUFFER = 0x02
};

struct memory_descriptor {
	u64 virtual_address;
	u32 memory_handle;
	u32 length;
};

struct indirect_descriptor {
	struct memory_descriptor head;
	u32 total_length;
	struct memory_descriptor list[1] PACKED;
};

struct srp_generic {
	u8 type;
	u8 reserved1[7];
	u64 tag;
};

struct srp_login_req {
	u8 type;
	u8 reserved1[7];
	u64 tag;
	u32 max_requested_initiator_to_target_iulen;
	u32 reserved2;
	u16 required_buffer_formats;
	u8 reserved3:6;
	u8 multi_channel_action:2;
	u8 reserved4;
	u32 reserved5;
	u8 initiator_port_identifier[16];
	u8 target_port_identifier[16];
};

struct srp_login_rsp {
	u8 type;
	u8 reserved1[3];
	u32 request_limit_delta;
	u64 tag;
	u32 max_initiator_to_target_iulen;
	u32 max_target_to_initiator_iulen;
	u16 supported_buffer_formats;
	u8 reserved2:6;
	u8 multi_channel_result:2;
	u8 reserved3;
	u8 reserved4[24];
};

struct srp_login_rej {
	u8 type;
	u8 reserved1[3];
	u32 reason;
	u64 tag;
	u64 reserved2;
	u16 supported_buffer_formats;
	u8 reserved3[6];
};

struct srp_i_logout {
	u8 type;
	u8 reserved1[7];
	u64 tag;
};

struct srp_t_logout {
	u8 type;
	u8 reserved1[3];
	u32 reason;
	u64 tag;
};

struct srp_tsk_mgmt {
	u8 type;
	u8 reserved1[7];
	u64 tag;
	u32 reserved2;
	u64 lun PACKED;
	u8 reserved3;
	u8 reserved4;
	u8 task_mgmt_flags;
	u8 reserved5;
	u64 managed_task_tag;
	u64 reserved6;
};

struct srp_cmd {
	u8 type;
	u32 reserved1 PACKED;
	u8 data_out_format:4;
	u8 data_in_format:4;
	u8 data_out_count;
	u8 data_in_count;
	u64 tag;
	u32 reserved2;
	u64 lun PACKED;
	u8 reserved3;
	u8 reserved4:5;
	u8 task_attribute:3;
	u8 reserved5;
	u8 additional_cdb_len;
	u8 cdb[16];
	u8 additional_data[0x100 - 0x30];
};

struct srp_rsp {
	u8 type;
	u8 reserved1[3];
	u32 request_limit_delta;
	u64 tag;
	u16 reserved2;
	u8 reserved3:2;
	u8 diunder:1;
	u8 diover:1;
	u8 dounder:1;
	u8 doover:1;
	u8 snsvalid:1;
	u8 rspvalid:1;
	u8 status;
	u32 data_in_residual_count;
	u32 data_out_residual_count;
	u32 sense_data_list_length;
	u32 response_data_list_length;
	u8 sense_and_response_data[18];
};

struct srp_cred_req {
	u8 type;
	u8 reserved1[3];
	u32 request_limit_delta;
	u64 tag;
};

struct srp_cred_rsp {
	u8 type;
	u8 reserved1[7];
	u64 tag;
};

struct srp_aer_req {
	u8 type;
	u8 reserved1[3];
	u32 request_limit_delta;
	u64 tag;
	u32 reserved2;
	u64 lun;
	u32 sense_data_list_length;
	u32 reserved3;
	u8 sense_data[20];
};

struct srp_aer_rsp {
	u8 type;
	u8 reserved1[7];
	u64 tag;
};

union srp_iu {
	struct srp_generic generic;
	struct srp_login_req login_req;
	struct srp_login_rsp login_rsp;
	struct srp_login_rej login_rej;
	struct srp_i_logout i_logout;
	struct srp_t_logout t_logout;
	struct srp_tsk_mgmt tsk_mgmt;
	struct srp_cmd cmd;
	struct srp_rsp rsp;
	struct srp_cred_req cred_req;
	struct srp_cred_rsp cred_rsp;
	struct srp_aer_req aer_req;
	struct srp_aer_rsp aer_rsp;
};

#endif
OpenPOWER on IntegriCloud