ct.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. /*
  2. * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  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
  11. *
  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.
  16. */
  17. #ifndef __CT_H__
  18. #define __CT_H__
  19. #include <protocol/types.h>
  20. #pragma pack(1)
  21. struct ct_hdr_s{
  22. u32 rev_id:8; /* Revision of the CT */
  23. u32 in_id:24; /* Initiator Id */
  24. u32 gs_type:8; /* Generic service Type */
  25. u32 gs_sub_type:8; /* Generic service sub type */
  26. u32 options:8; /* options */
  27. u32 rsvrd:8; /* reserved */
  28. u32 cmd_rsp_code:16;/* ct command/response code */
  29. u32 max_res_size:16;/* maximum/residual size */
  30. u32 frag_id:8; /* fragment ID */
  31. u32 reason_code:8; /* reason code */
  32. u32 exp_code:8; /* explanation code */
  33. u32 vendor_unq:8; /* vendor unique */
  34. };
  35. /*
  36. * defines for the Revision
  37. */
  38. enum {
  39. CT_GS3_REVISION = 0x01,
  40. };
  41. /*
  42. * defines for gs_type
  43. */
  44. enum {
  45. CT_GSTYPE_KEYSERVICE = 0xF7,
  46. CT_GSTYPE_ALIASSERVICE = 0xF8,
  47. CT_GSTYPE_MGMTSERVICE = 0xFA,
  48. CT_GSTYPE_TIMESERVICE = 0xFB,
  49. CT_GSTYPE_DIRSERVICE = 0xFC,
  50. };
  51. /*
  52. * defines for gs_sub_type for gs type directory service
  53. */
  54. enum {
  55. CT_GSSUBTYPE_NAMESERVER = 0x02,
  56. };
  57. /*
  58. * defines for gs_sub_type for gs type management service
  59. */
  60. enum {
  61. CT_GSSUBTYPE_CFGSERVER = 0x01,
  62. CT_GSSUBTYPE_UNZONED_NS = 0x02,
  63. CT_GSSUBTYPE_ZONESERVER = 0x03,
  64. CT_GSSUBTYPE_LOCKSERVER = 0x04,
  65. CT_GSSUBTYPE_HBA_MGMTSERVER = 0x10, /* for FDMI */
  66. };
  67. /*
  68. * defines for CT response code field
  69. */
  70. enum {
  71. CT_RSP_REJECT = 0x8001,
  72. CT_RSP_ACCEPT = 0x8002,
  73. };
  74. /*
  75. * definitions for CT reason code
  76. */
  77. enum {
  78. CT_RSN_INV_CMD = 0x01,
  79. CT_RSN_INV_VER = 0x02,
  80. CT_RSN_LOGIC_ERR = 0x03,
  81. CT_RSN_INV_SIZE = 0x04,
  82. CT_RSN_LOGICAL_BUSY = 0x05,
  83. CT_RSN_PROTO_ERR = 0x07,
  84. CT_RSN_UNABLE_TO_PERF = 0x09,
  85. CT_RSN_NOT_SUPP = 0x0B,
  86. CT_RSN_SERVER_NOT_AVBL = 0x0D,
  87. CT_RSN_SESSION_COULD_NOT_BE_ESTBD = 0x0E,
  88. CT_RSN_VENDOR_SPECIFIC = 0xFF,
  89. };
  90. /*
  91. * definitions for explanations code for Name server
  92. */
  93. enum {
  94. CT_NS_EXP_NOADDITIONAL = 0x00,
  95. CT_NS_EXP_ID_NOT_REG = 0x01,
  96. CT_NS_EXP_PN_NOT_REG = 0x02,
  97. CT_NS_EXP_NN_NOT_REG = 0x03,
  98. CT_NS_EXP_CS_NOT_REG = 0x04,
  99. CT_NS_EXP_IPN_NOT_REG = 0x05,
  100. CT_NS_EXP_IPA_NOT_REG = 0x06,
  101. CT_NS_EXP_FT_NOT_REG = 0x07,
  102. CT_NS_EXP_SPN_NOT_REG = 0x08,
  103. CT_NS_EXP_SNN_NOT_REG = 0x09,
  104. CT_NS_EXP_PT_NOT_REG = 0x0A,
  105. CT_NS_EXP_IPP_NOT_REG = 0x0B,
  106. CT_NS_EXP_FPN_NOT_REG = 0x0C,
  107. CT_NS_EXP_HA_NOT_REG = 0x0D,
  108. CT_NS_EXP_FD_NOT_REG = 0x0E,
  109. CT_NS_EXP_FF_NOT_REG = 0x0F,
  110. CT_NS_EXP_ACCESSDENIED = 0x10,
  111. CT_NS_EXP_UNACCEPTABLE_ID = 0x11,
  112. CT_NS_EXP_DATABASEEMPTY = 0x12,
  113. CT_NS_EXP_NOT_REG_IN_SCOPE = 0x13,
  114. CT_NS_EXP_DOM_ID_NOT_PRESENT = 0x14,
  115. CT_NS_EXP_PORT_NUM_NOT_PRESENT = 0x15,
  116. CT_NS_EXP_NO_DEVICE_ATTACHED = 0x16
  117. };
  118. /*
  119. * definitions for the explanation code for all servers
  120. */
  121. enum {
  122. CT_EXP_AUTH_EXCEPTION = 0xF1,
  123. CT_EXP_DB_FULL = 0xF2,
  124. CT_EXP_DB_EMPTY = 0xF3,
  125. CT_EXP_PROCESSING_REQ = 0xF4,
  126. CT_EXP_UNABLE_TO_VERIFY_CONN = 0xF5,
  127. CT_EXP_DEVICES_NOT_IN_CMN_ZONE = 0xF6
  128. };
  129. /*
  130. * Command codes for Name server
  131. */
  132. enum {
  133. GS_GID_PN = 0x0121, /* Get Id on port name */
  134. GS_GPN_ID = 0x0112, /* Get port name on ID */
  135. GS_GNN_ID = 0x0113, /* Get node name on ID */
  136. GS_GID_FT = 0x0171, /* Get Id on FC4 type */
  137. GS_GSPN_ID = 0x0118, /* Get symbolic PN on ID */
  138. GS_RFT_ID = 0x0217, /* Register fc4type on ID */
  139. GS_RSPN_ID = 0x0218, /* Register symbolic PN on ID */
  140. GS_RPN_ID = 0x0212, /* Register port name */
  141. GS_RNN_ID = 0x0213, /* Register node name */
  142. GS_RCS_ID = 0x0214, /* Register class of service */
  143. GS_RPT_ID = 0x021A, /* Register port type */
  144. GS_GA_NXT = 0x0100, /* Get all next */
  145. GS_RFF_ID = 0x021F, /* Register FC4 Feature */
  146. };
  147. struct fcgs_id_req_s{
  148. u32 rsvd:8;
  149. u32 dap:24; /* port identifier */
  150. };
  151. #define fcgs_gpnid_req_t struct fcgs_id_req_s
  152. #define fcgs_gnnid_req_t struct fcgs_id_req_s
  153. #define fcgs_gspnid_req_t struct fcgs_id_req_s
  154. struct fcgs_gidpn_req_s{
  155. wwn_t port_name; /* port wwn */
  156. };
  157. struct fcgs_gidpn_resp_s{
  158. u32 rsvd:8;
  159. u32 dap:24; /* port identifier */
  160. };
  161. /**
  162. * RFT_ID
  163. */
  164. struct fcgs_rftid_req_s {
  165. u32 rsvd:8;
  166. u32 dap:24; /* port identifier */
  167. u32 fc4_type[8]; /* fc4 types */
  168. };
  169. /**
  170. * RFF_ID : Register FC4 features.
  171. */
  172. #define FC_GS_FCP_FC4_FEATURE_INITIATOR 0x02
  173. #define FC_GS_FCP_FC4_FEATURE_TARGET 0x01
  174. struct fcgs_rffid_req_s{
  175. u32 rsvd:8;
  176. u32 dap:24; /* port identifier */
  177. u32 rsvd1:16;
  178. u32 fc4ftr_bits:8; /* fc4 feature bits */
  179. u32 fc4_type:8; /* corresponding FC4 Type */
  180. };
  181. /**
  182. * GID_FT Request
  183. */
  184. struct fcgs_gidft_req_s{
  185. u8 reserved;
  186. u8 domain_id; /* domain, 0 - all fabric */
  187. u8 area_id; /* area, 0 - whole domain */
  188. u8 fc4_type; /* FC_TYPE_FCP for SCSI devices */
  189. }; /* GID_FT Request */
  190. /**
  191. * GID_FT Response
  192. */
  193. struct fcgs_gidft_resp_s {
  194. u8 last:1; /* last port identifier flag */
  195. u8 reserved:7;
  196. u32 pid:24; /* port identifier */
  197. }; /* GID_FT Response */
  198. /**
  199. * RSPN_ID
  200. */
  201. struct fcgs_rspnid_req_s{
  202. u32 rsvd:8;
  203. u32 dap:24; /* port identifier */
  204. u8 spn_len; /* symbolic port name length */
  205. u8 spn[256]; /* symbolic port name */
  206. };
  207. /**
  208. * RPN_ID
  209. */
  210. struct fcgs_rpnid_req_s{
  211. u32 rsvd:8;
  212. u32 port_id:24;
  213. wwn_t port_name;
  214. };
  215. /**
  216. * RNN_ID
  217. */
  218. struct fcgs_rnnid_req_s{
  219. u32 rsvd:8;
  220. u32 port_id:24;
  221. wwn_t node_name;
  222. };
  223. /**
  224. * RCS_ID
  225. */
  226. struct fcgs_rcsid_req_s{
  227. u32 rsvd:8;
  228. u32 port_id:24;
  229. u32 cos;
  230. };
  231. /**
  232. * RPT_ID
  233. */
  234. struct fcgs_rptid_req_s{
  235. u32 rsvd:8;
  236. u32 port_id:24;
  237. u32 port_type:8;
  238. u32 rsvd1:24;
  239. };
  240. /**
  241. * GA_NXT Request
  242. */
  243. struct fcgs_ganxt_req_s{
  244. u32 rsvd:8;
  245. u32 port_id:24;
  246. };
  247. /**
  248. * GA_NXT Response
  249. */
  250. struct fcgs_ganxt_rsp_s{
  251. u32 port_type:8; /* Port Type */
  252. u32 port_id:24; /* Port Identifier */
  253. wwn_t port_name; /* Port Name */
  254. u8 spn_len; /* Length of Symbolic Port Name */
  255. char spn[255]; /* Symbolic Port Name */
  256. wwn_t node_name; /* Node Name */
  257. u8 snn_len; /* Length of Symbolic Node Name */
  258. char snn[255]; /* Symbolic Node Name */
  259. u8 ipa[8]; /* Initial Process Associator */
  260. u8 ip[16]; /* IP Address */
  261. u32 cos; /* Class of Service */
  262. u32 fc4types[8]; /* FC-4 TYPEs */
  263. wwn_t fabric_port_name;
  264. /* Fabric Port Name */
  265. u32 rsvd:8; /* Reserved */
  266. u32 hard_addr:24; /* Hard Address */
  267. };
  268. /*
  269. * Fabric Config Server
  270. */
  271. /*
  272. * Command codes for Fabric Configuration Server
  273. */
  274. enum {
  275. GS_FC_GFN_CMD = 0x0114, /* GS FC Get Fabric Name */
  276. GS_FC_GMAL_CMD = 0x0116, /* GS FC GMAL */
  277. GS_FC_TRACE_CMD = 0x0400, /* GS FC Trace Route */
  278. GS_FC_PING_CMD = 0x0401, /* GS FC Ping */
  279. };
  280. /*
  281. * Source or Destination Port Tags.
  282. */
  283. enum {
  284. GS_FTRACE_TAG_NPORT_ID = 1,
  285. GS_FTRACE_TAG_NPORT_NAME = 2,
  286. };
  287. /*
  288. * Port Value : Could be a Port id or wwn
  289. */
  290. union fcgs_port_val_u{
  291. u32 nport_id;
  292. wwn_t nport_wwn;
  293. };
  294. #define GS_FTRACE_MAX_HOP_COUNT 20
  295. #define GS_FTRACE_REVISION 1
  296. /*
  297. * Ftrace Related Structures.
  298. */
  299. /*
  300. * STR (Switch Trace) Reject Reason Codes. From FC-SW.
  301. */
  302. enum {
  303. GS_FTRACE_STR_CMD_COMPLETED_SUCC = 0,
  304. GS_FTRACE_STR_CMD_NOT_SUPP_IN_NEXT_SWITCH,
  305. GS_FTRACE_STR_NO_RESP_FROM_NEXT_SWITCH,
  306. GS_FTRACE_STR_MAX_HOP_CNT_REACHED,
  307. GS_FTRACE_STR_SRC_PORT_NOT_FOUND,
  308. GS_FTRACE_STR_DST_PORT_NOT_FOUND,
  309. GS_FTRACE_STR_DEVICES_NOT_IN_COMMON_ZONE,
  310. GS_FTRACE_STR_NO_ROUTE_BW_PORTS,
  311. GS_FTRACE_STR_NO_ADDL_EXPLN,
  312. GS_FTRACE_STR_FABRIC_BUSY,
  313. GS_FTRACE_STR_FABRIC_BUILD_IN_PROGRESS,
  314. GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_START = 0xf0,
  315. GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_END = 0xff,
  316. };
  317. /*
  318. * Ftrace Request
  319. */
  320. struct fcgs_ftrace_req_s{
  321. u32 revision;
  322. u16 src_port_tag; /* Source Port tag */
  323. u16 src_port_len; /* Source Port len */
  324. union fcgs_port_val_u src_port_val; /* Source Port value */
  325. u16 dst_port_tag; /* Destination Port tag */
  326. u16 dst_port_len; /* Destination Port len */
  327. union fcgs_port_val_u dst_port_val; /* Destination Port value */
  328. u32 token;
  329. u8 vendor_id[8]; /* T10 Vendor Identifier */
  330. u8 vendor_info[8]; /* Vendor specific Info */
  331. u32 max_hop_cnt; /* Max Hop Count */
  332. };
  333. /*
  334. * Path info structure
  335. */
  336. struct fcgs_ftrace_path_info_s{
  337. wwn_t switch_name; /* Switch WWN */
  338. u32 domain_id;
  339. wwn_t ingress_port_name; /* Ingress ports wwn */
  340. u32 ingress_phys_port_num; /* Ingress ports physical port
  341. * number
  342. */
  343. wwn_t egress_port_name; /* Ingress ports wwn */
  344. u32 egress_phys_port_num; /* Ingress ports physical port
  345. * number
  346. */
  347. };
  348. /*
  349. * Ftrace Acc Response
  350. */
  351. struct fcgs_ftrace_resp_s{
  352. u32 revision;
  353. u32 token;
  354. u8 vendor_id[8]; /* T10 Vendor Identifier */
  355. u8 vendor_info[8]; /* Vendor specific Info */
  356. u32 str_rej_reason_code; /* STR Reject Reason Code */
  357. u32 num_path_info_entries; /* No. of path info entries */
  358. /*
  359. * path info entry/entries.
  360. */
  361. struct fcgs_ftrace_path_info_s path_info[1];
  362. };
  363. /*
  364. * Fabric Config Server : FCPing
  365. */
  366. /*
  367. * FC Ping Request
  368. */
  369. struct fcgs_fcping_req_s{
  370. u32 revision;
  371. u16 port_tag;
  372. u16 port_len; /* Port len */
  373. union fcgs_port_val_u port_val; /* Port value */
  374. u32 token;
  375. };
  376. /*
  377. * FC Ping Response
  378. */
  379. struct fcgs_fcping_resp_s{
  380. u32 token;
  381. };
  382. /*
  383. * Command codes for zone server query.
  384. */
  385. enum {
  386. ZS_GZME = 0x0124, /* Get zone member extended */
  387. };
  388. /*
  389. * ZS GZME request
  390. */
  391. #define ZS_GZME_ZNAMELEN 32
  392. struct zs_gzme_req_s{
  393. u8 znamelen;
  394. u8 rsvd[3];
  395. u8 zname[ZS_GZME_ZNAMELEN];
  396. };
  397. enum zs_mbr_type{
  398. ZS_MBR_TYPE_PWWN = 1,
  399. ZS_MBR_TYPE_DOMPORT = 2,
  400. ZS_MBR_TYPE_PORTID = 3,
  401. ZS_MBR_TYPE_NWWN = 4,
  402. };
  403. struct zs_mbr_wwn_s{
  404. u8 mbr_type;
  405. u8 rsvd[3];
  406. wwn_t wwn;
  407. };
  408. struct zs_query_resp_s{
  409. u32 nmbrs; /* number of zone members */
  410. struct zs_mbr_wwn_s mbr[1];
  411. };
  412. /*
  413. * GMAL Command ( Get ( interconnect Element) Management Address List)
  414. * To retrieve the IP Address of a Switch.
  415. */
  416. #define CT_GMAL_RESP_PREFIX_TELNET "telnet://"
  417. #define CT_GMAL_RESP_PREFIX_HTTP "http://"
  418. /* GMAL/GFN request */
  419. struct fcgs_req_s {
  420. wwn_t wwn; /* PWWN/NWWN */
  421. };
  422. #define fcgs_gmal_req_t struct fcgs_req_s
  423. #define fcgs_gfn_req_t struct fcgs_req_s
  424. /* Accept Response to GMAL */
  425. struct fcgs_gmal_resp_s {
  426. u32 ms_len; /* Num of entries */
  427. u8 ms_ma[256];
  428. };
  429. struct fc_gmal_entry_s {
  430. u8 len;
  431. u8 prefix[7]; /* like "http://" */
  432. u8 ip_addr[248];
  433. };
  434. #pragma pack()
  435. #endif