fc.h 27 KB

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