bfa_fc.h 45 KB

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