xref: /illumos-gate/usr/src/uts/common/sys/fibre-channel/impl/fc_linkapp.h (revision e5803b76927480e8f9b67b22201c484ccf4c2bcf)
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_FC_LINKAPP_H
27 #define	_SYS_FIBRE_CHANNEL_IMPL_FC_LINKAPP_H
28 
29 
30 
31 #include <sys/note.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL)
38 #error	One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
39 #endif	/* _BIT_FIELDS_LTOH */
40 
41 /*
42  * Link Application Opcodes.
43  */
44 #define	LA_ELS_RJT		0x01
45 #define	LA_ELS_ACC		0x02
46 #define	LA_ELS_PLOGI		0x03
47 #define	LA_ELS_FLOGI		0x04
48 #define	LA_ELS_LOGO		0x05
49 #define	LA_ELS_ABTX		0x06
50 #define	LA_ELS_RCS		0x07
51 #define	LA_ELS_RES		0x08
52 #define	LA_ELS_RSS		0x09
53 #define	LA_ELS_RSI		0x0a
54 #define	LA_ELS_ESTS		0x0b
55 #define	LA_ELS_ESTC		0x0c
56 #define	LA_ELS_ADVC		0x0d
57 #define	LA_ELS_RTV		0x0e
58 #define	LA_ELS_RLS		0x0f
59 #define	LA_ELS_ECHO		0x10
60 #define	LA_ELS_RRQ		0x12
61 #define	LA_ELS_PRLI		0x20
62 #define	LA_ELS_PRLO		0x21
63 #define	LA_ELS_SCN		0x22
64 #define	LA_ELS_TPLS		0x23
65 #define	LA_ELS_GPRLO		0x24
66 #define	LA_ELS_GAID		0x30
67 #define	LA_ELS_FACT		0x31
68 #define	LA_ELS_FDACT		0x32
69 #define	LA_ELS_NACT		0x33
70 #define	LA_ELS_NDACT		0x34
71 #define	LA_ELS_QoSR		0x40
72 #define	LA_ELS_RVCS		0x41
73 #define	LA_ELS_PDISC		0x50
74 #define	LA_ELS_FDISC		0x51
75 #define	LA_ELS_ADISC		0x52
76 #define	LA_ELS_RSCN		0x61
77 #define	LA_ELS_SCR		0x62
78 #define	LA_ELS_LINIT		0x70
79 #define	LA_ELS_RNID		0x78
80 
81 /*
82  * LINIT status codes in the ACC
83  */
84 #define	FC_LINIT_SUCCESS	0x01
85 #define	FC_LINIT_FAILURE	0x02
86 
87 /* Basic Accept Payload. */
88 typedef struct la_ba_acc {
89 
90 #if defined(_BIT_FIELDS_LTOH)
91 	uint32_t	org_sid : 24,
92 			seq_id : 8;
93 
94 #else
95 	uint32_t	seq_id : 8,
96 			org_sid : 24;
97 
98 #endif	/* _BIT_FIELDS_LTOH */
99 
100 	uint16_t	ox_id;
101 	uint16_t	rx_id;
102 } la_ba_acc_t;
103 
104 
105 /* Basic Reject. */
106 typedef struct la_ba_rjt {
107 	uchar_t		reserved;
108 	uchar_t		reason_code;
109 	uchar_t		explanation;
110 	uchar_t		vendor;
111 } la_ba_rjt_t;
112 
113 
114 /* Logout payload. */
115 typedef struct la_els_logo {
116 	ls_code_t	ls_code;
117 	fc_portid_t	nport_id;
118 	la_wwn_t	nport_ww_name;
119 } la_els_logo_t;
120 
121 /* Address discovery */
122 typedef	struct la_els_adisc {
123 	ls_code_t	ls_code;
124 	fc_hardaddr_t	hard_addr;
125 	la_wwn_t	port_wwn;
126 	la_wwn_t	node_wwn;
127 	fc_portid_t	nport_id;
128 } la_els_adisc_t;
129 
130 
131 /* Link Application Reject */
132 typedef struct la_els_rjt {
133 	ls_code_t	ls_code;
134 	uchar_t		action;
135 	uchar_t		reason;
136 	uchar_t		reserved;
137 	uchar_t		vu;
138 } la_els_rjt_t;
139 
140 /* Process Login/Logout Service Parameter Page */
141 #define	SP_OPA_VALID			0x8000
142 #define	SP_RPA_VALID			0x4000
143 #define	SP_ESTABLISH_IMAGE_PAIR		0x2000
144 #define	SP_RESP_CODE_MASK		0x0F00
145 #define	SP_RESP_CODE_REQ_EXECUTED	0x0100
146 
147 typedef struct service_parameter_page {
148 	uint8_t		type_code;
149 	uint8_t		type_code_ext;
150 	uint16_t	flags;
151 	uint32_t	opa;
152 	uint32_t	rpa;
153 	uint32_t	sp;
154 } service_parameter_page_t;
155 
156 /* Process login */
157 typedef struct la_els_prli {
158 #if defined(_BIT_FIELDS_LTOH)
159 	uint32_t	payload_length : 16,
160 			page_length : 8,
161 			ls_code : 8;
162 
163 #elif	defined(_BIT_FIELDS_HTOL)
164 	uint32_t	ls_code : 8,
165 			page_length : 8,
166 			payload_length : 16;
167 
168 #endif	/* _BIT_FIELDS_LTOH */
169 	uchar_t		service_params[16];
170 } la_els_prli_t;
171 
172 /* Process Logout */
173 typedef struct la_els_prlo {
174 	uint8_t		ls_code;
175 	uint8_t		page_length;
176 	uint16_t	payload_length;
177 	uint8_t		type_code;
178 	uint8_t		type_code_extension;
179 	uint16_t	flags;
180 	uint32_t	opa;
181 	uint32_t	rpa;
182 	uint32_t	reserved;
183 } la_els_prlo_t;
184 
185 #if	!defined(__lint)
186 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_ba_rjt))
187 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_logo))
188 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_adisc))
189 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_rjt))
190 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_prli_t))
191 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_ba_acc))
192 #endif /* __lint */
193 
194 
195 #ifdef	__cplusplus
196 }
197 #endif
198 
199 #endif	/* _SYS_FIBRE_CHANNEL_IMPL_FC_LINKAPP_H */
200