xref: /titanic_41/usr/src/uts/common/sys/fibre-channel/impl/fcgs2.h (revision 269552cd714f2f1e308fdde0fc69b18a7f1142b2)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_FIBRE_CHANNEL_IMPL_FCGS2_H
27 #define	_SYS_FIBRE_CHANNEL_IMPL_FCGS2_H
28 
29 
30 #include <sys/note.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * A device handle describes the characterics of a device
38  * Node. Each device handle also contains information
39  * on the serveral different ports it is discovered on.
40  *
41  * Classification of Name Server Objects
42  *
43  * +-----------------------------------+---------------------------+
44  * |  Device (node) Specific           |  Port Specific            |
45  * +-----------------------------------+---------------------------+
46  * |  Node Name (NN)                   | Port type (PT)            |
47  * |  Symbolic Node Name Length        | Port Id (ID)              |
48  * |  Symbloic Node Name(SNN)          | Symbolic Port Name length |
49  * |  Initial Process associator(IPA)  | Symbolic Port Name (SPN)  |
50  * |                                   | Class of Service (CS)     |
51  * |                                   | fc4 types (FT)            |
52  * |                                   | IP Address (IP)           |
53  * +-----------------------------------+---------------------------+
54  *
55  * The above classification causes some inconvenience in not having
56  * the ability to directly copy all the nameserver objects into a
57  * contiguous piece of memory. But we'll live with it.
58  */
59 
60 #define	CT_REV			0x01	/* Common Transport revision */
61 
62 /* FCS types */
63 #define	FCSTYPE_KEYSERVICE	0xF7
64 #define	FCSTYPE_ALIAS		0xF8
65 #define	FCSTYPE_MGMTSERVICE	0xFA
66 #define	FCSTYPE_TIMESERVICE	0xFB
67 #define	FCSTYPE_DIRECTORY	0xFC
68 #define	FCSTYEP_FABRIC		0xFD
69 
70 /*
71  * FCS subtypes for Directory Service
72  */
73 #define	FCSSUB_DS_NAME_SERVER		0x02	/* Zoned Name Server */
74 #define	FCSSUB_DS_IPADDR_SERVER		0x03	/* IP Address Server */
75 
76 /*
77  * FCS subtypes for Management Service
78  */
79 #define	FCSSUB_MS_CONFIG_SERVER		0x01	/* Fabric Config Server */
80 #define	FCSSUB_MS_UNZONED_NAME_SERVER	0x02	/* Unzoned Name Server */
81 #define	FCSSUB_MS_ZONE_SERVER		0x03	/* Fabric Zone Server */
82 
83 /*
84  * FCS subtypes for Time Service
85  */
86 #define	FCSSUB_TS_TIME_SERVER		0x01	/* Time Server */
87 
88 /*
89  * FCS subtypes for Alias Service
90  */
91 #define	FCSSUB_AS_ALIAS_SERVER		0x01	/* Alias Server */
92 
93 /*
94  * FCS subtypes for Key Service
95  */
96 #define	FCSSUB_KS_KEY_SERVER		0x00	/* Key Distribution Server */
97 
98 /* FC-CT response codes */
99 #define	FS_RJT_IU		0x8001
100 #define	FS_ACC_IU		0x8002
101 
102 /* FS_RJT Reason Codes */
103 #define	FSRJT_BADCMD		0x01	/* Invalid command code */
104 #define	FSRJT_BADVER		0x02	/* Invalid version level */
105 #define	FSRJT_LOGICALERR	0x03	/* Logical error */
106 #define	FSRJT_BADSIZE		0x04	/* Invalid IU size */
107 #define	FSRJT_BUSY		0x05	/* Logical busy */
108 #define	FSRJT_PROTOCOLERR	0x07	/* Protocol error */
109 #define	FSRJT_CMDFAILED		0x08	/* Unable to perform command */
110 #define	FSRJT_UNSUPP		0x0b	/* Command not supported */
111 #define	FSRJT_VENDOR		0xff	/* vendor unique error */
112 
113 /* Name Service Command Codes */
114 #define	NS_GA_NXT		0x0100	/* Get All next */
115 #define	NS_GPN_ID		0x0112	/* Get Port Name */
116 #define	NS_GNN_ID		0x0113	/* Get Node Name */
117 #define	NS_GCS_ID		0x0114	/* Get Class Of service */
118 #define	NS_GFT_ID		0x0117	/* Get FC-4 Types */
119 #define	NS_GSPN_ID		0x0118	/* Get Sym Port name */
120 #define	NS_GPT_ID		0x011A	/* Get Port Type */
121 #define	NS_GID_PN		0x0121	/* Get port id for PN */
122 #define	NS_GID_NN		0x0131	/* Get port id for NN */
123 #define	NS_GIP_NN		0x0135	/* Get IP address */
124 #define	NS_GIPA_NN		0x0136	/* Get I.P.A */
125 #define	NS_GSNN_NN		0x0139	/* Get Sym Node name */
126 #define	NS_GNN_IP		0x0153	/* Get Node name for IP */
127 #define	NS_GIPA_IP		0x0156	/* Get I.P.A for IP */
128 #define	NS_GID_FT		0x0171	/* Get port Id for FC-4 type */
129 #define	NS_GID_PT		0x01A1	/* Get port Id for type */
130 #define	NS_RPN_ID		0x0212	/* Reg port name */
131 #define	NS_RNN_ID		0x0213	/* Reg node name */
132 #define	NS_RCS_ID		0x0214	/* Reg C.O.S */
133 #define	NS_RFT_ID		0x0217	/* Reg FC-4 Types */
134 #define	NS_RSPN_ID		0x0218	/* Reg Sym Port name */
135 #define	NS_RPT_ID		0x021A	/* Reg Port Type */
136 #define	NS_RIP_NN		0x0235	/* Reg I.P address */
137 #define	NS_RIPA_NN		0x0236	/* Reg I.P.A */
138 #define	NS_RSNN_NN		0x0239	/* Reg Sym Node name */
139 #define	NS_DA_ID		0x0300	/* De-Register all */
140 
141 /* Name service reject explanation codes */
142 #define	NSRJTX_NONE		0x00	/* No additional explanation */
143 #define	NSRJTX_PORTNOTREG	0x01	/* Port ID not registered */
144 #define	NSRJTX_PWWNNOTREG	0x02	/* Port Name not registered */
145 #define	NSRJTX_NWWNNOTREG	0x03	/* Node Name not registered */
146 #define	NSRJTX_CoSNOTREG	0x04	/* Class of Service no registered */
147 #define	NSRJTX_IPNOTREG		0x05	/* IP Address not registered */
148 #define	NSRJTX_IPANOTREG	0x06	/* Initial Proc. Assoc not reg. */
149 #define	NSRJTX_FC4NOTREG	0x07	/* FC$ types not registered */
150 #define	NSRJTX_SPNNOTREG	0x08	/* Symbolic port name not registered */
151 #define	NSRJTX_SNNNOTREG	0x09	/* Symbolic node name not registered */
152 #define	NSRJTX_TYPENOTREG	0x0a	/* Port type not registered */
153 #define	NSRJTX_NOPERM		0x10	/* Access denied */
154 #define	NSRJTX_BADPORTID	0x11	/* Unacceptable port ID */
155 #define	NSRJTX_DBEMPTY		0x12	/* Data base empty */
156 
157 #define	FC_NS_CLASSF		0x01
158 #define	FC_NS_CLASS1		0x02
159 #define	FC_NS_CLASS2		0x04
160 #define	FC_NS_CLASS3		0x08
161 #define	FC_NS_CLASS4		0x10
162 #define	FC_NS_CLASS5		0x20
163 #define	FC_NS_CLASS6		0x40
164 
165 #define	FC_NS_PORT_UNKNOWN	0x00
166 #define	FC_NS_PORT_N		0x01
167 #define	FC_NS_PORT_NL		0x02
168 #define	FC_NS_PORT_F_NL		0x03
169 #define	FC_NS_PORT_NX		0x7F
170 #define	FC_NS_PORT_F		0x81
171 #define	FC_NS_PORT_FL		0x82
172 #define	FC_NS_PORT_E		0x84
173 
174 #define	FC_IS_CMD_A_QUERY(cmd)	((cmd) >= NS_GA_NXT && (cmd) <= NS_GID_PT)
175 #define	FC_IS_CMD_A_REG(cmd)	((cmd) >= NS_RPN_ID && (cmd) <= NS_DA_ID)
176 #define	NS_GAN_RESP_LEN		(sizeof (ns_resp_gan_t))
177 
178 /*
179  * SCR registration function codes
180  */
181 #define	FC_SCR_FABRIC_REGISTRATION	0x01
182 #define	FC_SCR_NPORT_REGISTRATION	0x02
183 #define	FC_SCR_FULL_REGISTRATION	0x03
184 #define	FC_SCR_CLEAR_REGISTRATION	0xFF
185 
186 /*
187  * Register port/node name request payload
188  *
189  * 'x' means either P (port) or N (node)
190  */
191 typedef struct rxn_id {
192 	fc_portid_t	rxn_port_id;	/* Port Identfier */
193 	la_wwn_t	rxn_xname;		/* Port/Node Name */
194 } ns_rxn_req_t;
195 
196 /*
197  * Register Class of service request payload
198  */
199 typedef struct rcos {
200 	fc_portid_t	rcos_port_id;
201 	uint32_t	rcos_cos;
202 } ns_rcos_t;
203 
204 /*
205  * Register FC-4 TYPEs request payload
206  */
207 typedef struct rfc_type {
208 	fc_portid_t	rfc_port_id;
209 	uchar_t		rfc_types[32];	/* bit map of ULP types */
210 } ns_rfc_type_t;
211 
212 /*
213  * Register symbolic port name request payload
214  */
215 typedef struct spn {
216 	fc_portid_t	spn_port_id;
217 	uchar_t		spn_len;
218 	/*
219 	 * What follows here is the actual name
220 	 * which is allocated on the fly during
221 	 * packet allocation.
222 	 */
223 } ns_spn_t;
224 
225 /*
226  * Register port type request payload
227  */
228 typedef struct rpt {
229 	fc_portid_t	rpt_port_id;
230 	fc_porttype_t	rpt_type;
231 } ns_rpt_t;
232 
233 /*
234  * Register IP address request payload
235  */
236 typedef struct rip {
237 	la_wwn_t	rip_node_name;
238 	uchar_t		rip_ip_addr[16];
239 } ns_rip_t;
240 
241 /*
242  * Register Initial Process Associator request payload
243  */
244 typedef struct ipa {
245 	la_wwn_t	ipa_node_name;
246 	uchar_t		ipa_value[8];
247 } ns_ipa_t;
248 
249 /*
250  * Register Symbolic Node Name request payload
251  */
252 typedef struct snn {
253 	la_wwn_t	snn_node_name;
254 	uchar_t		snn_len;
255 	/*
256 	 * What follows here is the actual name
257 	 * which is allocated on the fly during
258 	 * packet allocation.
259 	 */
260 } ns_snn_t;
261 
262 /*
263  * Remove all request payload
264  */
265 typedef struct remall {
266 	fc_portid_t	rem_port_id;
267 } ns_remall_t;
268 
269 typedef fc_ct_header_t fc_reg_resp_t;
270 typedef fc_ct_header_t fc_query_resp_t;
271 
272 typedef struct ns_req_gid_pt {
273 	fc_porttype_t	port_type;
274 } ns_req_gid_pt_t;
275 
276 typedef struct ns_resp_gid_pt {
277 	fc_portid_t	gid_port_id;
278 } ns_resp_gid_pt_t;
279 
280 typedef struct ns_req_gan {
281 	fc_portid_t	pid;
282 } ns_req_gan_t;
283 
284 typedef struct ns_resp_gan {
285 	fc_porttype_t	gan_type_id;		/* type and id next */
286 	la_wwn_t	gan_pwwn;		/* Port Name */
287 	uchar_t		gan_spnlen;		/* Sym P Name Len */
288 	char		gan_spname[255];	/* Sym Port name */
289 
290 	la_wwn_t	gan_nwwn;		/* Node Name */
291 	uchar_t		gan_snnlen;		/* Sym N name Len */
292 	char		gan_snname[255];	/* Sym Node name */
293 
294 	uchar_t		gan_ipa[8];		/* Initial Proc assoc */
295 	uchar_t		gan_ip[16];		/* IP Address */
296 	uint32_t	gan_cos;		/* Class of Service */
297 
298 	uint32_t	gan_fc4types[8];	/* FC-4 Types */
299 } ns_resp_gan_t;
300 
301 typedef struct ns_req_gid_pn {
302 	la_wwn_t	pwwn;
303 } ns_req_gid_pn_t;
304 
305 typedef struct ns_resp_gid_pn {
306 	fc_portid_t	pid;
307 } ns_resp_gid_pn_t;
308 
309 typedef struct ns_req_gpn_id {
310 	fc_portid_t	pid;
311 } ns_req_gpn_id_t;
312 
313 typedef struct ns_resp_gpn_id {
314 	la_wwn_t	pwwn;
315 } ns_resp_gpn_id_t;
316 
317 typedef struct ns_req_gpt_id {
318 	fc_portid_t	pid;
319 } ns_req_gpt_id_t;
320 
321 typedef struct ns_resp_gpt_id {
322 	fc_porttype_t	port_type;
323 } ns_resp_gpt_id_t;
324 
325 #if	!defined(__lint)
326 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_resp_gpn_id))
327 _NOTE(SCHEME_PROTECTS_DATA("unique per request", rxn_id))
328 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_req_gpn_id))
329 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_resp_gid_pn))
330 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_req_gid_pn))
331 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_resp_gan))
332 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_req_gan))
333 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_req_gid_pt))
334 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_req_gpt_id))
335 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_resp_gpt_id))
336 _NOTE(SCHEME_PROTECTS_DATA("unique per request", remall))
337 _NOTE(SCHEME_PROTECTS_DATA("unique per request", snn))
338 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ipa))
339 _NOTE(SCHEME_PROTECTS_DATA("unique per request", rip))
340 _NOTE(SCHEME_PROTECTS_DATA("unique per request", rpt))
341 _NOTE(SCHEME_PROTECTS_DATA("unique per request", spn))
342 _NOTE(SCHEME_PROTECTS_DATA("unique per request", rfc_type))
343 _NOTE(SCHEME_PROTECTS_DATA("unique per request", rcos))
344 #endif /* __lint */
345 
346 #ifdef	__cplusplus
347 }
348 #endif
349 
350 #endif	/* _SYS_FIBRE_CHANNEL_IMPL_FCGS2_H */
351