2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
21 #include <protocol/types.h>
26 u32 rev_id
:8; /* Revision of the CT */
27 u32 in_id
:24; /* Initiator Id */
28 u32 gs_type
:8; /* Generic service Type */
29 u32 gs_sub_type
:8; /* Generic service sub type */
30 u32 options
:8; /* options */
31 u32 rsvrd
:8; /* reserved */
32 u32 cmd_rsp_code
:16;/* ct command/response code */
33 u32 max_res_size
:16;/* maximum/residual size */
34 u32 frag_id
:8; /* fragment ID */
35 u32 reason_code
:8; /* reason code */
36 u32 exp_code
:8; /* explanation code */
37 u32 vendor_unq
:8; /* vendor unique */
41 * defines for the Revision
44 CT_GS3_REVISION
= 0x01,
51 CT_GSTYPE_KEYSERVICE
= 0xF7,
52 CT_GSTYPE_ALIASSERVICE
= 0xF8,
53 CT_GSTYPE_MGMTSERVICE
= 0xFA,
54 CT_GSTYPE_TIMESERVICE
= 0xFB,
55 CT_GSTYPE_DIRSERVICE
= 0xFC,
59 * defines for gs_sub_type for gs type directory service
62 CT_GSSUBTYPE_NAMESERVER
= 0x02,
66 * defines for gs_sub_type for gs type management service
69 CT_GSSUBTYPE_CFGSERVER
= 0x01,
70 CT_GSSUBTYPE_UNZONED_NS
= 0x02,
71 CT_GSSUBTYPE_ZONESERVER
= 0x03,
72 CT_GSSUBTYPE_LOCKSERVER
= 0x04,
73 CT_GSSUBTYPE_HBA_MGMTSERVER
= 0x10, /* for FDMI */
77 * defines for CT response code field
80 CT_RSP_REJECT
= 0x8001,
81 CT_RSP_ACCEPT
= 0x8002,
85 * defintions for CT reason code
88 CT_RSN_INV_CMD
= 0x01,
89 CT_RSN_INV_VER
= 0x02,
90 CT_RSN_LOGIC_ERR
= 0x03,
91 CT_RSN_INV_SIZE
= 0x04,
92 CT_RSN_LOGICAL_BUSY
= 0x05,
93 CT_RSN_PROTO_ERR
= 0x07,
94 CT_RSN_UNABLE_TO_PERF
= 0x09,
95 CT_RSN_NOT_SUPP
= 0x0B,
96 CT_RSN_SERVER_NOT_AVBL
= 0x0D,
97 CT_RSN_SESSION_COULD_NOT_BE_ESTBD
= 0x0E,
98 CT_RSN_VENDOR_SPECIFIC
= 0xFF,
103 * definitions for explanations code for Name server
106 CT_NS_EXP_NOADDITIONAL
= 0x00,
107 CT_NS_EXP_ID_NOT_REG
= 0x01,
108 CT_NS_EXP_PN_NOT_REG
= 0x02,
109 CT_NS_EXP_NN_NOT_REG
= 0x03,
110 CT_NS_EXP_CS_NOT_REG
= 0x04,
111 CT_NS_EXP_IPN_NOT_REG
= 0x05,
112 CT_NS_EXP_IPA_NOT_REG
= 0x06,
113 CT_NS_EXP_FT_NOT_REG
= 0x07,
114 CT_NS_EXP_SPN_NOT_REG
= 0x08,
115 CT_NS_EXP_SNN_NOT_REG
= 0x09,
116 CT_NS_EXP_PT_NOT_REG
= 0x0A,
117 CT_NS_EXP_IPP_NOT_REG
= 0x0B,
118 CT_NS_EXP_FPN_NOT_REG
= 0x0C,
119 CT_NS_EXP_HA_NOT_REG
= 0x0D,
120 CT_NS_EXP_FD_NOT_REG
= 0x0E,
121 CT_NS_EXP_FF_NOT_REG
= 0x0F,
122 CT_NS_EXP_ACCESSDENIED
= 0x10,
123 CT_NS_EXP_UNACCEPTABLE_ID
= 0x11,
124 CT_NS_EXP_DATABASEEMPTY
= 0x12,
125 CT_NS_EXP_NOT_REG_IN_SCOPE
= 0x13,
126 CT_NS_EXP_DOM_ID_NOT_PRESENT
= 0x14,
127 CT_NS_EXP_PORT_NUM_NOT_PRESENT
= 0x15,
128 CT_NS_EXP_NO_DEVICE_ATTACHED
= 0x16
132 * defintions for the explanation code for all servers
135 CT_EXP_AUTH_EXCEPTION
= 0xF1,
136 CT_EXP_DB_FULL
= 0xF2,
137 CT_EXP_DB_EMPTY
= 0xF3,
138 CT_EXP_PROCESSING_REQ
= 0xF4,
139 CT_EXP_UNABLE_TO_VERIFY_CONN
= 0xF5,
140 CT_EXP_DEVICES_NOT_IN_CMN_ZONE
= 0xF6
144 * Command codes for Name server
147 GS_GID_PN
= 0x0121, /* Get Id on port name */
148 GS_GPN_ID
= 0x0112, /* Get port name on ID */
149 GS_GNN_ID
= 0x0113, /* Get node name on ID */
150 GS_GID_FT
= 0x0171, /* Get Id on FC4 type */
151 GS_GSPN_ID
= 0x0118, /* Get symbolic PN on ID */
152 GS_RFT_ID
= 0x0217, /* Register fc4type on ID */
153 GS_RSPN_ID
= 0x0218, /* Register symbolic PN on ID */
154 GS_RPN_ID
= 0x0212, /* Register port name */
155 GS_RNN_ID
= 0x0213, /* Register node name */
156 GS_RCS_ID
= 0x0214, /* Register class of service */
157 GS_RPT_ID
= 0x021A, /* Register port type */
158 GS_GA_NXT
= 0x0100, /* Get all next */
159 GS_RFF_ID
= 0x021F, /* Register FC4 Feature */
162 struct fcgs_id_req_s
{
164 u32 dap
:24; /* port identifier */
166 #define fcgs_gpnid_req_t struct fcgs_id_req_s
167 #define fcgs_gnnid_req_t struct fcgs_id_req_s
168 #define fcgs_gspnid_req_t struct fcgs_id_req_s
170 struct fcgs_gidpn_req_s
{
171 wwn_t port_name
; /* port wwn */
174 struct fcgs_gidpn_resp_s
{
176 u32 dap
:24; /* port identifier */
182 struct fcgs_rftid_req_s
{
184 u32 dap
:24; /* port identifier */
185 u32 fc4_type
[8]; /* fc4 types */
189 * RFF_ID : Register FC4 features.
192 #define FC_GS_FCP_FC4_FEATURE_INITIATOR 0x02
193 #define FC_GS_FCP_FC4_FEATURE_TARGET 0x01
195 struct fcgs_rffid_req_s
{
197 u32 dap
:24; /* port identifier */
199 u32 fc4ftr_bits
:8; /* fc4 feature bits */
200 u32 fc4_type
:8; /* corresponding FC4 Type */
206 struct fcgs_gidft_req_s
{
208 u8 domain_id
; /* domain, 0 - all fabric */
209 u8 area_id
; /* area, 0 - whole domain */
210 u8 fc4_type
; /* FC_TYPE_FCP for SCSI devices */
211 }; /* GID_FT Request */
216 struct fcgs_gidft_resp_s
{
217 u8 last
:1; /* last port identifier flag */
219 u32 pid
:24; /* port identifier */
220 }; /* GID_FT Response */
225 struct fcgs_rspnid_req_s
{
227 u32 dap
:24; /* port identifier */
228 u8 spn_len
; /* symbolic port name length */
229 u8 spn
[256]; /* symbolic port name */
235 struct fcgs_rpnid_req_s
{
244 struct fcgs_rnnid_req_s
{
253 struct fcgs_rcsid_req_s
{
262 struct fcgs_rptid_req_s
{
272 struct fcgs_ganxt_req_s
{
280 struct fcgs_ganxt_rsp_s
{
281 u32 port_type
:8; /* Port Type */
282 u32 port_id
:24; /* Port Identifier */
283 wwn_t port_name
; /* Port Name */
284 u8 spn_len
; /* Length of Symbolic Port Name */
285 char spn
[255]; /* Symbolic Port Name */
286 wwn_t node_name
; /* Node Name */
287 u8 snn_len
; /* Length of Symbolic Node Name */
288 char snn
[255]; /* Symbolic Node Name */
289 u8 ipa
[8]; /* Initial Process Associator */
290 u8 ip
[16]; /* IP Address */
291 u32 cos
; /* Class of Service */
292 u32 fc4types
[8]; /* FC-4 TYPEs */
293 wwn_t fabric_port_name
;
294 /* Fabric Port Name */
295 u32 rsvd
:8; /* Reserved */
296 u32 hard_addr
:24; /* Hard Address */
300 * Fabric Config Server
304 * Command codes for Fabric Configuration Server
307 GS_FC_GFN_CMD
= 0x0114, /* GS FC Get Fabric Name */
308 GS_FC_GMAL_CMD
= 0x0116, /* GS FC GMAL */
309 GS_FC_TRACE_CMD
= 0x0400, /* GS FC Trace Route */
310 GS_FC_PING_CMD
= 0x0401, /* GS FC Ping */
314 * Source or Destination Port Tags.
317 GS_FTRACE_TAG_NPORT_ID
= 1,
318 GS_FTRACE_TAG_NPORT_NAME
= 2,
322 * Port Value : Could be a Port id or wwn
324 union fcgs_port_val_u
{
329 #define GS_FTRACE_MAX_HOP_COUNT 20
330 #define GS_FTRACE_REVISION 1
333 * Ftrace Related Structures.
337 * STR (Switch Trace) Reject Reason Codes. From FC-SW.
340 GS_FTRACE_STR_CMD_COMPLETED_SUCC
= 0,
341 GS_FTRACE_STR_CMD_NOT_SUPP_IN_NEXT_SWITCH
,
342 GS_FTRACE_STR_NO_RESP_FROM_NEXT_SWITCH
,
343 GS_FTRACE_STR_MAX_HOP_CNT_REACHED
,
344 GS_FTRACE_STR_SRC_PORT_NOT_FOUND
,
345 GS_FTRACE_STR_DST_PORT_NOT_FOUND
,
346 GS_FTRACE_STR_DEVICES_NOT_IN_COMMON_ZONE
,
347 GS_FTRACE_STR_NO_ROUTE_BW_PORTS
,
348 GS_FTRACE_STR_NO_ADDL_EXPLN
,
349 GS_FTRACE_STR_FABRIC_BUSY
,
350 GS_FTRACE_STR_FABRIC_BUILD_IN_PROGRESS
,
351 GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_START
= 0xf0,
352 GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_END
= 0xff,
358 struct fcgs_ftrace_req_s
{
360 u16 src_port_tag
; /* Source Port tag */
361 u16 src_port_len
; /* Source Port len */
362 union fcgs_port_val_u src_port_val
; /* Source Port value */
363 u16 dst_port_tag
; /* Destination Port tag */
364 u16 dst_port_len
; /* Destination Port len */
365 union fcgs_port_val_u dst_port_val
; /* Destination Port value */
367 u8 vendor_id
[8]; /* T10 Vendor Identifier */
368 u8 vendor_info
[8]; /* Vendor specific Info */
369 u32 max_hop_cnt
; /* Max Hop Count */
373 * Path info structure
375 struct fcgs_ftrace_path_info_s
{
376 wwn_t switch_name
; /* Switch WWN */
378 wwn_t ingress_port_name
; /* Ingress ports wwn */
379 u32 ingress_phys_port_num
; /* Ingress ports physical port
382 wwn_t egress_port_name
; /* Ingress ports wwn */
383 u32 egress_phys_port_num
; /* Ingress ports physical port
389 * Ftrace Acc Response
391 struct fcgs_ftrace_resp_s
{
394 u8 vendor_id
[8]; /* T10 Vendor Identifier */
395 u8 vendor_info
[8]; /* Vendor specific Info */
396 u32 str_rej_reason_code
; /* STR Reject Reason Code */
397 u32 num_path_info_entries
; /* No. of path info entries */
399 * path info entry/entries.
401 struct fcgs_ftrace_path_info_s path_info
[1];
406 * Fabric Config Server : FCPing
412 struct fcgs_fcping_req_s
{
415 u16 port_len
; /* Port len */
416 union fcgs_port_val_u port_val
; /* Port value */
423 struct fcgs_fcping_resp_s
{
428 * Command codes for zone server query.
431 ZS_GZME
= 0x0124, /* Get zone member extended */
437 #define ZS_GZME_ZNAMELEN 32
438 struct zs_gzme_req_s
{
441 u8 zname
[ZS_GZME_ZNAMELEN
];
445 ZS_MBR_TYPE_PWWN
= 1,
446 ZS_MBR_TYPE_DOMPORT
= 2,
447 ZS_MBR_TYPE_PORTID
= 3,
448 ZS_MBR_TYPE_NWWN
= 4,
457 struct zs_query_resp_s
{
458 u32 nmbrs
; /* number of zone members */
459 struct zs_mbr_wwn_s mbr
[1];
463 * GMAL Command ( Get ( interconnect Element) Management Address List)
464 * To retrieve the IP Address of a Switch.
467 #define CT_GMAL_RESP_PREFIX_TELNET "telnet://"
468 #define CT_GMAL_RESP_PREFIX_HTTP "http://"
470 /* GMAL/GFN request */
472 wwn_t wwn
; /* PWWN/NWWN */
475 #define fcgs_gmal_req_t struct fcgs_req_s
476 #define fcgs_gfn_req_t struct fcgs_req_s
478 /* Accept Response to GMAL */
479 struct fcgs_gmal_resp_s
{
480 u32 ms_len
; /* Num of entries */
484 struct fc_gmal_entry_s
{
486 u8 prefix
[7]; /* like "http://" */