bfa_fc.h 43 KB

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