vmalloc: fix __GFP_HIGHMEM usage for vmalloc_32 on 32b systems
[linux/fpc-iii.git] / include / uapi / scsi / scsi_bsg_fc.h
blob62597d86beed4c6a0c77265e91d0698bc14a3f88
1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3 * FC Transport BSG Interface
5 * Copyright (C) 2008 James Smart, Emulex Corporation
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef SCSI_BSG_FC_H
24 #define SCSI_BSG_FC_H
27 * This file intended to be included by both kernel and user space
31 * FC Transport SGIO v4 BSG Message Support
34 /* Default BSG request timeout (in seconds) */
35 #define FC_DEFAULT_BSG_TIMEOUT (10 * HZ)
39 * Request Message Codes supported by the FC Transport
42 /* define the class masks for the message codes */
43 #define FC_BSG_CLS_MASK 0xF0000000 /* find object class */
44 #define FC_BSG_HST_MASK 0x80000000 /* fc host class */
45 #define FC_BSG_RPT_MASK 0x40000000 /* fc rport class */
47 /* fc_host Message Codes */
48 #define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001)
49 #define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002)
50 #define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003)
51 #define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004)
52 #define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF)
54 /* fc_rport Message Codes */
55 #define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001)
56 #define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002)
61 * FC Address Identifiers in Message Structures :
63 * Whenever a command payload contains a FC Address Identifier
64 * (aka port_id), the value is effectively in big-endian
65 * order, thus the array elements are decoded as follows:
66 * element [0] is bits 23:16 of the FC Address Identifier
67 * element [1] is bits 15:8 of the FC Address Identifier
68 * element [2] is bits 7:0 of the FC Address Identifier
73 * FC Host Messages
76 /* FC_BSG_HST_ADDR_PORT : */
78 /* Request:
79 * This message requests the FC host to login to the remote port
80 * at the specified N_Port_Id. The remote port is to be enumerated
81 * with the transport upon completion of the login.
83 struct fc_bsg_host_add_rport {
84 uint8_t reserved;
86 /* FC Address Identier of the remote port to login to */
87 uint8_t port_id[3];
90 /* Response:
91 * There is no additional response data - fc_bsg_reply->result is sufficient
95 /* FC_BSG_HST_DEL_RPORT : */
97 /* Request:
98 * This message requests the FC host to remove an enumerated
99 * remote port and to terminate the login to it.
101 * Note: The driver is free to reject this request if it desires to
102 * remain logged in with the remote port.
104 struct fc_bsg_host_del_rport {
105 uint8_t reserved;
107 /* FC Address Identier of the remote port to logout of */
108 uint8_t port_id[3];
111 /* Response:
112 * There is no additional response data - fc_bsg_reply->result is sufficient
116 /* FC_BSG_HST_ELS_NOLOGIN : */
118 /* Request:
119 * This message requests the FC_Host to send an ELS to a specific
120 * N_Port_ID. The host does not need to log into the remote port,
121 * nor does it need to enumerate the rport for further traffic
122 * (although, the FC host is free to do so if it desires).
124 struct fc_bsg_host_els {
126 * ELS Command Code being sent (must be the same as byte 0
127 * of the payload)
129 uint8_t command_code;
131 /* FC Address Identier of the remote port to send the ELS to */
132 uint8_t port_id[3];
135 /* Response:
137 /* fc_bsg_ctels_reply->status values */
138 #define FC_CTELS_STATUS_OK 0x00000000
139 #define FC_CTELS_STATUS_REJECT 0x00000001
140 #define FC_CTELS_STATUS_P_RJT 0x00000002
141 #define FC_CTELS_STATUS_F_RJT 0x00000003
142 #define FC_CTELS_STATUS_P_BSY 0x00000004
143 #define FC_CTELS_STATUS_F_BSY 0x00000006
144 struct fc_bsg_ctels_reply {
146 * Note: An ELS LS_RJT may be reported in 2 ways:
147 * a) A status of FC_CTELS_STATUS_OK is returned. The caller
148 * is to look into the ELS receive payload to determine
149 * LS_ACC or LS_RJT (by contents of word 0). The reject
150 * data will be in word 1.
151 * b) A status of FC_CTELS_STATUS_REJECT is returned, The
152 * rjt_data field will contain valid data.
154 * Note: ELS LS_ACC is determined by an FC_CTELS_STATUS_OK, and
155 * the receive payload word 0 indicates LS_ACC
156 * (e.g. value is 0x02xxxxxx).
158 * Note: Similarly, a CT Reject may be reported in 2 ways:
159 * a) A status of FC_CTELS_STATUS_OK is returned. The caller
160 * is to look into the CT receive payload to determine
161 * Accept or Reject (by contents of word 2). The reject
162 * data will be in word 3.
163 * b) A status of FC_CTELS_STATUS_REJECT is returned, The
164 * rjt_data field will contain valid data.
166 * Note: x_RJT/BSY status will indicae that the rjt_data field
167 * is valid and contains the reason/explanation values.
169 uint32_t status; /* See FC_CTELS_STATUS_xxx */
171 /* valid if status is not FC_CTELS_STATUS_OK */
172 struct {
173 uint8_t action; /* fragment_id for CT REJECT */
174 uint8_t reason_code;
175 uint8_t reason_explanation;
176 uint8_t vendor_unique;
177 } rjt_data;
181 /* FC_BSG_HST_CT : */
183 /* Request:
184 * This message requests that a CT Request be performed with the
185 * indicated N_Port_ID. The driver is responsible for logging in with
186 * the fabric and/or N_Port_ID, etc as per FC rules. This request does
187 * not mandate that the driver must enumerate the destination in the
188 * transport. The driver is allowed to decide whether to enumerate it,
189 * and whether to tear it down after the request.
191 struct fc_bsg_host_ct {
192 uint8_t reserved;
194 /* FC Address Identier of the remote port to send the ELS to */
195 uint8_t port_id[3];
198 * We need words 0-2 of the generic preamble for the LLD's
200 uint32_t preamble_word0; /* revision & IN_ID */
201 uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
202 uint32_t preamble_word2; /* Cmd Code, Max Size */
205 /* Response:
207 * The reply structure is an fc_bsg_ctels_reply structure
211 /* FC_BSG_HST_VENDOR : */
213 /* Request:
214 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
215 * formatting requirements specified in scsi_netlink.h
217 struct fc_bsg_host_vendor {
219 * Identifies the vendor that the message is formatted for. This
220 * should be the recipient of the message.
222 uint64_t vendor_id;
224 /* start of vendor command area */
225 uint32_t vendor_cmd[0];
228 /* Response:
230 struct fc_bsg_host_vendor_reply {
231 /* start of vendor response area */
232 uint32_t vendor_rsp[0];
238 * FC Remote Port Messages
241 /* FC_BSG_RPT_ELS : */
243 /* Request:
244 * This message requests that an ELS be performed with the rport.
246 struct fc_bsg_rport_els {
248 * ELS Command Code being sent (must be the same as
249 * byte 0 of the payload)
251 uint8_t els_code;
254 /* Response:
256 * The reply structure is an fc_bsg_ctels_reply structure
260 /* FC_BSG_RPT_CT : */
262 /* Request:
263 * This message requests that a CT Request be performed with the rport.
265 struct fc_bsg_rport_ct {
267 * We need words 0-2 of the generic preamble for the LLD's
269 uint32_t preamble_word0; /* revision & IN_ID */
270 uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
271 uint32_t preamble_word2; /* Cmd Code, Max Size */
273 /* Response:
275 * The reply structure is an fc_bsg_ctels_reply structure
281 /* request (CDB) structure of the sg_io_v4 */
282 struct fc_bsg_request {
283 uint32_t msgcode;
284 union {
285 struct fc_bsg_host_add_rport h_addrport;
286 struct fc_bsg_host_del_rport h_delrport;
287 struct fc_bsg_host_els h_els;
288 struct fc_bsg_host_ct h_ct;
289 struct fc_bsg_host_vendor h_vendor;
291 struct fc_bsg_rport_els r_els;
292 struct fc_bsg_rport_ct r_ct;
293 } rqst_data;
294 } __attribute__((packed));
297 /* response (request sense data) structure of the sg_io_v4 */
298 struct fc_bsg_reply {
300 * The completion result. Result exists in two forms:
301 * if negative, it is an -Exxx system errno value. There will
302 * be no further reply information supplied.
303 * else, it's the 4-byte scsi error result, with driver, host,
304 * msg and status fields. The per-msgcode reply structure
305 * will contain valid data.
307 uint32_t result;
309 /* If there was reply_payload, how much was recevied ? */
310 uint32_t reply_payload_rcv_len;
312 union {
313 struct fc_bsg_host_vendor_reply vendor_reply;
315 struct fc_bsg_ctels_reply ctels_reply;
316 } reply_data;
320 #endif /* SCSI_BSG_FC_H */