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.
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.
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]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
35 #if !defined(_BIT_FIELDS_LTOH) && !defined(_BIT_FIELDS_HTOL)
36 #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
37 #endif /* _BIT_FIELDS_LTOH */
40 * Local port topology definitions
42 * fp/fctl use these a lot with the fp_topology field in the fc_port_t struct,
43 * but use is not limited to fp_topology. These are also understood by ULPs.
45 #define FC_TOP_UNKNOWN 0
46 #define FC_TOP_PRIVATE_LOOP 1
47 #define FC_TOP_PUBLIC_LOOP 2
48 #define FC_TOP_FABRIC 3
49 #define FC_TOP_PT_PT 4
50 #define FC_TOP_NO_NS 5
53 * Macros used with the preceeding topology #defines.
54 * fp/fctl use these a lot with the fp_topology field in the fc_port_t struct,
55 * but use is not limited to fp_topology. These are also understood by ULPs.
57 #define FC_TOP_EXTERNAL(t) FC_IS_TOP_SWITCH(t)
58 #define FC_IS_TOP_SWITCH(t) (((t) == FC_TOP_FABRIC) ||\
59 ((t) == FC_TOP_PUBLIC_LOOP))
62 * fc_remote_port state (map_state) definitions.
64 * Used with the pd_state field in the fc_remote_port_t struct.
66 #define PORT_DEVICE_INVALID 0 /* State when created or login failed */
67 #define PORT_DEVICE_VALID 1 /* Logged out */
68 #define PORT_DEVICE_LOGGED_IN 2 /* Logged in */
72 * Firmware, FCode revision field lengths
74 #define FC_FCODE_REV_SIZE 25
75 #define FC_FW_REV_SIZE 25
77 typedef struct ct_header
{
78 #if defined(_BIT_FIELDS_LTOH)
79 uint32_t ct_inid
: 24, /* Initial Node ID */
80 ct_rev
: 8; /* Revision */
82 uint32_t ct_reserved1
: 8,
87 uint32_t ct_aiusize
: 16,
90 uint32_t ct_vendor
: 8,
96 uint32_t ct_rev
: 8, /* revision */
97 ct_inid
: 24; /* initial node ID */
98 uint32_t ct_fcstype
: 8, /* type of service */
99 ct_fcssubtype
: 8, /* subtype of service */
100 ct_options
: 8, /* options */
101 ct_reserved1
: 8; /* reserved */
103 uint32_t ct_cmdrsp
: 16, /* command/response code */
104 ct_aiusize
: 16; /* AIU/residual size */
106 uint32_t ct_reserved2
: 8, /* reserved */
107 ct_reason
: 8, /* reason code */
108 ct_expln
: 8, /* reason explanation */
109 ct_vendor
: 8; /* vendor unique */
111 #endif /* _BIT_FIELDS_LTOH */
114 /* World Wide Name format */
115 typedef union la_wwn
{
119 #if defined(_BIT_FIELDS_LTOH)
121 uint32_t wwn_hi
: 16,
134 #endif /* _BIT_FIELDS_LTOH */
140 #define NAA_ID_IEEE 1
141 #define NAA_ID_IEEE_EXTENDED 2
144 #define FC_WWN_SIZE (sizeof (la_wwn_t))
145 #endif /* FC_WWN_SIZE */
147 typedef struct service_param
{
149 uint16_t initiator_ctl
;
150 uint16_t recipient_ctl
;
152 uint16_t conc_sequences
;
153 uint16_t n_port_e_to_e_credit
;
154 uint16_t open_seq_per_xchng
;
158 typedef struct common_service
{
159 uint16_t fcph_version
;
160 uint16_t btob_credit
;
161 uint16_t cmn_features
;
163 uint16_t conc_sequences
;
164 uint16_t relative_offset
;
168 typedef struct ls_code
{
169 #if defined(_BIT_FIELDS_LTOH)
174 uint32_t ls_code
: 8,
176 #endif /* _BIT_FIELDS_LTOH */
181 typedef struct la_els_logi
{
183 com_svc_t common_service
;
185 la_wwn_t nport_ww_name
;
186 la_wwn_t node_ww_name
;
192 uchar_t reserved
[16];
193 uchar_t vendor_version
[16];
196 typedef struct fc_ns_cmd
{
197 uint32_t ns_flags
; /* for future use */
198 uint16_t ns_cmd
; /* NS command type */
200 caddr_t ns_req_payload
; /* No CT header */
201 uint16_t ns_resp_len
;
202 caddr_t ns_resp_payload
; /* no CT header */
203 void *ns_fctl_private
; /* Transport private */
204 fc_ct_header_t ns_resp_hdr
; /* for the curious */
207 #if defined(_SYSCALL32)
209 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
213 typedef struct la_els_logi32
{
215 com_svc_t common_service
;
216 la_wwn_t nport_ww_name
;
217 la_wwn_t node_ww_name
;
221 uchar_t reserved
[16];
222 uchar_t vendor_version
[16];
225 typedef struct fc_ns_cmd32
{
226 uint32_t ns_flags
; /* for future use */
227 uint16_t ns_cmd
; /* NS command type */
229 caddr_t ns_req_payload
; /* No CT header */
230 uint16_t ns_resp_len
;
231 caddr_t ns_resp_payload
; /* no CT header */
232 void *ns_fctl_private
; /* Transport private */
233 fc_ct_header_t ns_resp_hdr
; /* for the curious */
236 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
240 #endif /* _SYSCALL32 */
242 /* Link Error Parameters in the RLS Accept payload */
243 typedef struct fc_rls_acc_params
{
244 uint32_t rls_link_fail
; /* link failure count */
245 uint32_t rls_sync_loss
; /* loss of sync count */
246 uint32_t rls_sig_loss
; /* loss of signal count */
247 uint32_t rls_prim_seq_err
; /* primitive seq error */
248 uint32_t rls_invalid_word
; /* invalid tx word */
249 uint32_t rls_invalid_crc
; /* invalid CRC count */
253 typedef struct la_els_rls
{
255 fc_portid_t rls_portid
; /* port identifier */
258 /* RLS accept payload */
259 typedef struct la_els_rls_acc
{
261 fc_rls_acc_t rls_link_params
; /* link error status block */
264 /* Node Id Parameters in the RNID Get/Set Accept/Request payload */
265 typedef struct fc_rnid_params
{
266 uchar_t global_id
[16]; /* global name */
267 uint32_t unit_type
; /* unit type */
268 uint32_t port_id
; /* port id */
269 uint32_t num_attached
; /* number of attached nodes */
270 uint16_t ip_version
; /* ip version */
271 uint16_t udp_port
; /* udp port number */
272 uchar_t ip_addr
[16]; /* ip address */
273 uint16_t specific_id_resv
; /* reserved */
274 uint16_t topo_flags
; /* topology discovery flags */
277 /* RNID get data format flag */
278 #define FCIO_CFLAGS_RNID_GET_GENERAL_TOPOLOGY 0xDF
279 #define FCIO_CFLAGS_RNID_GET_VENDOR_SPECIFIC 0xE0
281 /* RNID maximum data length - common data(16) + specific data(252) */
282 #define FCIO_RNID_MAX_DATA_LEN 268
285 typedef struct la_els_rnid
{
287 uchar_t data_format
; /* data format returned */
293 * - cmn_len can be 0 or 16 - if it is 0 then specific data starts at
294 * offset 8 else specific data starts at offset 24 in the RNID els response
296 typedef struct fc_rnid_hdr
{
300 uchar_t specific_len
;
303 typedef struct la_els_rnid_acc
{
306 uchar_t data
[FCIO_RNID_MAX_DATA_LEN
];
309 typedef struct la_npiv_create_entry
{
313 } la_npiv_create_entry_t
;
316 _NOTE(SCHEME_PROTECTS_DATA("unique per request", fc_ns_cmd
))
317 _NOTE(SCHEME_PROTECTS_DATA("unique per request", ct_header
))
318 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_logi
))
319 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_wwn
))
320 _NOTE(SCHEME_PROTECTS_DATA("unique per request", fc_rls_acc_params
))
321 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_rls
))
322 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_rls_acc
))
323 _NOTE(SCHEME_PROTECTS_DATA("unique per request", fc_rnid_params
))
324 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_rnid
))
325 _NOTE(SCHEME_PROTECTS_DATA("unique per request", la_els_rnid_acc
))
332 #endif /* _FC_APPIF_H */