fc.h 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111
  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 __FC_H__
  18. #define __FC_H__
  19. #include <protocol/types.h>
  20. #pragma pack(1)
  21. /*
  22. * Fibre Channel Header Structure (FCHS) definition
  23. */
  24. struct fchs_s {
  25. #ifdef __BIGENDIAN
  26. u32 routing:4; /* routing bits */
  27. u32 cat_info:4; /* category info */
  28. #else
  29. u32 cat_info:4; /* category info */
  30. u32 routing:4; /* routing bits */
  31. #endif
  32. u32 d_id:24; /* destination identifier */
  33. u32 cs_ctl:8; /* class specific control */
  34. u32 s_id:24; /* source identifier */
  35. u32 type:8; /* data structure type */
  36. u32 f_ctl:24; /* initial frame control */
  37. u8 seq_id; /* sequence identifier */
  38. u8 df_ctl; /* data field control */
  39. u16 seq_cnt; /* sequence count */
  40. u16 ox_id; /* originator exchange ID */
  41. u16 rx_id; /* responder exchange ID */
  42. u32 ro; /* relative offset */
  43. };
  44. #define FC_SOF_LEN 4
  45. #define FC_EOF_LEN 4
  46. #define FC_CRC_LEN 4
  47. /*
  48. * Fibre Channel BB_E Header Structure
  49. */
  50. struct fcbbehs_s {
  51. u16 ver_rsvd;
  52. u32 rsvd[2];
  53. u32 rsvd__sof;
  54. };
  55. #define FC_SEQ_ID_MAX 256
  56. /*
  57. * routing bit definitions
  58. */
  59. enum {
  60. FC_RTG_FC4_DEV_DATA = 0x0, /* FC-4 Device Data */
  61. FC_RTG_EXT_LINK = 0x2, /* Extended Link Data */
  62. FC_RTG_FC4_LINK_DATA = 0x3, /* FC-4 Link Data */
  63. FC_RTG_VIDEO_DATA = 0x4, /* Video Data */
  64. FC_RTG_EXT_HDR = 0x5, /* VFT, IFR or Encapsuled */
  65. FC_RTG_BASIC_LINK = 0x8, /* Basic Link data */
  66. FC_RTG_LINK_CTRL = 0xC, /* Link Control */
  67. };
  68. /*
  69. * information category for extended link data and FC-4 Link Data
  70. */
  71. enum {
  72. FC_CAT_LD_REQUEST = 0x2, /* Request */
  73. FC_CAT_LD_REPLY = 0x3, /* Reply */
  74. FC_CAT_LD_DIAG = 0xF, /* for DIAG use only */
  75. };
  76. /*
  77. * information category for extended headers (VFT, IFR or encapsulation)
  78. */
  79. enum {
  80. FC_CAT_VFT_HDR = 0x0, /* Virtual fabric tagging header */
  81. FC_CAT_IFR_HDR = 0x1, /* Inter-Fabric routing header */
  82. FC_CAT_ENC_HDR = 0x2, /* Encapsulation header */
  83. };
  84. /*
  85. * information category for FC-4 device data
  86. */
  87. enum {
  88. FC_CAT_UNCATEG_INFO = 0x0, /* Uncategorized information */
  89. FC_CAT_SOLICIT_DATA = 0x1, /* Solicited Data */
  90. FC_CAT_UNSOLICIT_CTRL = 0x2, /* Unsolicited Control */
  91. FC_CAT_SOLICIT_CTRL = 0x3, /* Solicited Control */
  92. FC_CAT_UNSOLICIT_DATA = 0x4, /* Unsolicited Data */
  93. FC_CAT_DATA_DESC = 0x5, /* Data Descriptor */
  94. FC_CAT_UNSOLICIT_CMD = 0x6, /* Unsolicited Command */
  95. FC_CAT_CMD_STATUS = 0x7, /* Command Status */
  96. };
  97. /*
  98. * information category for Link Control
  99. */
  100. enum {
  101. FC_CAT_ACK_1 = 0x00,
  102. FC_CAT_ACK_0_N = 0x01,
  103. FC_CAT_P_RJT = 0x02,
  104. FC_CAT_F_RJT = 0x03,
  105. FC_CAT_P_BSY = 0x04,
  106. FC_CAT_F_BSY_DATA = 0x05,
  107. FC_CAT_F_BSY_LINK_CTL = 0x06,
  108. FC_CAT_F_LCR = 0x07,
  109. FC_CAT_NTY = 0x08,
  110. FC_CAT_END = 0x09,
  111. };
  112. /*
  113. * Type Field Definitions. FC-PH Section 18.5 pg. 165
  114. */
  115. enum {
  116. FC_TYPE_BLS = 0x0, /* Basic Link Service */
  117. FC_TYPE_ELS = 0x1, /* Extended Link Service */
  118. FC_TYPE_IP = 0x5, /* IP */
  119. FC_TYPE_FCP = 0x8, /* SCSI-FCP */
  120. FC_TYPE_GPP = 0x9, /* SCSI_GPP */
  121. FC_TYPE_SERVICES = 0x20, /* Fibre Channel Services */
  122. FC_TYPE_FC_FSS = 0x22, /* Fabric Switch Services */
  123. FC_TYPE_FC_AL = 0x23, /* FC-AL */
  124. FC_TYPE_FC_SNMP = 0x24, /* FC-SNMP */
  125. FC_TYPE_MAX = 256, /* 256 FC-4 types */
  126. };
  127. struct fc_fc4types_s{
  128. u8 bits[FC_TYPE_MAX / 8];
  129. };
  130. /*
  131. * Frame Control Definitions. FC-PH Table-45. pg. 168
  132. */
  133. enum {
  134. FCTL_EC_ORIG = 0x000000, /* exchange originator */
  135. FCTL_EC_RESP = 0x800000, /* exchange responder */
  136. FCTL_SEQ_INI = 0x000000, /* sequence initiator */
  137. FCTL_SEQ_REC = 0x400000, /* sequence recipient */
  138. FCTL_FS_EXCH = 0x200000, /* first sequence of xchg */
  139. FCTL_LS_EXCH = 0x100000, /* last sequence of xchg */
  140. FCTL_END_SEQ = 0x080000, /* last frame of sequence */
  141. FCTL_SI_XFER = 0x010000, /* seq initiative transfer */
  142. FCTL_RO_PRESENT = 0x000008, /* relative offset present */
  143. FCTL_FILLBYTE_MASK = 0x000003 /* , fill byte mask */
  144. };
  145. /*
  146. * Fabric Well Known Addresses
  147. */
  148. enum {
  149. FC_MIN_WELL_KNOWN_ADDR = 0xFFFFF0,
  150. FC_DOMAIN_CONTROLLER_MASK = 0xFFFC00,
  151. FC_ALIAS_SERVER = 0xFFFFF8,
  152. FC_MGMT_SERVER = 0xFFFFFA,
  153. FC_TIME_SERVER = 0xFFFFFB,
  154. FC_NAME_SERVER = 0xFFFFFC,
  155. FC_FABRIC_CONTROLLER = 0xFFFFFD,
  156. FC_FABRIC_PORT = 0xFFFFFE,
  157. FC_BROADCAST_SERVER = 0xFFFFFF
  158. };
  159. /*
  160. * domain/area/port defines
  161. */
  162. #define FC_DOMAIN_MASK 0xFF0000
  163. #define FC_DOMAIN_SHIFT 16
  164. #define FC_AREA_MASK 0x00FF00
  165. #define FC_AREA_SHIFT 8
  166. #define FC_PORT_MASK 0x0000FF
  167. #define FC_PORT_SHIFT 0
  168. #define FC_GET_DOMAIN(p) (((p) & FC_DOMAIN_MASK) >> FC_DOMAIN_SHIFT)
  169. #define FC_GET_AREA(p) (((p) & FC_AREA_MASK) >> FC_AREA_SHIFT)
  170. #define FC_GET_PORT(p) (((p) & FC_PORT_MASK) >> FC_PORT_SHIFT)
  171. #define FC_DOMAIN_CTRLR(p) (FC_DOMAIN_CONTROLLER_MASK | (FC_GET_DOMAIN(p)))
  172. enum {
  173. FC_RXID_ANY = 0xFFFFU,
  174. };
  175. /*
  176. * generic ELS command
  177. */
  178. struct fc_els_cmd_s{
  179. u32 els_code:8; /* ELS Command Code */
  180. u32 reserved:24;
  181. };
  182. /*
  183. * ELS Command Codes. FC-PH Table-75. pg. 223
  184. */
  185. enum {
  186. FC_ELS_LS_RJT = 0x1, /* Link Service Reject. */
  187. FC_ELS_ACC = 0x02, /* Accept */
  188. FC_ELS_PLOGI = 0x03, /* N_Port Login. */
  189. FC_ELS_FLOGI = 0x04, /* F_Port Login. */
  190. FC_ELS_LOGO = 0x05, /* Logout. */
  191. FC_ELS_ABTX = 0x06, /* Abort Exchange */
  192. FC_ELS_RES = 0x08, /* Read Exchange status */
  193. FC_ELS_RSS = 0x09, /* Read sequence status block */
  194. FC_ELS_RSI = 0x0A, /* Request Sequence Initiative */
  195. FC_ELS_ESTC = 0x0C, /* Estimate Credit. */
  196. FC_ELS_RTV = 0x0E, /* Read Timeout Value. */
  197. FC_ELS_RLS = 0x0F, /* Read Link Status. */
  198. FC_ELS_ECHO = 0x10, /* Echo */
  199. FC_ELS_TEST = 0x11, /* Test */
  200. FC_ELS_RRQ = 0x12, /* Reinstate Recovery Qualifier. */
  201. FC_ELS_REC = 0x13, /* Add this for TAPE support in FCR */
  202. FC_ELS_PRLI = 0x20, /* Process Login */
  203. FC_ELS_PRLO = 0x21, /* Process Logout. */
  204. FC_ELS_SCN = 0x22, /* State Change Notification. */
  205. FC_ELS_TPRLO = 0x24, /* Third Party Process Logout. */
  206. FC_ELS_PDISC = 0x50, /* Discover N_Port Parameters. */
  207. FC_ELS_FDISC = 0x51, /* Discover F_Port Parameters. */
  208. FC_ELS_ADISC = 0x52, /* Discover Address. */
  209. FC_ELS_FAN = 0x60, /* Fabric Address Notification */
  210. FC_ELS_RSCN = 0x61, /* Reg State Change Notification */
  211. FC_ELS_SCR = 0x62, /* State Change Registration. */
  212. FC_ELS_RTIN = 0x77, /* Mangement server request */
  213. FC_ELS_RNID = 0x78, /* Mangement server request */
  214. FC_ELS_RLIR = 0x79, /* Registered Link Incident Record */
  215. FC_ELS_RPSC = 0x7D, /* Report Port Speed Capabilities */
  216. FC_ELS_QSA = 0x7E, /* Query Security Attributes. Ref FC-SP */
  217. FC_ELS_E2E_LBEACON = 0x81,
  218. /* End-to-End Link Beacon */
  219. FC_ELS_AUTH = 0x90, /* Authentication. Ref FC-SP */
  220. FC_ELS_RFCN = 0x97, /* Request Fabric Change Notification. Ref
  221. *FC-SP */
  222. };
  223. /*
  224. * Version numbers for FC-PH standards,
  225. * used in login to indicate what port
  226. * supports. See FC-PH-X table 158.
  227. */
  228. enum {
  229. FC_PH_VER_4_3 = 0x09,
  230. FC_PH_VER_PH_3 = 0x20,
  231. };
  232. /*
  233. * PDU size defines
  234. */
  235. enum {
  236. FC_MIN_PDUSZ = 512,
  237. FC_MAX_PDUSZ = 2112,
  238. };
  239. /*
  240. * N_Port PLOGI Common Service Parameters.
  241. * FC-PH-x. Figure-76. pg. 308.
  242. */
  243. struct fc_plogi_csp_s{
  244. u8 verhi; /* FC-PH high version */
  245. u8 verlo; /* FC-PH low version */
  246. u16 bbcred; /* BB_Credit */
  247. #ifdef __BIGENDIAN
  248. u8 ciro:1, /* continuously increasing RO */
  249. rro:1, /* random relative offset */
  250. npiv_supp:1, /* NPIV supported */
  251. port_type:1, /* N_Port/F_port */
  252. altbbcred:1, /* alternate BB_Credit */
  253. resolution:1, /* ms/ns ED_TOV resolution */
  254. vvl_info:1, /* VVL Info included */
  255. reserved1:1;
  256. u8 hg_supp:1,
  257. query_dbc:1,
  258. security:1,
  259. sync_cap:1,
  260. r_t_tov:1,
  261. dh_dup_supp:1,
  262. cisc:1, /* continuously increasing seq count */
  263. payload:1;
  264. #else
  265. u8 reserved2:2,
  266. resolution:1, /* ms/ns ED_TOV resolution */
  267. altbbcred:1, /* alternate BB_Credit */
  268. port_type:1, /* N_Port/F_port */
  269. npiv_supp:1, /* NPIV supported */
  270. rro:1, /* random relative offset */
  271. ciro:1; /* continuously increasing RO */
  272. u8 payload:1,
  273. cisc:1, /* continuously increasing seq count */
  274. dh_dup_supp:1,
  275. r_t_tov:1,
  276. sync_cap:1,
  277. security:1,
  278. query_dbc:1,
  279. hg_supp:1;
  280. #endif
  281. u16 rxsz; /* recieve data_field size */
  282. u16 conseq;
  283. u16 ro_bitmap;
  284. u32 e_d_tov;
  285. };
  286. /*
  287. * N_Port PLOGI Class Specific Parameters.
  288. * FC-PH-x. Figure 78. pg. 318.
  289. */
  290. struct fc_plogi_clp_s{
  291. #ifdef __BIGENDIAN
  292. u32 class_valid:1;
  293. u32 intermix:1; /* class intermix supported if set =1.
  294. * valid only for class1. Reserved for
  295. * class2 & class3
  296. */
  297. u32 reserved1:2;
  298. u32 sequential:1;
  299. u32 reserved2:3;
  300. #else
  301. u32 reserved2:3;
  302. u32 sequential:1;
  303. u32 reserved1:2;
  304. u32 intermix:1; /* class intermix supported if set =1.
  305. * valid only for class1. Reserved for
  306. * class2 & class3
  307. */
  308. u32 class_valid:1;
  309. #endif
  310. u32 reserved3:24;
  311. u32 reserved4:16;
  312. u32 rxsz:16; /* Receive data_field size */
  313. u32 reserved5:8;
  314. u32 conseq:8;
  315. u32 e2e_credit:16; /* end to end credit */
  316. u32 reserved7:8;
  317. u32 ospx:8;
  318. u32 reserved8:16;
  319. };
  320. #define FLOGI_VVL_BRCD 0x42524344 /* ASCII value for each character in
  321. * string "BRCD" */
  322. /*
  323. * PLOGI els command and reply payload
  324. */
  325. struct fc_logi_s{
  326. struct fc_els_cmd_s els_cmd; /* ELS command code */
  327. struct fc_plogi_csp_s csp; /* common service params */
  328. wwn_t port_name;
  329. wwn_t node_name;
  330. struct fc_plogi_clp_s class1; /* class 1 service parameters */
  331. struct fc_plogi_clp_s class2; /* class 2 service parameters */
  332. struct fc_plogi_clp_s class3; /* class 3 service parameters */
  333. struct fc_plogi_clp_s class4; /* class 4 service parameters */
  334. u8 vvl[16]; /* vendor version level */
  335. };
  336. /*
  337. * LOGO els command payload
  338. */
  339. struct fc_logo_s{
  340. struct fc_els_cmd_s els_cmd; /* ELS command code */
  341. u32 res1:8;
  342. u32 nport_id:24; /* N_Port identifier of source */
  343. wwn_t orig_port_name; /* Port name of the LOGO originator */
  344. };
  345. /*
  346. * ADISC els command payload
  347. */
  348. struct fc_adisc_s {
  349. struct fc_els_cmd_s els_cmd; /* ELS command code */
  350. u32 res1:8;
  351. u32 orig_HA:24; /* originator hard address */
  352. wwn_t orig_port_name; /* originator port name */
  353. wwn_t orig_node_name; /* originator node name */
  354. u32 res2:8;
  355. u32 nport_id:24; /* originator NPortID */
  356. };
  357. /*
  358. * Exchange status block
  359. */
  360. struct fc_exch_status_blk_s{
  361. u32 oxid:16;
  362. u32 rxid:16;
  363. u32 res1:8;
  364. u32 orig_np:24; /* originator NPortID */
  365. u32 res2:8;
  366. u32 resp_np:24; /* responder NPortID */
  367. u32 es_bits;
  368. u32 res3;
  369. /*
  370. * un modified section of the fields
  371. */
  372. };
  373. /*
  374. * RES els command payload
  375. */
  376. struct fc_res_s {
  377. struct fc_els_cmd_s els_cmd; /* ELS command code */
  378. u32 res1:8;
  379. u32 nport_id:24; /* N_Port identifier of source */
  380. u32 oxid:16;
  381. u32 rxid:16;
  382. u8 assoc_hdr[32];
  383. };
  384. /*
  385. * RES els accept payload
  386. */
  387. struct fc_res_acc_s{
  388. struct fc_els_cmd_s els_cmd; /* ELS command code */
  389. struct fc_exch_status_blk_s fc_exch_blk; /* Exchange status block */
  390. };
  391. /*
  392. * REC els command payload
  393. */
  394. struct fc_rec_s {
  395. struct fc_els_cmd_s els_cmd; /* ELS command code */
  396. u32 res1:8;
  397. u32 nport_id:24; /* N_Port identifier of source */
  398. u32 oxid:16;
  399. u32 rxid:16;
  400. };
  401. #define FC_REC_ESB_OWN_RSP 0x80000000 /* responder owns */
  402. #define FC_REC_ESB_SI 0x40000000 /* SI is owned */
  403. #define FC_REC_ESB_COMP 0x20000000 /* exchange is complete */
  404. #define FC_REC_ESB_ENDCOND_ABN 0x10000000 /* abnormal ending */
  405. #define FC_REC_ESB_RQACT 0x04000000 /* recovery qual active */
  406. #define FC_REC_ESB_ERRP_MSK 0x03000000
  407. #define FC_REC_ESB_OXID_INV 0x00800000 /* invalid OXID */
  408. #define FC_REC_ESB_RXID_INV 0x00400000 /* invalid RXID */
  409. #define FC_REC_ESB_PRIO_INUSE 0x00200000
  410. /*
  411. * REC els accept payload
  412. */
  413. struct fc_rec_acc_s {
  414. struct fc_els_cmd_s els_cmd; /* ELS command code */
  415. u32 oxid:16;
  416. u32 rxid:16;
  417. u32 res1:8;
  418. u32 orig_id:24; /* N_Port id of exchange originator */
  419. u32 res2:8;
  420. u32 resp_id:24; /* N_Port id of exchange responder */
  421. u32 count; /* data transfer count */
  422. u32 e_stat; /* exchange status */
  423. };
  424. /*
  425. * RSI els payload
  426. */
  427. struct fc_rsi_s {
  428. struct fc_els_cmd_s els_cmd;
  429. u32 res1:8;
  430. u32 orig_sid:24;
  431. u32 oxid:16;
  432. u32 rxid:16;
  433. };
  434. /*
  435. * structure for PRLI paramater pages, both request & response
  436. * see FC-PH-X table 113 & 115 for explanation also FCP table 8
  437. */
  438. struct fc_prli_params_s{
  439. u32 reserved:16;
  440. #ifdef __BIGENDIAN
  441. u32 reserved1:5;
  442. u32 rec_support:1;
  443. u32 task_retry_id:1;
  444. u32 retry:1;
  445. u32 confirm:1;
  446. u32 doverlay:1;
  447. u32 initiator:1;
  448. u32 target:1;
  449. u32 cdmix:1;
  450. u32 drmix:1;
  451. u32 rxrdisab:1;
  452. u32 wxrdisab:1;
  453. #else
  454. u32 retry:1;
  455. u32 task_retry_id:1;
  456. u32 rec_support:1;
  457. u32 reserved1:5;
  458. u32 wxrdisab:1;
  459. u32 rxrdisab:1;
  460. u32 drmix:1;
  461. u32 cdmix:1;
  462. u32 target:1;
  463. u32 initiator:1;
  464. u32 doverlay:1;
  465. u32 confirm:1;
  466. #endif
  467. };
  468. /*
  469. * valid values for rspcode in PRLI ACC payload
  470. */
  471. enum {
  472. FC_PRLI_ACC_XQTD = 0x1, /* request executed */
  473. FC_PRLI_ACC_PREDEF_IMG = 0x5, /* predefined image - no prli needed */
  474. };
  475. struct fc_prli_params_page_s{
  476. u32 type:8;
  477. u32 codext:8;
  478. #ifdef __BIGENDIAN
  479. u32 origprocasv:1;
  480. u32 rsppav:1;
  481. u32 imagepair:1;
  482. u32 reserved1:1;
  483. u32 rspcode:4;
  484. #else
  485. u32 rspcode:4;
  486. u32 reserved1:1;
  487. u32 imagepair:1;
  488. u32 rsppav:1;
  489. u32 origprocasv:1;
  490. #endif
  491. u32 reserved2:8;
  492. u32 origprocas;
  493. u32 rspprocas;
  494. struct fc_prli_params_s servparams;
  495. };
  496. /*
  497. * PRLI request and accept payload, FC-PH-X tables 112 & 114
  498. */
  499. struct fc_prli_s{
  500. u32 command:8;
  501. u32 pglen:8;
  502. u32 pagebytes:16;
  503. struct fc_prli_params_page_s parampage;
  504. };
  505. /*
  506. * PRLO logout params page
  507. */
  508. struct fc_prlo_params_page_s{
  509. u32 type:8;
  510. u32 type_ext:8;
  511. #ifdef __BIGENDIAN
  512. u32 opa_valid:1; /* originator process associator
  513. * valid
  514. */
  515. u32 rpa_valid:1; /* responder process associator valid */
  516. u32 res1:14;
  517. #else
  518. u32 res1:14;
  519. u32 rpa_valid:1; /* responder process associator valid */
  520. u32 opa_valid:1; /* originator process associator
  521. * valid
  522. */
  523. #endif
  524. u32 orig_process_assc;
  525. u32 resp_process_assc;
  526. u32 res2;
  527. };
  528. /*
  529. * PRLO els command payload
  530. */
  531. struct fc_prlo_s{
  532. u32 command:8;
  533. u32 page_len:8;
  534. u32 payload_len:16;
  535. struct fc_prlo_params_page_s prlo_params[1];
  536. };
  537. /*
  538. * PRLO Logout response parameter page
  539. */
  540. struct fc_prlo_acc_params_page_s{
  541. u32 type:8;
  542. u32 type_ext:8;
  543. #ifdef __BIGENDIAN
  544. u32 opa_valid:1; /* originator process associator
  545. * valid
  546. */
  547. u32 rpa_valid:1; /* responder process associator valid */
  548. u32 res1:14;
  549. #else
  550. u32 res1:14;
  551. u32 rpa_valid:1; /* responder process associator valid */
  552. u32 opa_valid:1; /* originator process associator
  553. * valid
  554. */
  555. #endif
  556. u32 orig_process_assc;
  557. u32 resp_process_assc;
  558. u32 fc4type_csp;
  559. };
  560. /*
  561. * PRLO els command ACC payload
  562. */
  563. struct fc_prlo_acc_s{
  564. u32 command:8;
  565. u32 page_len:8;
  566. u32 payload_len:16;
  567. struct fc_prlo_acc_params_page_s prlo_acc_params[1];
  568. };
  569. /*
  570. * SCR els command payload
  571. */
  572. enum {
  573. FC_SCR_REG_FUNC_FABRIC_DETECTED = 0x01,
  574. FC_SCR_REG_FUNC_N_PORT_DETECTED = 0x02,
  575. FC_SCR_REG_FUNC_FULL = 0x03,
  576. FC_SCR_REG_FUNC_CLEAR_REG = 0xFF,
  577. };
  578. /* SCR VU registrations */
  579. enum {
  580. FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE = 0x01
  581. };
  582. struct fc_scr_s{
  583. u32 command:8;
  584. u32 res:24;
  585. u32 vu_reg_func:8; /* Vendor Unique Registrations */
  586. u32 res1:16;
  587. u32 reg_func:8;
  588. };
  589. /*
  590. * Information category for Basic link data
  591. */
  592. enum {
  593. FC_CAT_NOP = 0x0,
  594. FC_CAT_ABTS = 0x1,
  595. FC_CAT_RMC = 0x2,
  596. FC_CAT_BA_ACC = 0x4,
  597. FC_CAT_BA_RJT = 0x5,
  598. FC_CAT_PRMT = 0x6,
  599. };
  600. /*
  601. * LS_RJT els reply payload
  602. */
  603. struct fc_ls_rjt_s {
  604. struct fc_els_cmd_s els_cmd; /* ELS command code */
  605. u32 res1:8;
  606. u32 reason_code:8; /* Reason code for reject */
  607. u32 reason_code_expl:8; /* Reason code explanation */
  608. u32 vendor_unique:8; /* Vendor specific */
  609. };
  610. /*
  611. * LS_RJT reason codes
  612. */
  613. enum {
  614. FC_LS_RJT_RSN_INV_CMD_CODE = 0x01,
  615. FC_LS_RJT_RSN_LOGICAL_ERROR = 0x03,
  616. FC_LS_RJT_RSN_LOGICAL_BUSY = 0x05,
  617. FC_LS_RJT_RSN_PROTOCOL_ERROR = 0x07,
  618. FC_LS_RJT_RSN_UNABLE_TO_PERF_CMD = 0x09,
  619. FC_LS_RJT_RSN_CMD_NOT_SUPP = 0x0B,
  620. };
  621. /*
  622. * LS_RJT reason code explanation
  623. */
  624. enum {
  625. FC_LS_RJT_EXP_NO_ADDL_INFO = 0x00,
  626. FC_LS_RJT_EXP_SPARMS_ERR_OPTIONS = 0x01,
  627. FC_LS_RJT_EXP_SPARMS_ERR_INI_CTL = 0x03,
  628. FC_LS_RJT_EXP_SPARMS_ERR_REC_CTL = 0x05,
  629. FC_LS_RJT_EXP_SPARMS_ERR_RXSZ = 0x07,
  630. FC_LS_RJT_EXP_SPARMS_ERR_CONSEQ = 0x09,
  631. FC_LS_RJT_EXP_SPARMS_ERR_CREDIT = 0x0B,
  632. FC_LS_RJT_EXP_INV_PORT_NAME = 0x0D,
  633. FC_LS_RJT_EXP_INV_NODE_FABRIC_NAME = 0x0E,
  634. FC_LS_RJT_EXP_INV_CSP = 0x0F,
  635. FC_LS_RJT_EXP_INV_ASSOC_HDR = 0x11,
  636. FC_LS_RJT_EXP_ASSOC_HDR_REQD = 0x13,
  637. FC_LS_RJT_EXP_INV_ORIG_S_ID = 0x15,
  638. FC_LS_RJT_EXP_INV_OXID_RXID_COMB = 0x17,
  639. FC_LS_RJT_EXP_CMD_ALREADY_IN_PROG = 0x19,
  640. FC_LS_RJT_EXP_LOGIN_REQUIRED = 0x1E,
  641. FC_LS_RJT_EXP_INVALID_NPORT_ID = 0x1F,
  642. FC_LS_RJT_EXP_INSUFF_RES = 0x29,
  643. FC_LS_RJT_EXP_CMD_NOT_SUPP = 0x2C,
  644. FC_LS_RJT_EXP_INV_PAYLOAD_LEN = 0x2D,
  645. };
  646. /*
  647. * RRQ els command payload
  648. */
  649. struct fc_rrq_s{
  650. struct fc_els_cmd_s els_cmd; /* ELS command code */
  651. u32 res1:8;
  652. u32 s_id:24; /* exchange originator S_ID */
  653. u32 ox_id:16; /* originator exchange ID */
  654. u32 rx_id:16; /* responder exchange ID */
  655. u32 res2[8]; /* optional association header */
  656. };
  657. /*
  658. * ABTS BA_ACC reply payload
  659. */
  660. struct fc_ba_acc_s{
  661. u32 seq_id_valid:8; /* set to 0x00 for Abort Exchange */
  662. u32 seq_id:8; /* invalid for Abort Exchange */
  663. u32 res2:16;
  664. u32 ox_id:16; /* OX_ID from ABTS frame */
  665. u32 rx_id:16; /* RX_ID from ABTS frame */
  666. u32 low_seq_cnt:16; /* set to 0x0000 for Abort Exchange */
  667. u32 high_seq_cnt:16;/* set to 0xFFFF for Abort Exchange */
  668. };
  669. /*
  670. * ABTS BA_RJT reject payload
  671. */
  672. struct fc_ba_rjt_s{
  673. u32 res1:8; /* Reserved */
  674. u32 reason_code:8; /* reason code for reject */
  675. u32 reason_expl:8; /* reason code explanation */
  676. u32 vendor_unique:8;/* vendor unique reason code,set to 0 */
  677. };
  678. /*
  679. * TPRLO logout parameter page
  680. */
  681. struct fc_tprlo_params_page_s{
  682. u32 type:8;
  683. u32 type_ext:8;
  684. #ifdef __BIGENDIAN
  685. u32 opa_valid:1;
  686. u32 rpa_valid:1;
  687. u32 tpo_nport_valid:1;
  688. u32 global_process_logout:1;
  689. u32 res1:12;
  690. #else
  691. u32 res1:12;
  692. u32 global_process_logout:1;
  693. u32 tpo_nport_valid:1;
  694. u32 rpa_valid:1;
  695. u32 opa_valid:1;
  696. #endif
  697. u32 orig_process_assc;
  698. u32 resp_process_assc;
  699. u32 res2:8;
  700. u32 tpo_nport_id;
  701. };
  702. /*
  703. * TPRLO ELS command payload
  704. */
  705. struct fc_tprlo_s{
  706. u32 command:8;
  707. u32 page_len:8;
  708. u32 payload_len:16;
  709. struct fc_tprlo_params_page_s tprlo_params[1];
  710. };
  711. enum fc_tprlo_type{
  712. FC_GLOBAL_LOGO = 1,
  713. FC_TPR_LOGO
  714. };
  715. /*
  716. * TPRLO els command ACC payload
  717. */
  718. struct fc_tprlo_acc_s{
  719. u32 command:8;
  720. u32 page_len:8;
  721. u32 payload_len:16;
  722. struct fc_prlo_acc_params_page_s tprlo_acc_params[1];
  723. };
  724. /*
  725. * RSCN els command req payload
  726. */
  727. #define FC_RSCN_PGLEN 0x4
  728. enum fc_rscn_format{
  729. FC_RSCN_FORMAT_PORTID = 0x0,
  730. FC_RSCN_FORMAT_AREA = 0x1,
  731. FC_RSCN_FORMAT_DOMAIN = 0x2,
  732. FC_RSCN_FORMAT_FABRIC = 0x3,
  733. };
  734. struct fc_rscn_event_s{
  735. u32 format:2;
  736. u32 qualifier:4;
  737. u32 resvd:2;
  738. u32 portid:24;
  739. };
  740. struct fc_rscn_pl_s{
  741. u8 command;
  742. u8 pagelen;
  743. u16 payldlen;
  744. struct fc_rscn_event_s event[1];
  745. };
  746. /*
  747. * ECHO els command req payload
  748. */
  749. struct fc_echo_s {
  750. struct fc_els_cmd_s els_cmd;
  751. };
  752. /*
  753. * RNID els command
  754. */
  755. #define RNID_NODEID_DATA_FORMAT_COMMON 0x00
  756. #define RNID_NODEID_DATA_FORMAT_FCP3 0x08
  757. #define RNID_NODEID_DATA_FORMAT_DISCOVERY 0xDF
  758. #define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
  759. #define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
  760. #define RNID_ASSOCIATED_TYPE_HUB 0x00000003
  761. #define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
  762. #define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
  763. #define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
  764. #define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
  765. #define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
  766. #define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
  767. #define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
  768. #define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
  769. #define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
  770. #define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
  771. /*
  772. * RNID els command payload
  773. */
  774. struct fc_rnid_cmd_s{
  775. struct fc_els_cmd_s els_cmd;
  776. u32 node_id_data_format:8;
  777. u32 reserved:24;
  778. };
  779. /*
  780. * RNID els response payload
  781. */
  782. struct fc_rnid_common_id_data_s{
  783. wwn_t port_name;
  784. wwn_t node_name;
  785. };
  786. struct fc_rnid_general_topology_data_s{
  787. u32 vendor_unique[4];
  788. u32 asso_type;
  789. u32 phy_port_num;
  790. u32 num_attached_nodes;
  791. u32 node_mgmt:8;
  792. u32 ip_version:8;
  793. u32 udp_tcp_port_num:16;
  794. u32 ip_address[4];
  795. u32 reserved:16;
  796. u32 vendor_specific:16;
  797. };
  798. struct fc_rnid_acc_s{
  799. struct fc_els_cmd_s els_cmd;
  800. u32 node_id_data_format:8;
  801. u32 common_id_data_length:8;
  802. u32 reserved:8;
  803. u32 specific_id_data_length:8;
  804. struct fc_rnid_common_id_data_s common_id_data;
  805. struct fc_rnid_general_topology_data_s gen_topology_data;
  806. };
  807. #define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
  808. #define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
  809. #define RNID_ASSOCIATED_TYPE_HUB 0x00000003
  810. #define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
  811. #define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
  812. #define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
  813. #define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
  814. #define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
  815. #define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
  816. #define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
  817. #define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
  818. #define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
  819. #define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
  820. enum fc_rpsc_speed_cap{
  821. RPSC_SPEED_CAP_1G = 0x8000,
  822. RPSC_SPEED_CAP_2G = 0x4000,
  823. RPSC_SPEED_CAP_4G = 0x2000,
  824. RPSC_SPEED_CAP_10G = 0x1000,
  825. RPSC_SPEED_CAP_8G = 0x0800,
  826. RPSC_SPEED_CAP_16G = 0x0400,
  827. RPSC_SPEED_CAP_UNKNOWN = 0x0001,
  828. };
  829. enum fc_rpsc_op_speed_s{
  830. RPSC_OP_SPEED_1G = 0x8000,
  831. RPSC_OP_SPEED_2G = 0x4000,
  832. RPSC_OP_SPEED_4G = 0x2000,
  833. RPSC_OP_SPEED_10G = 0x1000,
  834. RPSC_OP_SPEED_8G = 0x0800,
  835. RPSC_OP_SPEED_16G = 0x0400,
  836. RPSC_OP_SPEED_NOT_EST = 0x0001, /*! speed not established */
  837. };
  838. struct fc_rpsc_speed_info_s{
  839. u16 port_speed_cap; /*! see fc_rpsc_speed_cap_t */
  840. u16 port_op_speed; /*! see fc_rpsc_op_speed_t */
  841. };
  842. enum link_e2e_beacon_subcmd{
  843. LINK_E2E_BEACON_ON = 1,
  844. LINK_E2E_BEACON_OFF = 2
  845. };
  846. enum beacon_type{
  847. BEACON_TYPE_NORMAL = 1, /*! Normal Beaconing. Green */
  848. BEACON_TYPE_WARN = 2, /*! Warning Beaconing. Yellow/Amber */
  849. BEACON_TYPE_CRITICAL = 3 /*! Critical Beaconing. Red */
  850. };
  851. struct link_e2e_beacon_param_s {
  852. u8 beacon_type; /* Beacon Type. See beacon_type_t */
  853. u8 beacon_frequency;
  854. /* Beacon frequency. Number of blinks
  855. * per 10 seconds
  856. */
  857. u16 beacon_duration;/* Beacon duration (in Seconds). The
  858. * command operation should be
  859. * terminated at the end of this
  860. * timeout value.
  861. *
  862. * Ignored if diag_sub_cmd is
  863. * LINK_E2E_BEACON_OFF.
  864. *
  865. * If 0, beaconing will continue till a
  866. * BEACON OFF request is received
  867. */
  868. };
  869. /*
  870. * Link E2E beacon request/good response format. For LS_RJTs use fc_ls_rjt_t
  871. */
  872. struct link_e2e_beacon_req_s{
  873. u32 ls_code; /*! FC_ELS_E2E_LBEACON in requests *
  874. *or FC_ELS_ACC in good replies */
  875. u32 ls_sub_cmd; /*! See link_e2e_beacon_subcmd_t */
  876. struct link_e2e_beacon_param_s beacon_parm;
  877. };
  878. /**
  879. * If RPSC request is sent to the Domain Controller, the request is for
  880. * all the ports within that domain (TODO - I don't think FOS implements
  881. * this...).
  882. */
  883. struct fc_rpsc_cmd_s{
  884. struct fc_els_cmd_s els_cmd;
  885. };
  886. /*
  887. * RPSC Acc
  888. */
  889. struct fc_rpsc_acc_s{
  890. u32 command:8;
  891. u32 rsvd:8;
  892. u32 num_entries:16;
  893. struct fc_rpsc_speed_info_s speed_info[1];
  894. };
  895. /**
  896. * If RPSC2 request is sent to the Domain Controller,
  897. */
  898. #define FC_BRCD_TOKEN 0x42524344
  899. struct fc_rpsc2_cmd_s{
  900. struct fc_els_cmd_s els_cmd;
  901. u32 token;
  902. u16 resvd;
  903. u16 num_pids; /* Number of pids in the request */
  904. struct {
  905. u32 rsvd1:8;
  906. u32 pid:24; /* port identifier */
  907. } pid_list[1];
  908. };
  909. enum fc_rpsc2_port_type{
  910. RPSC2_PORT_TYPE_UNKNOWN = 0,
  911. RPSC2_PORT_TYPE_NPORT = 1,
  912. RPSC2_PORT_TYPE_NLPORT = 2,
  913. RPSC2_PORT_TYPE_NPIV_PORT = 0x5f,
  914. RPSC2_PORT_TYPE_NPORT_TRUNK = 0x6f,
  915. };
  916. /*
  917. * RPSC2 portInfo entry structure
  918. */
  919. struct fc_rpsc2_port_info_s{
  920. u32 pid; /* PID */
  921. u16 resvd1;
  922. u16 index; /* port number / index */
  923. u8 resvd2;
  924. u8 type; /* port type N/NL/... */
  925. u16 speed; /* port Operating Speed */
  926. };
  927. /*
  928. * RPSC2 Accept payload
  929. */
  930. struct fc_rpsc2_acc_s{
  931. u8 els_cmd;
  932. u8 resvd;
  933. u16 num_pids; /* Number of pids in the request */
  934. struct fc_rpsc2_port_info_s port_info[1]; /* port information */
  935. };
  936. /**
  937. * bit fields so that multiple classes can be specified
  938. */
  939. enum fc_cos{
  940. FC_CLASS_2 = 0x04,
  941. FC_CLASS_3 = 0x08,
  942. FC_CLASS_2_3 = 0x0C,
  943. };
  944. /*
  945. * symbolic name
  946. */
  947. struct fc_symname_s{
  948. u8 symname[FC_SYMNAME_MAX];
  949. };
  950. struct fc_alpabm_s{
  951. u8 alpa_bm[FC_ALPA_MAX / 8];
  952. };
  953. /*
  954. * protocol default timeout values
  955. */
  956. #define FC_ED_TOV 2
  957. #define FC_REC_TOV (FC_ED_TOV + 1)
  958. #define FC_RA_TOV 10
  959. #define FC_ELS_TOV (2 * FC_RA_TOV)
  960. #define FC_FCCT_TOV (3 * FC_RA_TOV)
  961. /*
  962. * virtual fabric related defines
  963. */
  964. #define FC_VF_ID_NULL 0 /* must not be used as VF_ID */
  965. #define FC_VF_ID_MIN 1
  966. #define FC_VF_ID_MAX 0xEFF
  967. #define FC_VF_ID_CTL 0xFEF /* control VF_ID */
  968. /**
  969. * Virtual Fabric Tagging header format
  970. * @caution This is defined only in BIG ENDIAN format.
  971. */
  972. struct fc_vft_s{
  973. u32 r_ctl:8;
  974. u32 ver:2;
  975. u32 type:4;
  976. u32 res_a:2;
  977. u32 priority:3;
  978. u32 vf_id:12;
  979. u32 res_b:1;
  980. u32 hopct:8;
  981. u32 res_c:24;
  982. };
  983. #pragma pack()
  984. #endif