bfa_fc.h 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915
  1. /*
  2. * Copyright (c) 2005-2010 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 __BFA_FC_H__
  18. #define __BFA_FC_H__
  19. #include "bfad_drv.h"
  20. typedef u64 wwn_t;
  21. #define WWN_NULL (0)
  22. #define FC_SYMNAME_MAX 256 /* max name server symbolic name size */
  23. #define FC_ALPA_MAX 128
  24. #pragma pack(1)
  25. #define MAC_ADDRLEN (6)
  26. struct mac_s { u8 mac[MAC_ADDRLEN]; };
  27. #define mac_t struct mac_s
  28. /*
  29. * generic SCSI cdb definition
  30. */
  31. #define SCSI_MAX_CDBLEN 16
  32. struct scsi_cdb_s {
  33. u8 scsi_cdb[SCSI_MAX_CDBLEN];
  34. };
  35. #define scsi_cdb_t struct scsi_cdb_s
  36. /* ------------------------------------------------------------
  37. * SCSI status byte values
  38. * ------------------------------------------------------------
  39. */
  40. #define SCSI_STATUS_GOOD 0x00
  41. #define SCSI_STATUS_CHECK_CONDITION 0x02
  42. #define SCSI_STATUS_CONDITION_MET 0x04
  43. #define SCSI_STATUS_BUSY 0x08
  44. #define SCSI_STATUS_INTERMEDIATE 0x10
  45. #define SCSI_STATUS_ICM 0x14 /* intermediate condition met */
  46. #define SCSI_STATUS_RESERVATION_CONFLICT 0x18
  47. #define SCSI_STATUS_COMMAND_TERMINATED 0x22
  48. #define SCSI_STATUS_QUEUE_FULL 0x28
  49. #define SCSI_STATUS_ACA_ACTIVE 0x30
  50. #define SCSI_MAX_ALLOC_LEN 0xFF /* maximum allocarion length */
  51. /*
  52. * Fibre Channel Header Structure (FCHS) definition
  53. */
  54. struct fchs_s {
  55. #ifdef __BIG_ENDIAN
  56. u32 routing:4; /* routing bits */
  57. u32 cat_info:4; /* category info */
  58. #else
  59. u32 cat_info:4; /* category info */
  60. u32 routing:4; /* routing bits */
  61. #endif
  62. u32 d_id:24; /* destination identifier */
  63. u32 cs_ctl:8; /* class specific control */
  64. u32 s_id:24; /* source identifier */
  65. u32 type:8; /* data structure type */
  66. u32 f_ctl:24; /* initial frame control */
  67. u8 seq_id; /* sequence identifier */
  68. u8 df_ctl; /* data field control */
  69. u16 seq_cnt; /* sequence count */
  70. __be16 ox_id; /* originator exchange ID */
  71. u16 rx_id; /* responder exchange ID */
  72. u32 ro; /* relative offset */
  73. };
  74. #define FC_SOF_LEN 4
  75. #define FC_EOF_LEN 4
  76. #define FC_CRC_LEN 4
  77. /*
  78. * Fibre Channel BB_E Header Structure
  79. */
  80. struct fcbbehs_s {
  81. u16 ver_rsvd;
  82. u32 rsvd[2];
  83. u32 rsvd__sof;
  84. };
  85. #define FC_SEQ_ID_MAX 256
  86. /*
  87. * routing bit definitions
  88. */
  89. enum {
  90. FC_RTG_FC4_DEV_DATA = 0x0, /* FC-4 Device Data */
  91. FC_RTG_EXT_LINK = 0x2, /* Extended Link Data */
  92. FC_RTG_FC4_LINK_DATA = 0x3, /* FC-4 Link Data */
  93. FC_RTG_VIDEO_DATA = 0x4, /* Video Data */
  94. FC_RTG_EXT_HDR = 0x5, /* VFT, IFR or Encapsuled */
  95. FC_RTG_BASIC_LINK = 0x8, /* Basic Link data */
  96. FC_RTG_LINK_CTRL = 0xC, /* Link Control */
  97. };
  98. /*
  99. * information category for extended link data and FC-4 Link Data
  100. */
  101. enum {
  102. FC_CAT_LD_REQUEST = 0x2, /* Request */
  103. FC_CAT_LD_REPLY = 0x3, /* Reply */
  104. FC_CAT_LD_DIAG = 0xF, /* for DIAG use only */
  105. };
  106. /*
  107. * information category for extended headers (VFT, IFR or encapsulation)
  108. */
  109. enum {
  110. FC_CAT_VFT_HDR = 0x0, /* Virtual fabric tagging header */
  111. FC_CAT_IFR_HDR = 0x1, /* Inter-Fabric routing header */
  112. FC_CAT_ENC_HDR = 0x2, /* Encapsulation header */
  113. };
  114. /*
  115. * information category for FC-4 device data
  116. */
  117. enum {
  118. FC_CAT_UNCATEG_INFO = 0x0, /* Uncategorized information */
  119. FC_CAT_SOLICIT_DATA = 0x1, /* Solicited Data */
  120. FC_CAT_UNSOLICIT_CTRL = 0x2, /* Unsolicited Control */
  121. FC_CAT_SOLICIT_CTRL = 0x3, /* Solicited Control */
  122. FC_CAT_UNSOLICIT_DATA = 0x4, /* Unsolicited Data */
  123. FC_CAT_DATA_DESC = 0x5, /* Data Descriptor */
  124. FC_CAT_UNSOLICIT_CMD = 0x6, /* Unsolicited Command */
  125. FC_CAT_CMD_STATUS = 0x7, /* Command Status */
  126. };
  127. /*
  128. * information category for Link Control
  129. */
  130. enum {
  131. FC_CAT_ACK_1 = 0x00,
  132. FC_CAT_ACK_0_N = 0x01,
  133. FC_CAT_P_RJT = 0x02,
  134. FC_CAT_F_RJT = 0x03,
  135. FC_CAT_P_BSY = 0x04,
  136. FC_CAT_F_BSY_DATA = 0x05,
  137. FC_CAT_F_BSY_LINK_CTL = 0x06,
  138. FC_CAT_F_LCR = 0x07,
  139. FC_CAT_NTY = 0x08,
  140. FC_CAT_END = 0x09,
  141. };
  142. /*
  143. * Type Field Definitions. FC-PH Section 18.5 pg. 165
  144. */
  145. enum {
  146. FC_TYPE_BLS = 0x0, /* Basic Link Service */
  147. FC_TYPE_ELS = 0x1, /* Extended Link Service */
  148. FC_TYPE_IP = 0x5, /* IP */
  149. FC_TYPE_FCP = 0x8, /* SCSI-FCP */
  150. FC_TYPE_GPP = 0x9, /* SCSI_GPP */
  151. FC_TYPE_SERVICES = 0x20, /* Fibre Channel Services */
  152. FC_TYPE_FC_FSS = 0x22, /* Fabric Switch Services */
  153. FC_TYPE_FC_AL = 0x23, /* FC-AL */
  154. FC_TYPE_FC_SNMP = 0x24, /* FC-SNMP */
  155. FC_TYPE_FC_SPINFAB = 0xEE, /* SPINFAB */
  156. FC_TYPE_FC_DIAG = 0xEF, /* DIAG */
  157. FC_TYPE_MAX = 256, /* 256 FC-4 types */
  158. };
  159. struct fc_fc4types_s {
  160. u8 bits[FC_TYPE_MAX / 8];
  161. };
  162. /*
  163. * Frame Control Definitions. FC-PH Table-45. pg. 168
  164. */
  165. enum {
  166. FCTL_EC_ORIG = 0x000000, /* exchange originator */
  167. FCTL_EC_RESP = 0x800000, /* exchange responder */
  168. FCTL_SEQ_INI = 0x000000, /* sequence initiator */
  169. FCTL_SEQ_REC = 0x400000, /* sequence recipient */
  170. FCTL_FS_EXCH = 0x200000, /* first sequence of xchg */
  171. FCTL_LS_EXCH = 0x100000, /* last sequence of xchg */
  172. FCTL_END_SEQ = 0x080000, /* last frame of sequence */
  173. FCTL_SI_XFER = 0x010000, /* seq initiative transfer */
  174. FCTL_RO_PRESENT = 0x000008, /* relative offset present */
  175. FCTL_FILLBYTE_MASK = 0x000003 /* , fill byte mask */
  176. };
  177. /*
  178. * Fabric Well Known Addresses
  179. */
  180. enum {
  181. FC_MIN_WELL_KNOWN_ADDR = 0xFFFFF0,
  182. FC_DOMAIN_CONTROLLER_MASK = 0xFFFC00,
  183. FC_ALIAS_SERVER = 0xFFFFF8,
  184. FC_MGMT_SERVER = 0xFFFFFA,
  185. FC_TIME_SERVER = 0xFFFFFB,
  186. FC_NAME_SERVER = 0xFFFFFC,
  187. FC_FABRIC_CONTROLLER = 0xFFFFFD,
  188. FC_FABRIC_PORT = 0xFFFFFE,
  189. FC_BROADCAST_SERVER = 0xFFFFFF
  190. };
  191. /*
  192. * domain/area/port defines
  193. */
  194. #define FC_DOMAIN_MASK 0xFF0000
  195. #define FC_DOMAIN_SHIFT 16
  196. #define FC_AREA_MASK 0x00FF00
  197. #define FC_AREA_SHIFT 8
  198. #define FC_PORT_MASK 0x0000FF
  199. #define FC_PORT_SHIFT 0
  200. #define FC_GET_DOMAIN(p) (((p) & FC_DOMAIN_MASK) >> FC_DOMAIN_SHIFT)
  201. #define FC_GET_AREA(p) (((p) & FC_AREA_MASK) >> FC_AREA_SHIFT)
  202. #define FC_GET_PORT(p) (((p) & FC_PORT_MASK) >> FC_PORT_SHIFT)
  203. #define FC_DOMAIN_CTRLR(p) (FC_DOMAIN_CONTROLLER_MASK | (FC_GET_DOMAIN(p)))
  204. enum {
  205. FC_RXID_ANY = 0xFFFFU,
  206. };
  207. /*
  208. * generic ELS command
  209. */
  210. struct fc_els_cmd_s {
  211. u32 els_code:8; /* ELS Command Code */
  212. u32 reserved:24;
  213. };
  214. /*
  215. * ELS Command Codes. FC-PH Table-75. pg. 223
  216. */
  217. enum {
  218. FC_ELS_LS_RJT = 0x1, /* Link Service Reject. */
  219. FC_ELS_ACC = 0x02, /* Accept */
  220. FC_ELS_PLOGI = 0x03, /* N_Port Login. */
  221. FC_ELS_FLOGI = 0x04, /* F_Port Login. */
  222. FC_ELS_LOGO = 0x05, /* Logout. */
  223. FC_ELS_ABTX = 0x06, /* Abort Exchange */
  224. FC_ELS_RES = 0x08, /* Read Exchange status */
  225. FC_ELS_RSS = 0x09, /* Read sequence status block */
  226. FC_ELS_RSI = 0x0A, /* Request Sequence Initiative */
  227. FC_ELS_ESTC = 0x0C, /* Estimate Credit. */
  228. FC_ELS_RTV = 0x0E, /* Read Timeout Value. */
  229. FC_ELS_RLS = 0x0F, /* Read Link Status. */
  230. FC_ELS_ECHO = 0x10, /* Echo */
  231. FC_ELS_TEST = 0x11, /* Test */
  232. FC_ELS_RRQ = 0x12, /* Reinstate Recovery Qualifier. */
  233. FC_ELS_REC = 0x13, /* Add this for TAPE support in FCR */
  234. FC_ELS_PRLI = 0x20, /* Process Login */
  235. FC_ELS_PRLO = 0x21, /* Process Logout. */
  236. FC_ELS_SCN = 0x22, /* State Change Notification. */
  237. FC_ELS_TPRLO = 0x24, /* Third Party Process Logout. */
  238. FC_ELS_PDISC = 0x50, /* Discover N_Port Parameters. */
  239. FC_ELS_FDISC = 0x51, /* Discover F_Port Parameters. */
  240. FC_ELS_ADISC = 0x52, /* Discover Address. */
  241. FC_ELS_FARP_REQ = 0x54, /* FARP Request. */
  242. FC_ELS_FARP_REP = 0x55, /* FARP Reply. */
  243. FC_ELS_FAN = 0x60, /* Fabric Address Notification */
  244. FC_ELS_RSCN = 0x61, /* Reg State Change Notification */
  245. FC_ELS_SCR = 0x62, /* State Change Registration. */
  246. FC_ELS_RTIN = 0x77, /* Mangement server request */
  247. FC_ELS_RNID = 0x78, /* Mangement server request */
  248. FC_ELS_RLIR = 0x79, /* Registered Link Incident Record */
  249. FC_ELS_RPSC = 0x7D, /* Report Port Speed Capabilities */
  250. FC_ELS_QSA = 0x7E, /* Query Security Attributes. Ref FC-SP */
  251. FC_ELS_E2E_LBEACON = 0x81,
  252. /* End-to-End Link Beacon */
  253. FC_ELS_AUTH = 0x90, /* Authentication. Ref FC-SP */
  254. FC_ELS_RFCN = 0x97, /* Request Fabric Change Notification. Ref
  255. *FC-SP */
  256. };
  257. /*
  258. * Version numbers for FC-PH standards,
  259. * used in login to indicate what port
  260. * supports. See FC-PH-X table 158.
  261. */
  262. enum {
  263. FC_PH_VER_4_3 = 0x09,
  264. FC_PH_VER_PH_3 = 0x20,
  265. };
  266. /*
  267. * PDU size defines
  268. */
  269. enum {
  270. FC_MIN_PDUSZ = 512,
  271. FC_MAX_PDUSZ = 2112,
  272. };
  273. /*
  274. * N_Port PLOGI Common Service Parameters.
  275. * FC-PH-x. Figure-76. pg. 308.
  276. */
  277. struct fc_plogi_csp_s {
  278. u8 verhi; /* FC-PH high version */
  279. u8 verlo; /* FC-PH low version */
  280. __be16 bbcred; /* BB_Credit */
  281. #ifdef __BIG_ENDIAN
  282. u8 ciro:1, /* continuously increasing RO */
  283. rro:1, /* random relative offset */
  284. npiv_supp:1, /* NPIV supported */
  285. port_type:1, /* N_Port/F_port */
  286. altbbcred:1, /* alternate BB_Credit */
  287. resolution:1, /* ms/ns ED_TOV resolution */
  288. vvl_info:1, /* VVL Info included */
  289. reserved1:1;
  290. u8 hg_supp:1,
  291. query_dbc:1,
  292. security:1,
  293. sync_cap:1,
  294. r_t_tov:1,
  295. dh_dup_supp:1,
  296. cisc:1, /* continuously increasing seq count */
  297. payload:1;
  298. #else
  299. u8 reserved2:2,
  300. resolution:1, /* ms/ns ED_TOV resolution */
  301. altbbcred:1, /* alternate BB_Credit */
  302. port_type:1, /* N_Port/F_port */
  303. npiv_supp:1, /* NPIV supported */
  304. rro:1, /* random relative offset */
  305. ciro:1; /* continuously increasing RO */
  306. u8 payload:1,
  307. cisc:1, /* continuously increasing seq count */
  308. dh_dup_supp:1,
  309. r_t_tov:1,
  310. sync_cap:1,
  311. security:1,
  312. query_dbc:1,
  313. hg_supp:1;
  314. #endif
  315. __be16 rxsz; /* recieve data_field size */
  316. __be16 conseq;
  317. __be16 ro_bitmap;
  318. __be32 e_d_tov;
  319. };
  320. /*
  321. * N_Port PLOGI Class Specific Parameters.
  322. * FC-PH-x. Figure 78. pg. 318.
  323. */
  324. struct fc_plogi_clp_s {
  325. #ifdef __BIG_ENDIAN
  326. u32 class_valid:1;
  327. u32 intermix:1; /* class intermix supported if set =1.
  328. * valid only for class1. Reserved for
  329. * class2 & class3
  330. */
  331. u32 reserved1:2;
  332. u32 sequential:1;
  333. u32 reserved2:3;
  334. #else
  335. u32 reserved2:3;
  336. u32 sequential:1;
  337. u32 reserved1:2;
  338. u32 intermix:1; /* class intermix supported if set =1.
  339. * valid only for class1. Reserved for
  340. * class2 & class3
  341. */
  342. u32 class_valid:1;
  343. #endif
  344. u32 reserved3:24;
  345. u32 reserved4:16;
  346. u32 rxsz:16; /* Receive data_field size */
  347. u32 reserved5:8;
  348. u32 conseq:8;
  349. u32 e2e_credit:16; /* end to end credit */
  350. u32 reserved7:8;
  351. u32 ospx:8;
  352. u32 reserved8:16;
  353. };
  354. /* ASCII value for each character in string "BRCD" */
  355. #define FLOGI_VVL_BRCD 0x42524344
  356. /*
  357. * PLOGI els command and reply payload
  358. */
  359. struct fc_logi_s {
  360. struct fc_els_cmd_s els_cmd; /* ELS command code */
  361. struct fc_plogi_csp_s csp; /* common service params */
  362. wwn_t port_name;
  363. wwn_t node_name;
  364. struct fc_plogi_clp_s class1; /* class 1 service parameters */
  365. struct fc_plogi_clp_s class2; /* class 2 service parameters */
  366. struct fc_plogi_clp_s class3; /* class 3 service parameters */
  367. struct fc_plogi_clp_s class4; /* class 4 service parameters */
  368. u8 vvl[16]; /* vendor version level */
  369. };
  370. /*
  371. * LOGO els command payload
  372. */
  373. struct fc_logo_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. wwn_t orig_port_name; /* Port name of the LOGO originator */
  378. };
  379. /*
  380. * ADISC els command payload
  381. */
  382. struct fc_adisc_s {
  383. struct fc_els_cmd_s els_cmd; /* ELS command code */
  384. u32 res1:8;
  385. u32 orig_HA:24; /* originator hard address */
  386. wwn_t orig_port_name; /* originator port name */
  387. wwn_t orig_node_name; /* originator node name */
  388. u32 res2:8;
  389. u32 nport_id:24; /* originator NPortID */
  390. };
  391. /*
  392. * Exchange status block
  393. */
  394. struct fc_exch_status_blk_s {
  395. u32 oxid:16;
  396. u32 rxid:16;
  397. u32 res1:8;
  398. u32 orig_np:24; /* originator NPortID */
  399. u32 res2:8;
  400. u32 resp_np:24; /* responder NPortID */
  401. u32 es_bits;
  402. u32 res3;
  403. /*
  404. * un modified section of the fields
  405. */
  406. };
  407. /*
  408. * RES els command payload
  409. */
  410. struct fc_res_s {
  411. struct fc_els_cmd_s els_cmd; /* ELS command code */
  412. u32 res1:8;
  413. u32 nport_id:24; /* N_Port identifier of source */
  414. u32 oxid:16;
  415. u32 rxid:16;
  416. u8 assoc_hdr[32];
  417. };
  418. /*
  419. * RES els accept payload
  420. */
  421. struct fc_res_acc_s {
  422. struct fc_els_cmd_s els_cmd; /* ELS command code */
  423. struct fc_exch_status_blk_s fc_exch_blk; /* Exchange status block */
  424. };
  425. /*
  426. * REC els command payload
  427. */
  428. struct fc_rec_s {
  429. struct fc_els_cmd_s els_cmd; /* ELS command code */
  430. u32 res1:8;
  431. u32 nport_id:24; /* N_Port identifier of source */
  432. u32 oxid:16;
  433. u32 rxid:16;
  434. };
  435. #define FC_REC_ESB_OWN_RSP 0x80000000 /* responder owns */
  436. #define FC_REC_ESB_SI 0x40000000 /* SI is owned */
  437. #define FC_REC_ESB_COMP 0x20000000 /* exchange is complete */
  438. #define FC_REC_ESB_ENDCOND_ABN 0x10000000 /* abnormal ending */
  439. #define FC_REC_ESB_RQACT 0x04000000 /* recovery qual active */
  440. #define FC_REC_ESB_ERRP_MSK 0x03000000
  441. #define FC_REC_ESB_OXID_INV 0x00800000 /* invalid OXID */
  442. #define FC_REC_ESB_RXID_INV 0x00400000 /* invalid RXID */
  443. #define FC_REC_ESB_PRIO_INUSE 0x00200000
  444. /*
  445. * REC els accept payload
  446. */
  447. struct fc_rec_acc_s {
  448. struct fc_els_cmd_s els_cmd; /* ELS command code */
  449. u32 oxid:16;
  450. u32 rxid:16;
  451. u32 res1:8;
  452. u32 orig_id:24; /* N_Port id of exchange originator */
  453. u32 res2:8;
  454. u32 resp_id:24; /* N_Port id of exchange responder */
  455. u32 count; /* data transfer count */
  456. u32 e_stat; /* exchange status */
  457. };
  458. /*
  459. * RSI els payload
  460. */
  461. struct fc_rsi_s {
  462. struct fc_els_cmd_s els_cmd;
  463. u32 res1:8;
  464. u32 orig_sid:24;
  465. u32 oxid:16;
  466. u32 rxid:16;
  467. };
  468. /*
  469. * structure for PRLI paramater pages, both request & response
  470. * see FC-PH-X table 113 & 115 for explanation also FCP table 8
  471. */
  472. struct fc_prli_params_s {
  473. u32 reserved:16;
  474. #ifdef __BIG_ENDIAN
  475. u32 reserved1:5;
  476. u32 rec_support:1;
  477. u32 task_retry_id:1;
  478. u32 retry:1;
  479. u32 confirm:1;
  480. u32 doverlay:1;
  481. u32 initiator:1;
  482. u32 target:1;
  483. u32 cdmix:1;
  484. u32 drmix:1;
  485. u32 rxrdisab:1;
  486. u32 wxrdisab:1;
  487. #else
  488. u32 retry:1;
  489. u32 task_retry_id:1;
  490. u32 rec_support:1;
  491. u32 reserved1:5;
  492. u32 wxrdisab:1;
  493. u32 rxrdisab:1;
  494. u32 drmix:1;
  495. u32 cdmix:1;
  496. u32 target:1;
  497. u32 initiator:1;
  498. u32 doverlay:1;
  499. u32 confirm:1;
  500. #endif
  501. };
  502. /*
  503. * valid values for rspcode in PRLI ACC payload
  504. */
  505. enum {
  506. FC_PRLI_ACC_XQTD = 0x1, /* request executed */
  507. FC_PRLI_ACC_PREDEF_IMG = 0x5, /* predefined image - no prli needed */
  508. };
  509. struct fc_prli_params_page_s {
  510. u32 type:8;
  511. u32 codext:8;
  512. #ifdef __BIG_ENDIAN
  513. u32 origprocasv:1;
  514. u32 rsppav:1;
  515. u32 imagepair:1;
  516. u32 reserved1:1;
  517. u32 rspcode:4;
  518. #else
  519. u32 rspcode:4;
  520. u32 reserved1:1;
  521. u32 imagepair:1;
  522. u32 rsppav:1;
  523. u32 origprocasv:1;
  524. #endif
  525. u32 reserved2:8;
  526. u32 origprocas;
  527. u32 rspprocas;
  528. struct fc_prli_params_s servparams;
  529. };
  530. /*
  531. * PRLI request and accept payload, FC-PH-X tables 112 & 114
  532. */
  533. struct fc_prli_s {
  534. u32 command:8;
  535. u32 pglen:8;
  536. u32 pagebytes:16;
  537. struct fc_prli_params_page_s parampage;
  538. };
  539. /*
  540. * PRLO logout params page
  541. */
  542. struct fc_prlo_params_page_s {
  543. u32 type:8;
  544. u32 type_ext:8;
  545. #ifdef __BIG_ENDIAN
  546. u32 opa_valid:1; /* originator process associator
  547. * valid
  548. */
  549. u32 rpa_valid:1; /* responder process associator valid */
  550. u32 res1:14;
  551. #else
  552. u32 res1:14;
  553. u32 rpa_valid:1; /* responder process associator valid */
  554. u32 opa_valid:1; /* originator process associator
  555. * valid
  556. */
  557. #endif
  558. u32 orig_process_assc;
  559. u32 resp_process_assc;
  560. u32 res2;
  561. };
  562. /*
  563. * PRLO els command payload
  564. */
  565. struct fc_prlo_s {
  566. u32 command:8;
  567. u32 page_len:8;
  568. u32 payload_len:16;
  569. struct fc_prlo_params_page_s prlo_params[1];
  570. };
  571. /*
  572. * PRLO Logout response parameter page
  573. */
  574. struct fc_prlo_acc_params_page_s {
  575. u32 type:8;
  576. u32 type_ext:8;
  577. #ifdef __BIG_ENDIAN
  578. u32 opa_valid:1; /* originator process associator
  579. * valid
  580. */
  581. u32 rpa_valid:1; /* responder process associator valid */
  582. u32 res1:14;
  583. #else
  584. u32 res1:14;
  585. u32 rpa_valid:1; /* responder process associator valid */
  586. u32 opa_valid:1; /* originator process associator
  587. * valid
  588. */
  589. #endif
  590. u32 orig_process_assc;
  591. u32 resp_process_assc;
  592. u32 fc4type_csp;
  593. };
  594. /*
  595. * PRLO els command ACC payload
  596. */
  597. struct fc_prlo_acc_s {
  598. u32 command:8;
  599. u32 page_len:8;
  600. u32 payload_len:16;
  601. struct fc_prlo_acc_params_page_s prlo_acc_params[1];
  602. };
  603. /*
  604. * SCR els command payload
  605. */
  606. enum {
  607. FC_SCR_REG_FUNC_FABRIC_DETECTED = 0x01,
  608. FC_SCR_REG_FUNC_N_PORT_DETECTED = 0x02,
  609. FC_SCR_REG_FUNC_FULL = 0x03,
  610. FC_SCR_REG_FUNC_CLEAR_REG = 0xFF,
  611. };
  612. /* SCR VU registrations */
  613. enum {
  614. FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE = 0x01
  615. };
  616. struct fc_scr_s {
  617. u32 command:8;
  618. u32 res:24;
  619. u32 vu_reg_func:8; /* Vendor Unique Registrations */
  620. u32 res1:16;
  621. u32 reg_func:8;
  622. };
  623. /*
  624. * Information category for Basic link data
  625. */
  626. enum {
  627. FC_CAT_NOP = 0x0,
  628. FC_CAT_ABTS = 0x1,
  629. FC_CAT_RMC = 0x2,
  630. FC_CAT_BA_ACC = 0x4,
  631. FC_CAT_BA_RJT = 0x5,
  632. FC_CAT_PRMT = 0x6,
  633. };
  634. /*
  635. * LS_RJT els reply payload
  636. */
  637. struct fc_ls_rjt_s {
  638. struct fc_els_cmd_s els_cmd; /* ELS command code */
  639. u32 res1:8;
  640. u32 reason_code:8; /* Reason code for reject */
  641. u32 reason_code_expl:8; /* Reason code explanation */
  642. u32 vendor_unique:8; /* Vendor specific */
  643. };
  644. /*
  645. * LS_RJT reason codes
  646. */
  647. enum {
  648. FC_LS_RJT_RSN_INV_CMD_CODE = 0x01,
  649. FC_LS_RJT_RSN_LOGICAL_ERROR = 0x03,
  650. FC_LS_RJT_RSN_LOGICAL_BUSY = 0x05,
  651. FC_LS_RJT_RSN_PROTOCOL_ERROR = 0x07,
  652. FC_LS_RJT_RSN_UNABLE_TO_PERF_CMD = 0x09,
  653. FC_LS_RJT_RSN_CMD_NOT_SUPP = 0x0B,
  654. };
  655. /*
  656. * LS_RJT reason code explanation
  657. */
  658. enum {
  659. FC_LS_RJT_EXP_NO_ADDL_INFO = 0x00,
  660. FC_LS_RJT_EXP_SPARMS_ERR_OPTIONS = 0x01,
  661. FC_LS_RJT_EXP_SPARMS_ERR_INI_CTL = 0x03,
  662. FC_LS_RJT_EXP_SPARMS_ERR_REC_CTL = 0x05,
  663. FC_LS_RJT_EXP_SPARMS_ERR_RXSZ = 0x07,
  664. FC_LS_RJT_EXP_SPARMS_ERR_CONSEQ = 0x09,
  665. FC_LS_RJT_EXP_SPARMS_ERR_CREDIT = 0x0B,
  666. FC_LS_RJT_EXP_INV_PORT_NAME = 0x0D,
  667. FC_LS_RJT_EXP_INV_NODE_FABRIC_NAME = 0x0E,
  668. FC_LS_RJT_EXP_INV_CSP = 0x0F,
  669. FC_LS_RJT_EXP_INV_ASSOC_HDR = 0x11,
  670. FC_LS_RJT_EXP_ASSOC_HDR_REQD = 0x13,
  671. FC_LS_RJT_EXP_INV_ORIG_S_ID = 0x15,
  672. FC_LS_RJT_EXP_INV_OXID_RXID_COMB = 0x17,
  673. FC_LS_RJT_EXP_CMD_ALREADY_IN_PROG = 0x19,
  674. FC_LS_RJT_EXP_LOGIN_REQUIRED = 0x1E,
  675. FC_LS_RJT_EXP_INVALID_NPORT_ID = 0x1F,
  676. FC_LS_RJT_EXP_INSUFF_RES = 0x29,
  677. FC_LS_RJT_EXP_CMD_NOT_SUPP = 0x2C,
  678. FC_LS_RJT_EXP_INV_PAYLOAD_LEN = 0x2D,
  679. };
  680. /*
  681. * RRQ els command payload
  682. */
  683. struct fc_rrq_s {
  684. struct fc_els_cmd_s els_cmd; /* ELS command code */
  685. u32 res1:8;
  686. u32 s_id:24; /* exchange originator S_ID */
  687. u32 ox_id:16; /* originator exchange ID */
  688. u32 rx_id:16; /* responder exchange ID */
  689. u32 res2[8]; /* optional association header */
  690. };
  691. /*
  692. * ABTS BA_ACC reply payload
  693. */
  694. struct fc_ba_acc_s {
  695. u32 seq_id_valid:8; /* set to 0x00 for Abort Exchange */
  696. u32 seq_id:8; /* invalid for Abort Exchange */
  697. u32 res2:16;
  698. u32 ox_id:16; /* OX_ID from ABTS frame */
  699. u32 rx_id:16; /* RX_ID from ABTS frame */
  700. u32 low_seq_cnt:16; /* set to 0x0000 for Abort Exchange */
  701. u32 high_seq_cnt:16;/* set to 0xFFFF for Abort Exchange */
  702. };
  703. /*
  704. * ABTS BA_RJT reject payload
  705. */
  706. struct fc_ba_rjt_s {
  707. u32 res1:8; /* Reserved */
  708. u32 reason_code:8; /* reason code for reject */
  709. u32 reason_expl:8; /* reason code explanation */
  710. u32 vendor_unique:8;/* vendor unique reason code,set to 0 */
  711. };
  712. /*
  713. * TPRLO logout parameter page
  714. */
  715. struct fc_tprlo_params_page_s {
  716. u32 type:8;
  717. u32 type_ext:8;
  718. #ifdef __BIG_ENDIAN
  719. u32 opa_valid:1;
  720. u32 rpa_valid:1;
  721. u32 tpo_nport_valid:1;
  722. u32 global_process_logout:1;
  723. u32 res1:12;
  724. #else
  725. u32 res1:12;
  726. u32 global_process_logout:1;
  727. u32 tpo_nport_valid:1;
  728. u32 rpa_valid:1;
  729. u32 opa_valid:1;
  730. #endif
  731. u32 orig_process_assc;
  732. u32 resp_process_assc;
  733. u32 res2:8;
  734. u32 tpo_nport_id;
  735. };
  736. /*
  737. * TPRLO ELS command payload
  738. */
  739. struct fc_tprlo_s {
  740. u32 command:8;
  741. u32 page_len:8;
  742. u32 payload_len:16;
  743. struct fc_tprlo_params_page_s tprlo_params[1];
  744. };
  745. enum fc_tprlo_type {
  746. FC_GLOBAL_LOGO = 1,
  747. FC_TPR_LOGO
  748. };
  749. /*
  750. * TPRLO els command ACC payload
  751. */
  752. struct fc_tprlo_acc_s {
  753. u32 command:8;
  754. u32 page_len:8;
  755. u32 payload_len:16;
  756. struct fc_prlo_acc_params_page_s tprlo_acc_params[1];
  757. };
  758. /*
  759. * RSCN els command req payload
  760. */
  761. #define FC_RSCN_PGLEN 0x4
  762. enum fc_rscn_format {
  763. FC_RSCN_FORMAT_PORTID = 0x0,
  764. FC_RSCN_FORMAT_AREA = 0x1,
  765. FC_RSCN_FORMAT_DOMAIN = 0x2,
  766. FC_RSCN_FORMAT_FABRIC = 0x3,
  767. };
  768. struct fc_rscn_event_s {
  769. u32 format:2;
  770. u32 qualifier:4;
  771. u32 resvd:2;
  772. u32 portid:24;
  773. };
  774. struct fc_rscn_pl_s {
  775. u8 command;
  776. u8 pagelen;
  777. __be16 payldlen;
  778. struct fc_rscn_event_s event[1];
  779. };
  780. /*
  781. * ECHO els command req payload
  782. */
  783. struct fc_echo_s {
  784. struct fc_els_cmd_s els_cmd;
  785. };
  786. /*
  787. * RNID els command
  788. */
  789. #define RNID_NODEID_DATA_FORMAT_COMMON 0x00
  790. #define RNID_NODEID_DATA_FORMAT_FCP3 0x08
  791. #define RNID_NODEID_DATA_FORMAT_DISCOVERY 0xDF
  792. #define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
  793. #define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
  794. #define RNID_ASSOCIATED_TYPE_HUB 0x00000003
  795. #define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
  796. #define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
  797. #define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
  798. #define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
  799. #define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
  800. #define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
  801. #define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
  802. #define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
  803. #define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
  804. #define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
  805. /*
  806. * RNID els command payload
  807. */
  808. struct fc_rnid_cmd_s {
  809. struct fc_els_cmd_s els_cmd;
  810. u32 node_id_data_format:8;
  811. u32 reserved:24;
  812. };
  813. /*
  814. * RNID els response payload
  815. */
  816. struct fc_rnid_common_id_data_s {
  817. wwn_t port_name;
  818. wwn_t node_name;
  819. };
  820. struct fc_rnid_general_topology_data_s {
  821. u32 vendor_unique[4];
  822. __be32 asso_type;
  823. u32 phy_port_num;
  824. __be32 num_attached_nodes;
  825. u32 node_mgmt:8;
  826. u32 ip_version:8;
  827. u32 udp_tcp_port_num:16;
  828. u32 ip_address[4];
  829. u32 reserved:16;
  830. u32 vendor_specific:16;
  831. };
  832. struct fc_rnid_acc_s {
  833. struct fc_els_cmd_s els_cmd;
  834. u32 node_id_data_format:8;
  835. u32 common_id_data_length:8;
  836. u32 reserved:8;
  837. u32 specific_id_data_length:8;
  838. struct fc_rnid_common_id_data_s common_id_data;
  839. struct fc_rnid_general_topology_data_s gen_topology_data;
  840. };
  841. #define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
  842. #define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
  843. #define RNID_ASSOCIATED_TYPE_HUB 0x00000003
  844. #define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
  845. #define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
  846. #define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
  847. #define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
  848. #define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
  849. #define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
  850. #define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
  851. #define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
  852. #define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
  853. #define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
  854. enum fc_rpsc_speed_cap {
  855. RPSC_SPEED_CAP_1G = 0x8000,
  856. RPSC_SPEED_CAP_2G = 0x4000,
  857. RPSC_SPEED_CAP_4G = 0x2000,
  858. RPSC_SPEED_CAP_10G = 0x1000,
  859. RPSC_SPEED_CAP_8G = 0x0800,
  860. RPSC_SPEED_CAP_16G = 0x0400,
  861. RPSC_SPEED_CAP_UNKNOWN = 0x0001,
  862. };
  863. enum fc_rpsc_op_speed {
  864. RPSC_OP_SPEED_1G = 0x8000,
  865. RPSC_OP_SPEED_2G = 0x4000,
  866. RPSC_OP_SPEED_4G = 0x2000,
  867. RPSC_OP_SPEED_10G = 0x1000,
  868. RPSC_OP_SPEED_8G = 0x0800,
  869. RPSC_OP_SPEED_16G = 0x0400,
  870. RPSC_OP_SPEED_NOT_EST = 0x0001, /*! speed not established */
  871. };
  872. struct fc_rpsc_speed_info_s {
  873. __be16 port_speed_cap; /*! see enum fc_rpsc_speed_cap */
  874. __be16 port_op_speed; /*! see enum fc_rpsc_op_speed */
  875. };
  876. enum link_e2e_beacon_subcmd {
  877. LINK_E2E_BEACON_ON = 1,
  878. LINK_E2E_BEACON_OFF = 2
  879. };
  880. enum beacon_type {
  881. BEACON_TYPE_NORMAL = 1, /*! Normal Beaconing. Green */
  882. BEACON_TYPE_WARN = 2, /*! Warning Beaconing. Yellow/Amber */
  883. BEACON_TYPE_CRITICAL = 3 /*! Critical Beaconing. Red */
  884. };
  885. struct link_e2e_beacon_param_s {
  886. u8 beacon_type; /* Beacon Type. See enum beacon_type */
  887. u8 beacon_frequency;
  888. /* Beacon frequency. Number of blinks
  889. * per 10 seconds
  890. */
  891. u16 beacon_duration;/* Beacon duration (in Seconds). The
  892. * command operation should be
  893. * terminated at the end of this
  894. * timeout value.
  895. *
  896. * Ignored if diag_sub_cmd is
  897. * LINK_E2E_BEACON_OFF.
  898. *
  899. * If 0, beaconing will continue till a
  900. * BEACON OFF request is received
  901. */
  902. };
  903. /*
  904. * Link E2E beacon request/good response format.
  905. * For LS_RJTs use struct fc_ls_rjt_s
  906. */
  907. struct link_e2e_beacon_req_s {
  908. u32 ls_code; /*! FC_ELS_E2E_LBEACON in requests *
  909. *or FC_ELS_ACC in good replies */
  910. u32 ls_sub_cmd; /*! See enum link_e2e_beacon_subcmd */
  911. struct link_e2e_beacon_param_s beacon_parm;
  912. };
  913. /*
  914. * If RPSC request is sent to the Domain Controller, the request is for
  915. * all the ports within that domain (TODO - I don't think FOS implements
  916. * this...).
  917. */
  918. struct fc_rpsc_cmd_s {
  919. struct fc_els_cmd_s els_cmd;
  920. };
  921. /*
  922. * RPSC Acc
  923. */
  924. struct fc_rpsc_acc_s {
  925. u32 command:8;
  926. u32 rsvd:8;
  927. u32 num_entries:16;
  928. struct fc_rpsc_speed_info_s speed_info[1];
  929. };
  930. /*
  931. * If RPSC2 request is sent to the Domain Controller,
  932. */
  933. #define FC_BRCD_TOKEN 0x42524344
  934. struct fc_rpsc2_cmd_s {
  935. struct fc_els_cmd_s els_cmd;
  936. __be32 token;
  937. u16 resvd;
  938. __be16 num_pids; /* Number of pids in the request */
  939. struct {
  940. u32 rsvd1:8;
  941. u32 pid:24; /* port identifier */
  942. } pid_list[1];
  943. };
  944. enum fc_rpsc2_port_type {
  945. RPSC2_PORT_TYPE_UNKNOWN = 0,
  946. RPSC2_PORT_TYPE_NPORT = 1,
  947. RPSC2_PORT_TYPE_NLPORT = 2,
  948. RPSC2_PORT_TYPE_NPIV_PORT = 0x5f,
  949. RPSC2_PORT_TYPE_NPORT_TRUNK = 0x6f,
  950. };
  951. /*
  952. * RPSC2 portInfo entry structure
  953. */
  954. struct fc_rpsc2_port_info_s {
  955. __be32 pid; /* PID */
  956. u16 resvd1;
  957. __be16 index; /* port number / index */
  958. u8 resvd2;
  959. u8 type; /* port type N/NL/... */
  960. __be16 speed; /* port Operating Speed */
  961. };
  962. /*
  963. * RPSC2 Accept payload
  964. */
  965. struct fc_rpsc2_acc_s {
  966. u8 els_cmd;
  967. u8 resvd;
  968. __be16 num_pids; /* Number of pids in the request */
  969. struct fc_rpsc2_port_info_s port_info[1]; /* port information */
  970. };
  971. /*
  972. * bit fields so that multiple classes can be specified
  973. */
  974. enum fc_cos {
  975. FC_CLASS_2 = 0x04,
  976. FC_CLASS_3 = 0x08,
  977. FC_CLASS_2_3 = 0x0C,
  978. };
  979. /*
  980. * symbolic name
  981. */
  982. struct fc_symname_s {
  983. u8 symname[FC_SYMNAME_MAX];
  984. };
  985. struct fc_alpabm_s {
  986. u8 alpa_bm[FC_ALPA_MAX / 8];
  987. };
  988. /*
  989. * protocol default timeout values
  990. */
  991. #define FC_ED_TOV 2
  992. #define FC_REC_TOV (FC_ED_TOV + 1)
  993. #define FC_RA_TOV 10
  994. #define FC_ELS_TOV (2 * FC_RA_TOV)
  995. #define FC_FCCT_TOV (3 * FC_RA_TOV)
  996. /*
  997. * virtual fabric related defines
  998. */
  999. #define FC_VF_ID_NULL 0 /* must not be used as VF_ID */
  1000. #define FC_VF_ID_MIN 1
  1001. #define FC_VF_ID_MAX 0xEFF
  1002. #define FC_VF_ID_CTL 0xFEF /* control VF_ID */
  1003. /*
  1004. * Virtual Fabric Tagging header format
  1005. * @caution This is defined only in BIG ENDIAN format.
  1006. */
  1007. struct fc_vft_s {
  1008. u32 r_ctl:8;
  1009. u32 ver:2;
  1010. u32 type:4;
  1011. u32 res_a:2;
  1012. u32 priority:3;
  1013. u32 vf_id:12;
  1014. u32 res_b:1;
  1015. u32 hopct:8;
  1016. u32 res_c:24;
  1017. };
  1018. /*
  1019. * FCP
  1020. */
  1021. enum {
  1022. FCP_RJT = 0x01000000, /* SRR reject */
  1023. FCP_SRR_ACCEPT = 0x02000000, /* SRR accept */
  1024. FCP_SRR = 0x14000000, /* Sequence Retransmission Request */
  1025. };
  1026. /*
  1027. * SRR FC-4 LS payload
  1028. */
  1029. struct fc_srr_s {
  1030. u32 ls_cmd;
  1031. u32 ox_id:16; /* ox-id */
  1032. u32 rx_id:16; /* rx-id */
  1033. u32 ro; /* relative offset */
  1034. u32 r_ctl:8; /* R_CTL for I.U. */
  1035. u32 res:24;
  1036. };
  1037. /*
  1038. * FCP_CMND definitions
  1039. */
  1040. #define FCP_CMND_CDB_LEN 16
  1041. #define FCP_CMND_LUN_LEN 8
  1042. struct fcp_cmnd_s {
  1043. struct scsi_lun lun; /* 64-bit LU number */
  1044. u8 crn; /* command reference number */
  1045. #ifdef __BIG_ENDIAN
  1046. u8 resvd:1,
  1047. priority:4, /* FCP-3: SAM-3 priority */
  1048. taskattr:3; /* scsi task attribute */
  1049. #else
  1050. u8 taskattr:3, /* scsi task attribute */
  1051. priority:4, /* FCP-3: SAM-3 priority */
  1052. resvd:1;
  1053. #endif
  1054. u8 tm_flags; /* task management flags */
  1055. #ifdef __BIG_ENDIAN
  1056. u8 addl_cdb_len:6, /* additional CDB length words */
  1057. iodir:2; /* read/write FCP_DATA IUs */
  1058. #else
  1059. u8 iodir:2, /* read/write FCP_DATA IUs */
  1060. addl_cdb_len:6; /* additional CDB length */
  1061. #endif
  1062. scsi_cdb_t cdb;
  1063. /*
  1064. * !!! additional cdb bytes follows here!!!
  1065. */
  1066. __be32 fcp_dl; /* bytes to be transferred */
  1067. };
  1068. #define fcp_cmnd_cdb_len(_cmnd) ((_cmnd)->addl_cdb_len * 4 + FCP_CMND_CDB_LEN)
  1069. #define fcp_cmnd_fcpdl(_cmnd) ((&(_cmnd)->fcp_dl)[(_cmnd)->addl_cdb_len])
  1070. /*
  1071. * struct fcp_cmnd_s .iodir field values
  1072. */
  1073. enum fcp_iodir {
  1074. FCP_IODIR_NONE = 0,
  1075. FCP_IODIR_WRITE = 1,
  1076. FCP_IODIR_READ = 2,
  1077. FCP_IODIR_RW = 3,
  1078. };
  1079. /*
  1080. * Task attribute field
  1081. */
  1082. enum {
  1083. FCP_TASK_ATTR_SIMPLE = 0,
  1084. FCP_TASK_ATTR_HOQ = 1,
  1085. FCP_TASK_ATTR_ORDERED = 2,
  1086. FCP_TASK_ATTR_ACA = 4,
  1087. FCP_TASK_ATTR_UNTAGGED = 5, /* obsolete in FCP-3 */
  1088. };
  1089. /*
  1090. * Task management flags field - only one bit shall be set
  1091. */
  1092. enum fcp_tm_cmnd {
  1093. FCP_TM_ABORT_TASK_SET = BIT(1),
  1094. FCP_TM_CLEAR_TASK_SET = BIT(2),
  1095. FCP_TM_LUN_RESET = BIT(4),
  1096. FCP_TM_TARGET_RESET = BIT(5), /* obsolete in FCP-3 */
  1097. FCP_TM_CLEAR_ACA = BIT(6),
  1098. };
  1099. /*
  1100. * FCP_XFER_RDY IU defines
  1101. */
  1102. struct fcp_xfer_rdy_s {
  1103. u32 data_ro;
  1104. u32 burst_len;
  1105. u32 reserved;
  1106. };
  1107. /*
  1108. * FCP_RSP residue flags
  1109. */
  1110. enum fcp_residue {
  1111. FCP_NO_RESIDUE = 0, /* no residue */
  1112. FCP_RESID_OVER = 1, /* more data left that was not sent */
  1113. FCP_RESID_UNDER = 2, /* less data than requested */
  1114. };
  1115. enum {
  1116. FCP_RSPINFO_GOOD = 0,
  1117. FCP_RSPINFO_DATALEN_MISMATCH = 1,
  1118. FCP_RSPINFO_CMND_INVALID = 2,
  1119. FCP_RSPINFO_ROLEN_MISMATCH = 3,
  1120. FCP_RSPINFO_TM_NOT_SUPP = 4,
  1121. FCP_RSPINFO_TM_FAILED = 5,
  1122. };
  1123. struct fcp_rspinfo_s {
  1124. u32 res0:24;
  1125. u32 rsp_code:8; /* response code (as above) */
  1126. u32 res1;
  1127. };
  1128. struct fcp_resp_s {
  1129. u32 reserved[2]; /* 2 words reserved */
  1130. u16 reserved2;
  1131. #ifdef __BIG_ENDIAN
  1132. u8 reserved3:3;
  1133. u8 fcp_conf_req:1; /* FCP_CONF is requested */
  1134. u8 resid_flags:2; /* underflow/overflow */
  1135. u8 sns_len_valid:1;/* sense len is valid */
  1136. u8 rsp_len_valid:1;/* response len is valid */
  1137. #else
  1138. u8 rsp_len_valid:1;/* response len is valid */
  1139. u8 sns_len_valid:1;/* sense len is valid */
  1140. u8 resid_flags:2; /* underflow/overflow */
  1141. u8 fcp_conf_req:1; /* FCP_CONF is requested */
  1142. u8 reserved3:3;
  1143. #endif
  1144. u8 scsi_status; /* one byte SCSI status */
  1145. u32 residue; /* residual data bytes */
  1146. u32 sns_len; /* length od sense info */
  1147. u32 rsp_len; /* length of response info */
  1148. };
  1149. #define fcp_snslen(__fcprsp) ((__fcprsp)->sns_len_valid ? \
  1150. (__fcprsp)->sns_len : 0)
  1151. #define fcp_rsplen(__fcprsp) ((__fcprsp)->rsp_len_valid ? \
  1152. (__fcprsp)->rsp_len : 0)
  1153. #define fcp_rspinfo(__fcprsp) ((struct fcp_rspinfo_s *)((__fcprsp) + 1))
  1154. #define fcp_snsinfo(__fcprsp) (((u8 *)fcp_rspinfo(__fcprsp)) + \
  1155. fcp_rsplen(__fcprsp))
  1156. struct fcp_cmnd_fr_s {
  1157. struct fchs_s fchs;
  1158. struct fcp_cmnd_s fcp;
  1159. };
  1160. /*
  1161. * CT
  1162. */
  1163. struct ct_hdr_s {
  1164. u32 rev_id:8; /* Revision of the CT */
  1165. u32 in_id:24; /* Initiator Id */
  1166. u32 gs_type:8; /* Generic service Type */
  1167. u32 gs_sub_type:8; /* Generic service sub type */
  1168. u32 options:8; /* options */
  1169. u32 rsvrd:8; /* reserved */
  1170. u32 cmd_rsp_code:16;/* ct command/response code */
  1171. u32 max_res_size:16;/* maximum/residual size */
  1172. u32 frag_id:8; /* fragment ID */
  1173. u32 reason_code:8; /* reason code */
  1174. u32 exp_code:8; /* explanation code */
  1175. u32 vendor_unq:8; /* vendor unique */
  1176. };
  1177. /*
  1178. * defines for the Revision
  1179. */
  1180. enum {
  1181. CT_GS3_REVISION = 0x01,
  1182. };
  1183. /*
  1184. * defines for gs_type
  1185. */
  1186. enum {
  1187. CT_GSTYPE_KEYSERVICE = 0xF7,
  1188. CT_GSTYPE_ALIASSERVICE = 0xF8,
  1189. CT_GSTYPE_MGMTSERVICE = 0xFA,
  1190. CT_GSTYPE_TIMESERVICE = 0xFB,
  1191. CT_GSTYPE_DIRSERVICE = 0xFC,
  1192. };
  1193. /*
  1194. * defines for gs_sub_type for gs type directory service
  1195. */
  1196. enum {
  1197. CT_GSSUBTYPE_NAMESERVER = 0x02,
  1198. };
  1199. /*
  1200. * defines for gs_sub_type for gs type management service
  1201. */
  1202. enum {
  1203. CT_GSSUBTYPE_CFGSERVER = 0x01,
  1204. CT_GSSUBTYPE_UNZONED_NS = 0x02,
  1205. CT_GSSUBTYPE_ZONESERVER = 0x03,
  1206. CT_GSSUBTYPE_LOCKSERVER = 0x04,
  1207. CT_GSSUBTYPE_HBA_MGMTSERVER = 0x10, /* for FDMI */
  1208. };
  1209. /*
  1210. * defines for CT response code field
  1211. */
  1212. enum {
  1213. CT_RSP_REJECT = 0x8001,
  1214. CT_RSP_ACCEPT = 0x8002,
  1215. };
  1216. /*
  1217. * defintions for CT reason code
  1218. */
  1219. enum {
  1220. CT_RSN_INV_CMD = 0x01,
  1221. CT_RSN_INV_VER = 0x02,
  1222. CT_RSN_LOGIC_ERR = 0x03,
  1223. CT_RSN_INV_SIZE = 0x04,
  1224. CT_RSN_LOGICAL_BUSY = 0x05,
  1225. CT_RSN_PROTO_ERR = 0x07,
  1226. CT_RSN_UNABLE_TO_PERF = 0x09,
  1227. CT_RSN_NOT_SUPP = 0x0B,
  1228. CT_RSN_SERVER_NOT_AVBL = 0x0D,
  1229. CT_RSN_SESSION_COULD_NOT_BE_ESTBD = 0x0E,
  1230. CT_RSN_VENDOR_SPECIFIC = 0xFF,
  1231. };
  1232. /*
  1233. * definitions for explanations code for Name server
  1234. */
  1235. enum {
  1236. CT_NS_EXP_NOADDITIONAL = 0x00,
  1237. CT_NS_EXP_ID_NOT_REG = 0x01,
  1238. CT_NS_EXP_PN_NOT_REG = 0x02,
  1239. CT_NS_EXP_NN_NOT_REG = 0x03,
  1240. CT_NS_EXP_CS_NOT_REG = 0x04,
  1241. CT_NS_EXP_IPN_NOT_REG = 0x05,
  1242. CT_NS_EXP_IPA_NOT_REG = 0x06,
  1243. CT_NS_EXP_FT_NOT_REG = 0x07,
  1244. CT_NS_EXP_SPN_NOT_REG = 0x08,
  1245. CT_NS_EXP_SNN_NOT_REG = 0x09,
  1246. CT_NS_EXP_PT_NOT_REG = 0x0A,
  1247. CT_NS_EXP_IPP_NOT_REG = 0x0B,
  1248. CT_NS_EXP_FPN_NOT_REG = 0x0C,
  1249. CT_NS_EXP_HA_NOT_REG = 0x0D,
  1250. CT_NS_EXP_FD_NOT_REG = 0x0E,
  1251. CT_NS_EXP_FF_NOT_REG = 0x0F,
  1252. CT_NS_EXP_ACCESSDENIED = 0x10,
  1253. CT_NS_EXP_UNACCEPTABLE_ID = 0x11,
  1254. CT_NS_EXP_DATABASEEMPTY = 0x12,
  1255. CT_NS_EXP_NOT_REG_IN_SCOPE = 0x13,
  1256. CT_NS_EXP_DOM_ID_NOT_PRESENT = 0x14,
  1257. CT_NS_EXP_PORT_NUM_NOT_PRESENT = 0x15,
  1258. CT_NS_EXP_NO_DEVICE_ATTACHED = 0x16
  1259. };
  1260. /*
  1261. * defintions for the explanation code for all servers
  1262. */
  1263. enum {
  1264. CT_EXP_AUTH_EXCEPTION = 0xF1,
  1265. CT_EXP_DB_FULL = 0xF2,
  1266. CT_EXP_DB_EMPTY = 0xF3,
  1267. CT_EXP_PROCESSING_REQ = 0xF4,
  1268. CT_EXP_UNABLE_TO_VERIFY_CONN = 0xF5,
  1269. CT_EXP_DEVICES_NOT_IN_CMN_ZONE = 0xF6
  1270. };
  1271. /*
  1272. * Command codes for Name server
  1273. */
  1274. enum {
  1275. GS_GID_PN = 0x0121, /* Get Id on port name */
  1276. GS_GPN_ID = 0x0112, /* Get port name on ID */
  1277. GS_GNN_ID = 0x0113, /* Get node name on ID */
  1278. GS_GID_FT = 0x0171, /* Get Id on FC4 type */
  1279. GS_GSPN_ID = 0x0118, /* Get symbolic PN on ID */
  1280. GS_RFT_ID = 0x0217, /* Register fc4type on ID */
  1281. GS_RSPN_ID = 0x0218, /* Register symbolic PN on ID */
  1282. GS_RPN_ID = 0x0212, /* Register port name */
  1283. GS_RNN_ID = 0x0213, /* Register node name */
  1284. GS_RCS_ID = 0x0214, /* Register class of service */
  1285. GS_RPT_ID = 0x021A, /* Register port type */
  1286. GS_GA_NXT = 0x0100, /* Get all next */
  1287. GS_RFF_ID = 0x021F, /* Register FC4 Feature */
  1288. };
  1289. struct fcgs_id_req_s{
  1290. u32 rsvd:8;
  1291. u32 dap:24; /* port identifier */
  1292. };
  1293. #define fcgs_gpnid_req_t struct fcgs_id_req_s
  1294. #define fcgs_gnnid_req_t struct fcgs_id_req_s
  1295. #define fcgs_gspnid_req_t struct fcgs_id_req_s
  1296. struct fcgs_gidpn_req_s {
  1297. wwn_t port_name; /* port wwn */
  1298. };
  1299. struct fcgs_gidpn_resp_s {
  1300. u32 rsvd:8;
  1301. u32 dap:24; /* port identifier */
  1302. };
  1303. /*
  1304. * RFT_ID
  1305. */
  1306. struct fcgs_rftid_req_s {
  1307. u32 rsvd:8;
  1308. u32 dap:24; /* port identifier */
  1309. __be32 fc4_type[8]; /* fc4 types */
  1310. };
  1311. /*
  1312. * RFF_ID : Register FC4 features.
  1313. */
  1314. #define FC_GS_FCP_FC4_FEATURE_INITIATOR 0x02
  1315. #define FC_GS_FCP_FC4_FEATURE_TARGET 0x01
  1316. struct fcgs_rffid_req_s {
  1317. u32 rsvd:8;
  1318. u32 dap:24; /* port identifier */
  1319. u32 rsvd1:16;
  1320. u32 fc4ftr_bits:8; /* fc4 feature bits */
  1321. u32 fc4_type:8; /* corresponding FC4 Type */
  1322. };
  1323. /*
  1324. * GID_FT Request
  1325. */
  1326. struct fcgs_gidft_req_s {
  1327. u8 reserved;
  1328. u8 domain_id; /* domain, 0 - all fabric */
  1329. u8 area_id; /* area, 0 - whole domain */
  1330. u8 fc4_type; /* FC_TYPE_FCP for SCSI devices */
  1331. }; /* GID_FT Request */
  1332. /*
  1333. * GID_FT Response
  1334. */
  1335. struct fcgs_gidft_resp_s {
  1336. u8 last:1; /* last port identifier flag */
  1337. u8 reserved:7;
  1338. u32 pid:24; /* port identifier */
  1339. }; /* GID_FT Response */
  1340. /*
  1341. * RSPN_ID
  1342. */
  1343. struct fcgs_rspnid_req_s {
  1344. u32 rsvd:8;
  1345. u32 dap:24; /* port identifier */
  1346. u8 spn_len; /* symbolic port name length */
  1347. u8 spn[256]; /* symbolic port name */
  1348. };
  1349. /*
  1350. * RPN_ID
  1351. */
  1352. struct fcgs_rpnid_req_s {
  1353. u32 rsvd:8;
  1354. u32 port_id:24;
  1355. wwn_t port_name;
  1356. };
  1357. /*
  1358. * RNN_ID
  1359. */
  1360. struct fcgs_rnnid_req_s {
  1361. u32 rsvd:8;
  1362. u32 port_id:24;
  1363. wwn_t node_name;
  1364. };
  1365. /*
  1366. * RCS_ID
  1367. */
  1368. struct fcgs_rcsid_req_s {
  1369. u32 rsvd:8;
  1370. u32 port_id:24;
  1371. u32 cos;
  1372. };
  1373. /*
  1374. * RPT_ID
  1375. */
  1376. struct fcgs_rptid_req_s {
  1377. u32 rsvd:8;
  1378. u32 port_id:24;
  1379. u32 port_type:8;
  1380. u32 rsvd1:24;
  1381. };
  1382. /*
  1383. * GA_NXT Request
  1384. */
  1385. struct fcgs_ganxt_req_s {
  1386. u32 rsvd:8;
  1387. u32 port_id:24;
  1388. };
  1389. /*
  1390. * GA_NXT Response
  1391. */
  1392. struct fcgs_ganxt_rsp_s {
  1393. u32 port_type:8; /* Port Type */
  1394. u32 port_id:24; /* Port Identifier */
  1395. wwn_t port_name; /* Port Name */
  1396. u8 spn_len; /* Length of Symbolic Port Name */
  1397. char spn[255]; /* Symbolic Port Name */
  1398. wwn_t node_name; /* Node Name */
  1399. u8 snn_len; /* Length of Symbolic Node Name */
  1400. char snn[255]; /* Symbolic Node Name */
  1401. u8 ipa[8]; /* Initial Process Associator */
  1402. u8 ip[16]; /* IP Address */
  1403. u32 cos; /* Class of Service */
  1404. u32 fc4types[8]; /* FC-4 TYPEs */
  1405. wwn_t fabric_port_name;
  1406. /* Fabric Port Name */
  1407. u32 rsvd:8; /* Reserved */
  1408. u32 hard_addr:24; /* Hard Address */
  1409. };
  1410. /*
  1411. * Fabric Config Server
  1412. */
  1413. /*
  1414. * Command codes for Fabric Configuration Server
  1415. */
  1416. enum {
  1417. GS_FC_GFN_CMD = 0x0114, /* GS FC Get Fabric Name */
  1418. GS_FC_GMAL_CMD = 0x0116, /* GS FC GMAL */
  1419. GS_FC_TRACE_CMD = 0x0400, /* GS FC Trace Route */
  1420. GS_FC_PING_CMD = 0x0401, /* GS FC Ping */
  1421. };
  1422. /*
  1423. * Source or Destination Port Tags.
  1424. */
  1425. enum {
  1426. GS_FTRACE_TAG_NPORT_ID = 1,
  1427. GS_FTRACE_TAG_NPORT_NAME = 2,
  1428. };
  1429. /*
  1430. * Port Value : Could be a Port id or wwn
  1431. */
  1432. union fcgs_port_val_u {
  1433. u32 nport_id;
  1434. wwn_t nport_wwn;
  1435. };
  1436. #define GS_FTRACE_MAX_HOP_COUNT 20
  1437. #define GS_FTRACE_REVISION 1
  1438. /*
  1439. * Ftrace Related Structures.
  1440. */
  1441. /*
  1442. * STR (Switch Trace) Reject Reason Codes. From FC-SW.
  1443. */
  1444. enum {
  1445. GS_FTRACE_STR_CMD_COMPLETED_SUCC = 0,
  1446. GS_FTRACE_STR_CMD_NOT_SUPP_IN_NEXT_SWITCH,
  1447. GS_FTRACE_STR_NO_RESP_FROM_NEXT_SWITCH,
  1448. GS_FTRACE_STR_MAX_HOP_CNT_REACHED,
  1449. GS_FTRACE_STR_SRC_PORT_NOT_FOUND,
  1450. GS_FTRACE_STR_DST_PORT_NOT_FOUND,
  1451. GS_FTRACE_STR_DEVICES_NOT_IN_COMMON_ZONE,
  1452. GS_FTRACE_STR_NO_ROUTE_BW_PORTS,
  1453. GS_FTRACE_STR_NO_ADDL_EXPLN,
  1454. GS_FTRACE_STR_FABRIC_BUSY,
  1455. GS_FTRACE_STR_FABRIC_BUILD_IN_PROGRESS,
  1456. GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_START = 0xf0,
  1457. GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_END = 0xff,
  1458. };
  1459. /*
  1460. * Ftrace Request
  1461. */
  1462. struct fcgs_ftrace_req_s {
  1463. u32 revision;
  1464. u16 src_port_tag; /* Source Port tag */
  1465. u16 src_port_len; /* Source Port len */
  1466. union fcgs_port_val_u src_port_val; /* Source Port value */
  1467. u16 dst_port_tag; /* Destination Port tag */
  1468. u16 dst_port_len; /* Destination Port len */
  1469. union fcgs_port_val_u dst_port_val; /* Destination Port value */
  1470. u32 token;
  1471. u8 vendor_id[8]; /* T10 Vendor Identifier */
  1472. u8 vendor_info[8]; /* Vendor specific Info */
  1473. u32 max_hop_cnt; /* Max Hop Count */
  1474. };
  1475. /*
  1476. * Path info structure
  1477. */
  1478. struct fcgs_ftrace_path_info_s {
  1479. wwn_t switch_name; /* Switch WWN */
  1480. u32 domain_id;
  1481. wwn_t ingress_port_name; /* Ingress ports wwn */
  1482. u32 ingress_phys_port_num; /* Ingress ports physical port
  1483. * number
  1484. */
  1485. wwn_t egress_port_name; /* Ingress ports wwn */
  1486. u32 egress_phys_port_num; /* Ingress ports physical port
  1487. * number
  1488. */
  1489. };
  1490. /*
  1491. * Ftrace Acc Response
  1492. */
  1493. struct fcgs_ftrace_resp_s {
  1494. u32 revision;
  1495. u32 token;
  1496. u8 vendor_id[8]; /* T10 Vendor Identifier */
  1497. u8 vendor_info[8]; /* Vendor specific Info */
  1498. u32 str_rej_reason_code; /* STR Reject Reason Code */
  1499. u32 num_path_info_entries; /* No. of path info entries */
  1500. /*
  1501. * path info entry/entries.
  1502. */
  1503. struct fcgs_ftrace_path_info_s path_info[1];
  1504. };
  1505. /*
  1506. * Fabric Config Server : FCPing
  1507. */
  1508. /*
  1509. * FC Ping Request
  1510. */
  1511. struct fcgs_fcping_req_s {
  1512. u32 revision;
  1513. u16 port_tag;
  1514. u16 port_len; /* Port len */
  1515. union fcgs_port_val_u port_val; /* Port value */
  1516. u32 token;
  1517. };
  1518. /*
  1519. * FC Ping Response
  1520. */
  1521. struct fcgs_fcping_resp_s {
  1522. u32 token;
  1523. };
  1524. /*
  1525. * Command codes for zone server query.
  1526. */
  1527. enum {
  1528. ZS_GZME = 0x0124, /* Get zone member extended */
  1529. };
  1530. /*
  1531. * ZS GZME request
  1532. */
  1533. #define ZS_GZME_ZNAMELEN 32
  1534. struct zs_gzme_req_s {
  1535. u8 znamelen;
  1536. u8 rsvd[3];
  1537. u8 zname[ZS_GZME_ZNAMELEN];
  1538. };
  1539. enum zs_mbr_type {
  1540. ZS_MBR_TYPE_PWWN = 1,
  1541. ZS_MBR_TYPE_DOMPORT = 2,
  1542. ZS_MBR_TYPE_PORTID = 3,
  1543. ZS_MBR_TYPE_NWWN = 4,
  1544. };
  1545. struct zs_mbr_wwn_s {
  1546. u8 mbr_type;
  1547. u8 rsvd[3];
  1548. wwn_t wwn;
  1549. };
  1550. struct zs_query_resp_s {
  1551. u32 nmbrs; /* number of zone members */
  1552. struct zs_mbr_wwn_s mbr[1];
  1553. };
  1554. /*
  1555. * GMAL Command ( Get ( interconnect Element) Management Address List)
  1556. * To retrieve the IP Address of a Switch.
  1557. */
  1558. #define CT_GMAL_RESP_PREFIX_TELNET "telnet://"
  1559. #define CT_GMAL_RESP_PREFIX_HTTP "http://"
  1560. /* GMAL/GFN request */
  1561. struct fcgs_req_s {
  1562. wwn_t wwn; /* PWWN/NWWN */
  1563. };
  1564. #define fcgs_gmal_req_t struct fcgs_req_s
  1565. #define fcgs_gfn_req_t struct fcgs_req_s
  1566. /* Accept Response to GMAL */
  1567. struct fcgs_gmal_resp_s {
  1568. __be32 ms_len; /* Num of entries */
  1569. u8 ms_ma[256];
  1570. };
  1571. struct fcgs_gmal_entry_s {
  1572. u8 len;
  1573. u8 prefix[7]; /* like "http://" */
  1574. u8 ip_addr[248];
  1575. };
  1576. /*
  1577. * FDMI
  1578. */
  1579. /*
  1580. * FDMI Command Codes
  1581. */
  1582. #define FDMI_GRHL 0x0100
  1583. #define FDMI_GHAT 0x0101
  1584. #define FDMI_GRPL 0x0102
  1585. #define FDMI_GPAT 0x0110
  1586. #define FDMI_RHBA 0x0200
  1587. #define FDMI_RHAT 0x0201
  1588. #define FDMI_RPRT 0x0210
  1589. #define FDMI_RPA 0x0211
  1590. #define FDMI_DHBA 0x0300
  1591. #define FDMI_DPRT 0x0310
  1592. /*
  1593. * FDMI reason codes
  1594. */
  1595. #define FDMI_NO_ADDITIONAL_EXP 0x00
  1596. #define FDMI_HBA_ALREADY_REG 0x10
  1597. #define FDMI_HBA_ATTRIB_NOT_REG 0x11
  1598. #define FDMI_HBA_ATTRIB_MULTIPLE 0x12
  1599. #define FDMI_HBA_ATTRIB_LENGTH_INVALID 0x13
  1600. #define FDMI_HBA_ATTRIB_NOT_PRESENT 0x14
  1601. #define FDMI_PORT_ORIG_NOT_IN_LIST 0x15
  1602. #define FDMI_PORT_HBA_NOT_IN_LIST 0x16
  1603. #define FDMI_PORT_ATTRIB_NOT_REG 0x20
  1604. #define FDMI_PORT_NOT_REG 0x21
  1605. #define FDMI_PORT_ATTRIB_MULTIPLE 0x22
  1606. #define FDMI_PORT_ATTRIB_LENGTH_INVALID 0x23
  1607. #define FDMI_PORT_ALREADY_REGISTEREED 0x24
  1608. /*
  1609. * FDMI Transmission Speed Mask values
  1610. */
  1611. #define FDMI_TRANS_SPEED_1G 0x00000001
  1612. #define FDMI_TRANS_SPEED_2G 0x00000002
  1613. #define FDMI_TRANS_SPEED_10G 0x00000004
  1614. #define FDMI_TRANS_SPEED_4G 0x00000008
  1615. #define FDMI_TRANS_SPEED_8G 0x00000010
  1616. #define FDMI_TRANS_SPEED_16G 0x00000020
  1617. #define FDMI_TRANS_SPEED_UNKNOWN 0x00008000
  1618. /*
  1619. * FDMI HBA attribute types
  1620. */
  1621. enum fdmi_hba_attribute_type {
  1622. FDMI_HBA_ATTRIB_NODENAME = 1, /* 0x0001 */
  1623. FDMI_HBA_ATTRIB_MANUFACTURER, /* 0x0002 */
  1624. FDMI_HBA_ATTRIB_SERIALNUM, /* 0x0003 */
  1625. FDMI_HBA_ATTRIB_MODEL, /* 0x0004 */
  1626. FDMI_HBA_ATTRIB_MODEL_DESC, /* 0x0005 */
  1627. FDMI_HBA_ATTRIB_HW_VERSION, /* 0x0006 */
  1628. FDMI_HBA_ATTRIB_DRIVER_VERSION, /* 0x0007 */
  1629. FDMI_HBA_ATTRIB_ROM_VERSION, /* 0x0008 */
  1630. FDMI_HBA_ATTRIB_FW_VERSION, /* 0x0009 */
  1631. FDMI_HBA_ATTRIB_OS_NAME, /* 0x000A */
  1632. FDMI_HBA_ATTRIB_MAX_CT, /* 0x000B */
  1633. FDMI_HBA_ATTRIB_MAX_TYPE
  1634. };
  1635. /*
  1636. * FDMI Port attribute types
  1637. */
  1638. enum fdmi_port_attribute_type {
  1639. FDMI_PORT_ATTRIB_FC4_TYPES = 1, /* 0x0001 */
  1640. FDMI_PORT_ATTRIB_SUPP_SPEED, /* 0x0002 */
  1641. FDMI_PORT_ATTRIB_PORT_SPEED, /* 0x0003 */
  1642. FDMI_PORT_ATTRIB_FRAME_SIZE, /* 0x0004 */
  1643. FDMI_PORT_ATTRIB_DEV_NAME, /* 0x0005 */
  1644. FDMI_PORT_ATTRIB_HOST_NAME, /* 0x0006 */
  1645. FDMI_PORT_ATTR_MAX_TYPE
  1646. };
  1647. /*
  1648. * FDMI attribute
  1649. */
  1650. struct fdmi_attr_s {
  1651. __be16 type;
  1652. __be16 len;
  1653. u8 value[1];
  1654. };
  1655. /*
  1656. * HBA Attribute Block
  1657. */
  1658. struct fdmi_hba_attr_s {
  1659. __be32 attr_count; /* # of attributes */
  1660. struct fdmi_attr_s hba_attr; /* n attributes */
  1661. };
  1662. /*
  1663. * Registered Port List
  1664. */
  1665. struct fdmi_port_list_s {
  1666. __be32 num_ports; /* number Of Port Entries */
  1667. wwn_t port_entry; /* one or more */
  1668. };
  1669. /*
  1670. * Port Attribute Block
  1671. */
  1672. struct fdmi_port_attr_s {
  1673. __be32 attr_count; /* # of attributes */
  1674. struct fdmi_attr_s port_attr; /* n attributes */
  1675. };
  1676. /*
  1677. * FDMI Register HBA Attributes
  1678. */
  1679. struct fdmi_rhba_s {
  1680. wwn_t hba_id; /* HBA Identifier */
  1681. struct fdmi_port_list_s port_list; /* Registered Port List */
  1682. struct fdmi_hba_attr_s hba_attr_blk; /* HBA attribute block */
  1683. };
  1684. /*
  1685. * FDMI Register Port
  1686. */
  1687. struct fdmi_rprt_s {
  1688. wwn_t hba_id; /* HBA Identifier */
  1689. wwn_t port_name; /* Port wwn */
  1690. struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
  1691. };
  1692. /*
  1693. * FDMI Register Port Attributes
  1694. */
  1695. struct fdmi_rpa_s {
  1696. wwn_t port_name; /* port wwn */
  1697. struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
  1698. };
  1699. #pragma pack()
  1700. #endif /* __BFA_FC_H__ */