xref: /titanic_41/usr/src/uts/common/sys/fibre-channel/impl/fcgs2.h (revision 5203bc321053fb87d7073c7640548fab73634793)
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 2009 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 /* Management Service Command Codes */
158 #define	MS_GIEL		0x0101	/* Get Interconnect Element List */
159 
160 #define	FC_NS_CLASSF		0x01
161 #define	FC_NS_CLASS1		0x02
162 #define	FC_NS_CLASS2		0x04
163 #define	FC_NS_CLASS3		0x08
164 #define	FC_NS_CLASS4		0x10
165 #define	FC_NS_CLASS5		0x20
166 #define	FC_NS_CLASS6		0x40
167 
168 #define	FC_NS_PORT_UNKNOWN	0x00
169 #define	FC_NS_PORT_N		0x01
170 #define	FC_NS_PORT_NL		0x02
171 #define	FC_NS_PORT_F_NL		0x03
172 #define	FC_NS_PORT_NX		0x7F
173 #define	FC_NS_PORT_F		0x81
174 #define	FC_NS_PORT_FL		0x82
175 #define	FC_NS_PORT_E		0x84
176 
177 #define	FC_IS_CMD_A_QUERY(cmd)	((cmd) >= NS_GA_NXT && (cmd) <= NS_GID_PT)
178 #define	FC_IS_CMD_A_REG(cmd)	((cmd) >= NS_RPN_ID && (cmd) <= NS_DA_ID)
179 #define	NS_GAN_RESP_LEN		(sizeof (ns_resp_gan_t))
180 
181 /*
182  * SCR registration function codes
183  */
184 #define	FC_SCR_FABRIC_REGISTRATION	0x01
185 #define	FC_SCR_NPORT_REGISTRATION	0x02
186 #define	FC_SCR_FULL_REGISTRATION	0x03
187 #define	FC_SCR_CLEAR_REGISTRATION	0xFF
188 
189 /*
190  * Register port/node name request payload
191  *
192  * 'x' means either P (port) or N (node)
193  */
194 typedef struct rxn_id {
195 	fc_portid_t	rxn_port_id;	/* Port Identfier */
196 	la_wwn_t	rxn_xname;		/* Port/Node Name */
197 } ns_rxn_req_t;
198 
199 /*
200  * Register Class of service request payload
201  */
202 typedef struct rcos {
203 	fc_portid_t	rcos_port_id;
204 	uint32_t	rcos_cos;
205 } ns_rcos_t;
206 
207 /*
208  * Register FC-4 TYPEs request payload
209  */
210 typedef struct rfc_type {
211 	fc_portid_t	rfc_port_id;
212 	uchar_t		rfc_types[32];	/* bit map of ULP types */
213 } ns_rfc_type_t;
214 
215 /*
216  * Register symbolic port name request payload
217  */
218 typedef struct spn {
219 	fc_portid_t	spn_port_id;
220 	uchar_t		spn_len;
221 	/*
222 	 * What follows here is the actual name
223 	 * which is allocated on the fly during
224 	 * packet allocation.
225 	 */
226 } ns_spn_t;
227 
228 /*
229  * Register port type request payload
230  */
231 typedef struct rpt {
232 	fc_portid_t	rpt_port_id;
233 	fc_porttype_t	rpt_type;
234 } ns_rpt_t;
235 
236 /*
237  * Register IP address request payload
238  */
239 typedef struct rip {
240 	la_wwn_t	rip_node_name;
241 	uchar_t		rip_ip_addr[16];
242 } ns_rip_t;
243 
244 /*
245  * Register Initial Process Associator request payload
246  */
247 typedef struct ipa {
248 	la_wwn_t	ipa_node_name;
249 	uchar_t		ipa_value[8];
250 } ns_ipa_t;
251 
252 /*
253  * Register Symbolic Node Name request payload
254  */
255 typedef struct snn {
256 	la_wwn_t	snn_node_name;
257 	uchar_t		snn_len;
258 	/*
259 	 * What follows here is the actual name
260 	 * which is allocated on the fly during
261 	 * packet allocation.
262 	 */
263 } ns_snn_t;
264 
265 /*
266  * Remove all request payload
267  */
268 typedef struct remall {
269 	fc_portid_t	rem_port_id;
270 } ns_remall_t;
271 
272 typedef fc_ct_header_t fc_reg_resp_t;
273 typedef fc_ct_header_t fc_query_resp_t;
274 
275 typedef struct ns_req_gid_pt {
276 	fc_porttype_t	port_type;
277 } ns_req_gid_pt_t;
278 
279 typedef struct ns_resp_gid_pt {
280 	fc_portid_t	gid_port_id;
281 } ns_resp_gid_pt_t;
282 
283 typedef struct ns_req_gan {
284 	fc_portid_t	pid;
285 } ns_req_gan_t;
286 
287 typedef struct ns_resp_gan {
288 	fc_porttype_t	gan_type_id;		/* type and id next */
289 	la_wwn_t	gan_pwwn;		/* Port Name */
290 	uchar_t		gan_spnlen;		/* Sym P Name Len */
291 	char		gan_spname[255];	/* Sym Port name */
292 
293 	la_wwn_t	gan_nwwn;		/* Node Name */
294 	uchar_t		gan_snnlen;		/* Sym N name Len */
295 	char		gan_snname[255];	/* Sym Node name */
296 
297 	uchar_t		gan_ipa[8];		/* Initial Proc assoc */
298 	uchar_t		gan_ip[16];		/* IP Address */
299 	uint32_t	gan_cos;		/* Class of Service */
300 
301 	uint32_t	gan_fc4types[8];	/* FC-4 Types */
302 } ns_resp_gan_t;
303 
304 typedef struct ns_req_gid_pn {
305 	la_wwn_t	pwwn;
306 } ns_req_gid_pn_t;
307 
308 typedef struct ns_resp_gid_pn {
309 	fc_portid_t	pid;
310 } ns_resp_gid_pn_t;
311 
312 typedef struct ns_req_gpn_id {
313 	fc_portid_t	pid;
314 } ns_req_gpn_id_t;
315 
316 typedef struct ns_resp_gpn_id {
317 	la_wwn_t	pwwn;
318 } ns_resp_gpn_id_t;
319 
320 typedef struct ns_req_gpt_id {
321 	fc_portid_t	pid;
322 } ns_req_gpt_id_t;
323 
324 typedef struct ns_resp_gpt_id {
325 	fc_porttype_t	port_type;
326 } ns_resp_gpt_id_t;
327 
328 #if	!defined(__lint)
329 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_resp_gpn_id))
330 _NOTE(SCHEME_PROTECTS_DATA("unique per request", rxn_id))
331 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_req_gpn_id))
332 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_resp_gid_pn))
333 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_req_gid_pn))
334 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_resp_gan))
335 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_req_gan))
336 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_req_gid_pt))
337 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_req_gpt_id))
338 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ns_resp_gpt_id))
339 _NOTE(SCHEME_PROTECTS_DATA("unique per request", remall))
340 _NOTE(SCHEME_PROTECTS_DATA("unique per request", snn))
341 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ipa))
342 _NOTE(SCHEME_PROTECTS_DATA("unique per request", rip))
343 _NOTE(SCHEME_PROTECTS_DATA("unique per request", rpt))
344 _NOTE(SCHEME_PROTECTS_DATA("unique per request", spn))
345 _NOTE(SCHEME_PROTECTS_DATA("unique per request", rfc_type))
346 _NOTE(SCHEME_PROTECTS_DATA("unique per request", rcos))
347 #endif /* __lint */
348 
349 #ifdef	__cplusplus
350 }
351 #endif
352 
353 #endif	/* _SYS_FIBRE_CHANNEL_IMPL_FCGS2_H */
354