fc_els.h 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Copyright(c) 2007 Intel Corporation. All rights reserved.
  4. *
  5. * Maintained at www.Open-FCoE.org
  6. */
  7. #ifndef _FC_ELS_H_
  8. #define _FC_ELS_H_
  9. #include <linux/types.h>
  10. #include <asm/byteorder.h>
  11. /*
  12. * Fibre Channel Switch - Enhanced Link Services definitions.
  13. * From T11 FC-LS Rev 1.2 June 7, 2005.
  14. */
  15. /*
  16. * ELS Command codes - byte 0 of the frame payload
  17. */
  18. enum fc_els_cmd {
  19. ELS_LS_RJT = 0x01, /* ESL reject */
  20. ELS_LS_ACC = 0x02, /* ESL Accept */
  21. ELS_PLOGI = 0x03, /* N_Port login */
  22. ELS_FLOGI = 0x04, /* F_Port login */
  23. ELS_LOGO = 0x05, /* Logout */
  24. ELS_ABTX = 0x06, /* Abort exchange - obsolete */
  25. ELS_RCS = 0x07, /* read connection status */
  26. ELS_RES = 0x08, /* read exchange status block */
  27. ELS_RSS = 0x09, /* read sequence status block */
  28. ELS_RSI = 0x0a, /* read sequence initiative */
  29. ELS_ESTS = 0x0b, /* establish streaming */
  30. ELS_ESTC = 0x0c, /* estimate credit */
  31. ELS_ADVC = 0x0d, /* advise credit */
  32. ELS_RTV = 0x0e, /* read timeout value */
  33. ELS_RLS = 0x0f, /* read link error status block */
  34. ELS_ECHO = 0x10, /* echo */
  35. ELS_TEST = 0x11, /* test */
  36. ELS_RRQ = 0x12, /* reinstate recovery qualifier */
  37. ELS_REC = 0x13, /* read exchange concise */
  38. ELS_SRR = 0x14, /* sequence retransmission request */
  39. ELS_FPIN = 0x16, /* Fabric Performance Impact Notification */
  40. ELS_EDC = 0x17, /* Exchange Diagnostic Capabilities */
  41. ELS_RDP = 0x18, /* Read Diagnostic Parameters */
  42. ELS_RDF = 0x19, /* Register Diagnostic Functions */
  43. ELS_PRLI = 0x20, /* process login */
  44. ELS_PRLO = 0x21, /* process logout */
  45. ELS_SCN = 0x22, /* state change notification */
  46. ELS_TPLS = 0x23, /* test process login state */
  47. ELS_TPRLO = 0x24, /* third party process logout */
  48. ELS_LCLM = 0x25, /* login control list mgmt (obs) */
  49. ELS_GAID = 0x30, /* get alias_ID */
  50. ELS_FACT = 0x31, /* fabric activate alias_id */
  51. ELS_FDACDT = 0x32, /* fabric deactivate alias_id */
  52. ELS_NACT = 0x33, /* N-port activate alias_id */
  53. ELS_NDACT = 0x34, /* N-port deactivate alias_id */
  54. ELS_QOSR = 0x40, /* quality of service request */
  55. ELS_RVCS = 0x41, /* read virtual circuit status */
  56. ELS_PDISC = 0x50, /* discover N_port service params */
  57. ELS_FDISC = 0x51, /* discover F_port service params */
  58. ELS_ADISC = 0x52, /* discover address */
  59. ELS_RNC = 0x53, /* report node cap (obs) */
  60. ELS_FARP_REQ = 0x54, /* FC ARP request */
  61. ELS_FARP_REPL = 0x55, /* FC ARP reply */
  62. ELS_RPS = 0x56, /* read port status block */
  63. ELS_RPL = 0x57, /* read port list */
  64. ELS_RPBC = 0x58, /* read port buffer condition */
  65. ELS_FAN = 0x60, /* fabric address notification */
  66. ELS_RSCN = 0x61, /* registered state change notification */
  67. ELS_SCR = 0x62, /* state change registration */
  68. ELS_RNFT = 0x63, /* report node FC-4 types */
  69. ELS_CSR = 0x68, /* clock synch. request */
  70. ELS_CSU = 0x69, /* clock synch. update */
  71. ELS_LINIT = 0x70, /* loop initialize */
  72. ELS_LSTS = 0x72, /* loop status */
  73. ELS_RNID = 0x78, /* request node ID data */
  74. ELS_RLIR = 0x79, /* registered link incident report */
  75. ELS_LIRR = 0x7a, /* link incident record registration */
  76. ELS_SRL = 0x7b, /* scan remote loop */
  77. ELS_SBRP = 0x7c, /* set bit-error reporting params */
  78. ELS_RPSC = 0x7d, /* report speed capabilities */
  79. ELS_QSA = 0x7e, /* query security attributes */
  80. ELS_EVFP = 0x7f, /* exchange virt. fabrics params */
  81. ELS_LKA = 0x80, /* link keep-alive */
  82. ELS_AUTH_ELS = 0x90, /* authentication ELS */
  83. };
  84. /*
  85. * Initializer useful for decoding table.
  86. * Please keep this in sync with the above definitions.
  87. */
  88. #define FC_ELS_CMDS_INIT { \
  89. [ELS_LS_RJT] = "LS_RJT", \
  90. [ELS_LS_ACC] = "LS_ACC", \
  91. [ELS_PLOGI] = "PLOGI", \
  92. [ELS_FLOGI] = "FLOGI", \
  93. [ELS_LOGO] = "LOGO", \
  94. [ELS_ABTX] = "ABTX", \
  95. [ELS_RCS] = "RCS", \
  96. [ELS_RES] = "RES", \
  97. [ELS_RSS] = "RSS", \
  98. [ELS_RSI] = "RSI", \
  99. [ELS_ESTS] = "ESTS", \
  100. [ELS_ESTC] = "ESTC", \
  101. [ELS_ADVC] = "ADVC", \
  102. [ELS_RTV] = "RTV", \
  103. [ELS_RLS] = "RLS", \
  104. [ELS_ECHO] = "ECHO", \
  105. [ELS_TEST] = "TEST", \
  106. [ELS_RRQ] = "RRQ", \
  107. [ELS_REC] = "REC", \
  108. [ELS_SRR] = "SRR", \
  109. [ELS_FPIN] = "FPIN", \
  110. [ELS_EDC] = "EDC", \
  111. [ELS_RDP] = "RDP", \
  112. [ELS_RDF] = "RDF", \
  113. [ELS_PRLI] = "PRLI", \
  114. [ELS_PRLO] = "PRLO", \
  115. [ELS_SCN] = "SCN", \
  116. [ELS_TPLS] = "TPLS", \
  117. [ELS_TPRLO] = "TPRLO", \
  118. [ELS_LCLM] = "LCLM", \
  119. [ELS_GAID] = "GAID", \
  120. [ELS_FACT] = "FACT", \
  121. [ELS_FDACDT] = "FDACDT", \
  122. [ELS_NACT] = "NACT", \
  123. [ELS_NDACT] = "NDACT", \
  124. [ELS_QOSR] = "QOSR", \
  125. [ELS_RVCS] = "RVCS", \
  126. [ELS_PDISC] = "PDISC", \
  127. [ELS_FDISC] = "FDISC", \
  128. [ELS_ADISC] = "ADISC", \
  129. [ELS_RNC] = "RNC", \
  130. [ELS_FARP_REQ] = "FARP_REQ", \
  131. [ELS_FARP_REPL] = "FARP_REPL", \
  132. [ELS_RPS] = "RPS", \
  133. [ELS_RPL] = "RPL", \
  134. [ELS_RPBC] = "RPBC", \
  135. [ELS_FAN] = "FAN", \
  136. [ELS_RSCN] = "RSCN", \
  137. [ELS_SCR] = "SCR", \
  138. [ELS_RNFT] = "RNFT", \
  139. [ELS_CSR] = "CSR", \
  140. [ELS_CSU] = "CSU", \
  141. [ELS_LINIT] = "LINIT", \
  142. [ELS_LSTS] = "LSTS", \
  143. [ELS_RNID] = "RNID", \
  144. [ELS_RLIR] = "RLIR", \
  145. [ELS_LIRR] = "LIRR", \
  146. [ELS_SRL] = "SRL", \
  147. [ELS_SBRP] = "SBRP", \
  148. [ELS_RPSC] = "RPSC", \
  149. [ELS_QSA] = "QSA", \
  150. [ELS_EVFP] = "EVFP", \
  151. [ELS_LKA] = "LKA", \
  152. [ELS_AUTH_ELS] = "AUTH_ELS", \
  153. }
  154. /*
  155. * LS_ACC payload.
  156. */
  157. struct fc_els_ls_acc {
  158. __u8 la_cmd; /* command code ELS_LS_ACC */
  159. __u8 la_resv[3]; /* reserved */
  160. };
  161. /*
  162. * ELS reject payload.
  163. */
  164. struct fc_els_ls_rjt {
  165. __u8 er_cmd; /* command code ELS_LS_RJT */
  166. __u8 er_resv[4]; /* reserved must be zero */
  167. __u8 er_reason; /* reason (enum fc_els_rjt_reason below) */
  168. __u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */
  169. __u8 er_vendor; /* vendor specific code */
  170. };
  171. /*
  172. * ELS reject reason codes (er_reason).
  173. */
  174. enum fc_els_rjt_reason {
  175. ELS_RJT_NONE = 0, /* no reject - not to be sent */
  176. ELS_RJT_INVAL = 0x01, /* invalid ELS command code */
  177. ELS_RJT_LOGIC = 0x03, /* logical error */
  178. ELS_RJT_BUSY = 0x05, /* logical busy */
  179. ELS_RJT_PROT = 0x07, /* protocol error */
  180. ELS_RJT_UNAB = 0x09, /* unable to perform command request */
  181. ELS_RJT_UNSUP = 0x0b, /* command not supported */
  182. ELS_RJT_INPROG = 0x0e, /* command already in progress */
  183. ELS_RJT_FIP = 0x20, /* FIP error */
  184. ELS_RJT_VENDOR = 0xff, /* vendor specific error */
  185. };
  186. /*
  187. * reason code explanation (er_explan).
  188. */
  189. enum fc_els_rjt_explan {
  190. ELS_EXPL_NONE = 0x00, /* No additional explanation */
  191. ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */
  192. ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */
  193. ELS_EXPL_AH = 0x11, /* invalid association header */
  194. ELS_EXPL_AH_REQ = 0x13, /* association_header required */
  195. ELS_EXPL_SID = 0x15, /* invalid originator S_ID */
  196. ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */
  197. ELS_EXPL_INPROG = 0x19, /* Request already in progress */
  198. ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */
  199. ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */
  200. ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */
  201. ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */
  202. ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */
  203. ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */
  204. /* TBD - above definitions incomplete */
  205. };
  206. /*
  207. * Link Service TLV Descriptor Tag Values
  208. */
  209. enum fc_ls_tlv_dtag {
  210. ELS_DTAG_LS_REQ_INFO = 0x00000001,
  211. /* Link Service Request Information Descriptor */
  212. ELS_DTAG_LNK_FAULT_CAP = 0x0001000D,
  213. /* Link Fault Capability Descriptor */
  214. ELS_DTAG_CG_SIGNAL_CAP = 0x0001000F,
  215. /* Congestion Signaling Capability Descriptor */
  216. ELS_DTAG_LNK_INTEGRITY = 0x00020001,
  217. /* Link Integrity Notification Descriptor */
  218. ELS_DTAG_DELIVERY = 0x00020002,
  219. /* Delivery Notification Descriptor */
  220. ELS_DTAG_PEER_CONGEST = 0x00020003,
  221. /* Peer Congestion Notification Descriptor */
  222. ELS_DTAG_CONGESTION = 0x00020004,
  223. /* Congestion Notification Descriptor */
  224. ELS_DTAG_FPIN_REGISTER = 0x00030001,
  225. /* FPIN Registration Descriptor */
  226. };
  227. /*
  228. * Initializer useful for decoding table.
  229. * Please keep this in sync with the above definitions.
  230. */
  231. #define FC_LS_TLV_DTAG_INIT { \
  232. { ELS_DTAG_LS_REQ_INFO, "Link Service Request Information" }, \
  233. { ELS_DTAG_LNK_FAULT_CAP, "Link Fault Capability" }, \
  234. { ELS_DTAG_CG_SIGNAL_CAP, "Congestion Signaling Capability" }, \
  235. { ELS_DTAG_LNK_INTEGRITY, "Link Integrity Notification" }, \
  236. { ELS_DTAG_DELIVERY, "Delivery Notification Present" }, \
  237. { ELS_DTAG_PEER_CONGEST, "Peer Congestion Notification" }, \
  238. { ELS_DTAG_CONGESTION, "Congestion Notification" }, \
  239. { ELS_DTAG_FPIN_REGISTER, "FPIN Registration" }, \
  240. }
  241. /*
  242. * Generic Link Service TLV Descriptor format
  243. *
  244. * This structure, as it defines no payload, will also be referred to
  245. * as the "tlv header" - which contains the tag and len fields.
  246. */
  247. struct fc_tlv_desc {
  248. __be32 desc_tag; /* Notification Descriptor Tag */
  249. __be32 desc_len; /* Length of Descriptor (in bytes).
  250. * Size of descriptor excluding
  251. * desc_tag and desc_len fields.
  252. */
  253. __u8 desc_value[]; /* Descriptor Value */
  254. };
  255. /* Descriptor tag and len fields are considered the mandatory header
  256. * for a descriptor
  257. */
  258. #define FC_TLV_DESC_HDR_SZ sizeof(struct fc_tlv_desc)
  259. /*
  260. * Macro, used when initializing payloads, to return the descriptor length.
  261. * Length is size of descriptor minus the tag and len fields.
  262. */
  263. #define FC_TLV_DESC_LENGTH_FROM_SZ(desc) \
  264. (sizeof(desc) - FC_TLV_DESC_HDR_SZ)
  265. /* Macro, used on received payloads, to return the descriptor length */
  266. #define FC_TLV_DESC_SZ_FROM_LENGTH(tlv) \
  267. (__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ)
  268. /*
  269. * This helper is used to walk descriptors in a descriptor list.
  270. * Given the address of the current descriptor, which minimally contains a
  271. * tag and len field, calculate the address of the next descriptor based
  272. * on the len field.
  273. */
  274. static __inline__ void *fc_tlv_next_desc(void *desc)
  275. {
  276. struct fc_tlv_desc *tlv = desc;
  277. return (desc + FC_TLV_DESC_SZ_FROM_LENGTH(tlv));
  278. }
  279. /*
  280. * Link Service Request Information Descriptor
  281. */
  282. struct fc_els_lsri_desc {
  283. __be32 desc_tag; /* descriptor tag (0x0000 0001) */
  284. __be32 desc_len; /* Length of Descriptor (in bytes) (4).
  285. * Size of descriptor excluding
  286. * desc_tag and desc_len fields.
  287. */
  288. struct {
  289. __u8 cmd; /* ELS cmd byte */
  290. __u8 bytes[3]; /* bytes 1..3 */
  291. } rqst_w0; /* Request word 0 */
  292. };
  293. /*
  294. * Common service parameters (N ports).
  295. */
  296. struct fc_els_csp {
  297. __u8 sp_hi_ver; /* highest version supported (obs.) */
  298. __u8 sp_lo_ver; /* highest version supported (obs.) */
  299. __be16 sp_bb_cred; /* buffer-to-buffer credits */
  300. __be16 sp_features; /* common feature flags */
  301. __be16 sp_bb_data; /* b-b state number and data field sz */
  302. union {
  303. struct {
  304. __be16 _sp_tot_seq; /* total concurrent sequences */
  305. __be16 _sp_rel_off; /* rel. offset by info cat */
  306. } sp_plogi;
  307. struct {
  308. __be32 _sp_r_a_tov; /* resource alloc. timeout msec */
  309. } sp_flogi_acc;
  310. } sp_u;
  311. __be32 sp_e_d_tov; /* error detect timeout value */
  312. };
  313. #define sp_tot_seq sp_u.sp_plogi._sp_tot_seq
  314. #define sp_rel_off sp_u.sp_plogi._sp_rel_off
  315. #define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov
  316. #define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */
  317. /*
  318. * Minimum and maximum values for max data field size in service parameters.
  319. */
  320. #define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD
  321. #define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD
  322. /*
  323. * sp_features
  324. */
  325. #define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */
  326. #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */
  327. #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */
  328. #define FC_SP_FT_RAND 0x4000 /* random relative offset */
  329. #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */
  330. #define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */
  331. #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */
  332. #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */
  333. #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */
  334. #define FC_SP_FT_MCAST 0x0200 /* multicast */
  335. #define FC_SP_FT_BCAST 0x0100 /* broadcast */
  336. #define FC_SP_FT_HUNT 0x0080 /* hunt group */
  337. #define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */
  338. #define FC_SP_FT_SEC 0x0020 /* reserved for security */
  339. #define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */
  340. #define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */
  341. #define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */
  342. #define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */
  343. #define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */
  344. /*
  345. * Class-specific service parameters.
  346. */
  347. struct fc_els_cssp {
  348. __be16 cp_class; /* class flags */
  349. __be16 cp_init; /* initiator flags */
  350. __be16 cp_recip; /* recipient flags */
  351. __be16 cp_rdfs; /* receive data field size */
  352. __be16 cp_con_seq; /* concurrent sequences */
  353. __be16 cp_ee_cred; /* N-port end-to-end credit */
  354. __u8 cp_resv1; /* reserved */
  355. __u8 cp_open_seq; /* open sequences per exchange */
  356. __u8 _cp_resv2[2]; /* reserved */
  357. };
  358. /*
  359. * cp_class flags.
  360. */
  361. #define FC_CPC_VALID 0x8000 /* class valid */
  362. #define FC_CPC_IMIX 0x4000 /* intermix mode */
  363. #define FC_CPC_SEQ 0x0800 /* sequential delivery */
  364. #define FC_CPC_CAMP 0x0200 /* camp-on */
  365. #define FC_CPC_PRI 0x0080 /* priority */
  366. /*
  367. * cp_init flags.
  368. * (TBD: not all flags defined here).
  369. */
  370. #define FC_CPI_CSYN 0x0010 /* clock synch. capable */
  371. /*
  372. * cp_recip flags.
  373. */
  374. #define FC_CPR_CSYN 0x0008 /* clock synch. capable */
  375. /*
  376. * NFC_ELS_FLOGI: Fabric login request.
  377. * NFC_ELS_PLOGI: Port login request (same format).
  378. */
  379. struct fc_els_flogi {
  380. __u8 fl_cmd; /* command */
  381. __u8 _fl_resvd[3]; /* must be zero */
  382. struct fc_els_csp fl_csp; /* common service parameters */
  383. __be64 fl_wwpn; /* port name */
  384. __be64 fl_wwnn; /* node name */
  385. struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */
  386. __u8 fl_vend[16]; /* vendor version level */
  387. } __attribute__((__packed__));
  388. /*
  389. * Process login service parameter page.
  390. */
  391. struct fc_els_spp {
  392. __u8 spp_type; /* type code or common service params */
  393. __u8 spp_type_ext; /* type code extension */
  394. __u8 spp_flags;
  395. __u8 _spp_resvd;
  396. __be32 spp_orig_pa; /* originator process associator */
  397. __be32 spp_resp_pa; /* responder process associator */
  398. __be32 spp_params; /* service parameters */
  399. };
  400. /*
  401. * spp_flags.
  402. */
  403. #define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */
  404. #define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */
  405. #define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */
  406. #define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */
  407. /*
  408. * SPP response code in spp_flags - lower 4 bits.
  409. */
  410. enum fc_els_spp_resp {
  411. FC_SPP_RESP_ACK = 1, /* request executed */
  412. FC_SPP_RESP_RES = 2, /* unable due to lack of resources */
  413. FC_SPP_RESP_INIT = 3, /* initialization not complete */
  414. FC_SPP_RESP_NO_PA = 4, /* unknown process associator */
  415. FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */
  416. FC_SPP_RESP_COND = 6, /* request completed conditionally */
  417. FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */
  418. FC_SPP_RESP_INVL = 8, /* SPP is invalid */
  419. };
  420. /*
  421. * ELS_RRQ - Reinstate Recovery Qualifier
  422. */
  423. struct fc_els_rrq {
  424. __u8 rrq_cmd; /* command (0x12) */
  425. __u8 rrq_zero[3]; /* specified as zero - part of cmd */
  426. __u8 rrq_resvd; /* reserved */
  427. __u8 rrq_s_id[3]; /* originator FID */
  428. __be16 rrq_ox_id; /* originator exchange ID */
  429. __be16 rrq_rx_id; /* responders exchange ID */
  430. };
  431. /*
  432. * ELS_REC - Read exchange concise.
  433. */
  434. struct fc_els_rec {
  435. __u8 rec_cmd; /* command (0x13) */
  436. __u8 rec_zero[3]; /* specified as zero - part of cmd */
  437. __u8 rec_resvd; /* reserved */
  438. __u8 rec_s_id[3]; /* originator FID */
  439. __be16 rec_ox_id; /* originator exchange ID */
  440. __be16 rec_rx_id; /* responders exchange ID */
  441. };
  442. /*
  443. * ELS_REC LS_ACC payload.
  444. */
  445. struct fc_els_rec_acc {
  446. __u8 reca_cmd; /* accept (0x02) */
  447. __u8 reca_zero[3]; /* specified as zero - part of cmd */
  448. __be16 reca_ox_id; /* originator exchange ID */
  449. __be16 reca_rx_id; /* responders exchange ID */
  450. __u8 reca_resvd1; /* reserved */
  451. __u8 reca_ofid[3]; /* originator FID */
  452. __u8 reca_resvd2; /* reserved */
  453. __u8 reca_rfid[3]; /* responder FID */
  454. __be32 reca_fc4value; /* FC4 value */
  455. __be32 reca_e_stat; /* ESB (exchange status block) status */
  456. };
  457. /*
  458. * ELS_PRLI - Process login request and response.
  459. */
  460. struct fc_els_prli {
  461. __u8 prli_cmd; /* command */
  462. __u8 prli_spp_len; /* length of each serv. parm. page */
  463. __be16 prli_len; /* length of entire payload */
  464. /* service parameter pages follow */
  465. };
  466. /*
  467. * ELS_PRLO - Process logout request and response.
  468. */
  469. struct fc_els_prlo {
  470. __u8 prlo_cmd; /* command */
  471. __u8 prlo_obs; /* obsolete, but shall be set to 10h */
  472. __be16 prlo_len; /* payload length */
  473. };
  474. /*
  475. * ELS_ADISC payload
  476. */
  477. struct fc_els_adisc {
  478. __u8 adisc_cmd;
  479. __u8 adisc_resv[3];
  480. __u8 adisc_resv1;
  481. __u8 adisc_hard_addr[3];
  482. __be64 adisc_wwpn;
  483. __be64 adisc_wwnn;
  484. __u8 adisc_resv2;
  485. __u8 adisc_port_id[3];
  486. } __attribute__((__packed__));
  487. /*
  488. * ELS_LOGO - process or fabric logout.
  489. */
  490. struct fc_els_logo {
  491. __u8 fl_cmd; /* command code */
  492. __u8 fl_zero[3]; /* specified as zero - part of cmd */
  493. __u8 fl_resvd; /* reserved */
  494. __u8 fl_n_port_id[3];/* N port ID */
  495. __be64 fl_n_port_wwn; /* port name */
  496. };
  497. /*
  498. * ELS_RTV - read timeout value.
  499. */
  500. struct fc_els_rtv {
  501. __u8 rtv_cmd; /* command code 0x0e */
  502. __u8 rtv_zero[3]; /* specified as zero - part of cmd */
  503. };
  504. /*
  505. * LS_ACC for ELS_RTV - read timeout value.
  506. */
  507. struct fc_els_rtv_acc {
  508. __u8 rtv_cmd; /* command code 0x02 */
  509. __u8 rtv_zero[3]; /* specified as zero - part of cmd */
  510. __be32 rtv_r_a_tov; /* resource allocation timeout value */
  511. __be32 rtv_e_d_tov; /* error detection timeout value */
  512. __be32 rtv_toq; /* timeout qualifier (see below) */
  513. };
  514. /*
  515. * rtv_toq bits.
  516. */
  517. #define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */
  518. #define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */
  519. /*
  520. * ELS_SCR - state change registration payload.
  521. */
  522. struct fc_els_scr {
  523. __u8 scr_cmd; /* command code */
  524. __u8 scr_resv[6]; /* reserved */
  525. __u8 scr_reg_func; /* registration function (see below) */
  526. };
  527. enum fc_els_scr_func {
  528. ELS_SCRF_FAB = 1, /* fabric-detected registration */
  529. ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */
  530. ELS_SCRF_FULL = 3, /* full registration */
  531. ELS_SCRF_CLEAR = 255, /* remove any current registrations */
  532. };
  533. /*
  534. * ELS_RSCN - registered state change notification payload.
  535. */
  536. struct fc_els_rscn {
  537. __u8 rscn_cmd; /* RSCN opcode (0x61) */
  538. __u8 rscn_page_len; /* page length (4) */
  539. __be16 rscn_plen; /* payload length including this word */
  540. /* followed by 4-byte generic affected Port_ID pages */
  541. };
  542. struct fc_els_rscn_page {
  543. __u8 rscn_page_flags; /* event and address format */
  544. __u8 rscn_fid[3]; /* fabric ID */
  545. };
  546. #define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */
  547. #define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */
  548. #define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */
  549. #define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */
  550. enum fc_els_rscn_ev_qual {
  551. ELS_EV_QUAL_NONE = 0, /* unspecified */
  552. ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */
  553. ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */
  554. ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */
  555. ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */
  556. ELS_EV_QUAL_REM_OBJ = 5, /* removed object */
  557. };
  558. enum fc_els_rscn_addr_fmt {
  559. ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */
  560. ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */
  561. ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */
  562. ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */
  563. };
  564. /*
  565. * ELS_RNID - request Node ID.
  566. */
  567. struct fc_els_rnid {
  568. __u8 rnid_cmd; /* RNID opcode (0x78) */
  569. __u8 rnid_resv[3]; /* reserved */
  570. __u8 rnid_fmt; /* data format */
  571. __u8 rnid_resv2[3]; /* reserved */
  572. };
  573. /*
  574. * Node Identification Data formats (rnid_fmt)
  575. */
  576. enum fc_els_rnid_fmt {
  577. ELS_RNIDF_NONE = 0, /* no specific identification data */
  578. ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */
  579. };
  580. /*
  581. * ELS_RNID response.
  582. */
  583. struct fc_els_rnid_resp {
  584. __u8 rnid_cmd; /* response code (LS_ACC) */
  585. __u8 rnid_resv[3]; /* reserved */
  586. __u8 rnid_fmt; /* data format */
  587. __u8 rnid_cid_len; /* common ID data length */
  588. __u8 rnid_resv2; /* reserved */
  589. __u8 rnid_sid_len; /* specific ID data length */
  590. };
  591. struct fc_els_rnid_cid {
  592. __be64 rnid_wwpn; /* N port name */
  593. __be64 rnid_wwnn; /* node name */
  594. };
  595. struct fc_els_rnid_gen {
  596. __u8 rnid_vend_id[16]; /* vendor-unique ID */
  597. __be32 rnid_atype; /* associated type (see below) */
  598. __be32 rnid_phys_port; /* physical port number */
  599. __be32 rnid_att_nodes; /* number of attached nodes */
  600. __u8 rnid_node_mgmt; /* node management (see below) */
  601. __u8 rnid_ip_ver; /* IP version (see below) */
  602. __be16 rnid_prot_port; /* UDP / TCP port number */
  603. __be32 rnid_ip_addr[4]; /* IP address */
  604. __u8 rnid_resvd[2]; /* reserved */
  605. __be16 rnid_vend_spec; /* vendor-specific field */
  606. };
  607. enum fc_els_rnid_atype {
  608. ELS_RNIDA_UNK = 0x01, /* unknown */
  609. ELS_RNIDA_OTHER = 0x02, /* none of the following */
  610. ELS_RNIDA_HUB = 0x03,
  611. ELS_RNIDA_SWITCH = 0x04,
  612. ELS_RNIDA_GATEWAY = 0x05,
  613. ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */
  614. ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */
  615. ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */
  616. ELS_RNIDA_STORAGE = 0x09,
  617. ELS_RNIDA_HOST = 0x0a,
  618. ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */
  619. ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */
  620. ELS_RNIDA_NAS = 0x11, /* NAS server */
  621. ELS_RNIDA_BRIDGE = 0x12, /* bridge */
  622. ELS_RNIDA_VIRT = 0x13, /* virtualization device */
  623. ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */
  624. ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */
  625. ELS_RNIDA_MF_SW = 1UL << 30, /* switch */
  626. ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */
  627. ELS_RNIDA_MF_ST = 1UL << 28, /* storage */
  628. ELS_RNIDA_MF_HOST = 1UL << 27, /* host */
  629. ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */
  630. ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */
  631. ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */
  632. ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */
  633. ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */
  634. ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */
  635. };
  636. enum fc_els_rnid_mgmt {
  637. ELS_RNIDM_SNMP = 0,
  638. ELS_RNIDM_TELNET = 1,
  639. ELS_RNIDM_HTTP = 2,
  640. ELS_RNIDM_HTTPS = 3,
  641. ELS_RNIDM_XML = 4, /* HTTP + XML */
  642. };
  643. enum fc_els_rnid_ipver {
  644. ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */
  645. ELS_RNIDIP_V4 = 1, /* IPv4 */
  646. ELS_RNIDIP_V6 = 2, /* IPv6 */
  647. };
  648. /*
  649. * ELS RPL - Read Port List.
  650. */
  651. struct fc_els_rpl {
  652. __u8 rpl_cmd; /* command */
  653. __u8 rpl_resv[5]; /* reserved - must be zero */
  654. __be16 rpl_max_size; /* maximum response size or zero */
  655. __u8 rpl_resv1; /* reserved - must be zero */
  656. __u8 rpl_index[3]; /* starting index */
  657. };
  658. /*
  659. * Port number block in RPL response.
  660. */
  661. struct fc_els_pnb {
  662. __be32 pnb_phys_pn; /* physical port number */
  663. __u8 pnb_resv; /* reserved */
  664. __u8 pnb_port_id[3]; /* port ID */
  665. __be64 pnb_wwpn; /* port name */
  666. };
  667. /*
  668. * RPL LS_ACC response.
  669. */
  670. struct fc_els_rpl_resp {
  671. __u8 rpl_cmd; /* ELS_LS_ACC */
  672. __u8 rpl_resv1; /* reserved - must be zero */
  673. __be16 rpl_plen; /* payload length */
  674. __u8 rpl_resv2; /* reserved - must be zero */
  675. __u8 rpl_llen[3]; /* list length */
  676. __u8 rpl_resv3; /* reserved - must be zero */
  677. __u8 rpl_index[3]; /* starting index */
  678. struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */
  679. };
  680. /*
  681. * Link Error Status Block.
  682. */
  683. struct fc_els_lesb {
  684. __be32 lesb_link_fail; /* link failure count */
  685. __be32 lesb_sync_loss; /* loss of synchronization count */
  686. __be32 lesb_sig_loss; /* loss of signal count */
  687. __be32 lesb_prim_err; /* primitive sequence error count */
  688. __be32 lesb_inv_word; /* invalid transmission word count */
  689. __be32 lesb_inv_crc; /* invalid CRC count */
  690. };
  691. /*
  692. * ELS RPS - Read Port Status Block request.
  693. */
  694. struct fc_els_rps {
  695. __u8 rps_cmd; /* command */
  696. __u8 rps_resv[2]; /* reserved - must be zero */
  697. __u8 rps_flag; /* flag - see below */
  698. __be64 rps_port_spec; /* port selection */
  699. };
  700. enum fc_els_rps_flag {
  701. FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */
  702. FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */
  703. FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */
  704. };
  705. /*
  706. * ELS RPS LS_ACC response.
  707. */
  708. struct fc_els_rps_resp {
  709. __u8 rps_cmd; /* command - LS_ACC */
  710. __u8 rps_resv[2]; /* reserved - must be zero */
  711. __u8 rps_flag; /* flag - see below */
  712. __u8 rps_resv2[2]; /* reserved */
  713. __be16 rps_status; /* port status - see below */
  714. struct fc_els_lesb rps_lesb; /* link error status block */
  715. };
  716. enum fc_els_rps_resp_flag {
  717. FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */
  718. };
  719. enum fc_els_rps_resp_status {
  720. FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */
  721. FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */
  722. FC_ELS_RPS_FAB = 1 << 3, /* fabric present */
  723. FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */
  724. FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */
  725. FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */
  726. };
  727. /*
  728. * ELS LIRR - Link Incident Record Registration request.
  729. */
  730. struct fc_els_lirr {
  731. __u8 lirr_cmd; /* command */
  732. __u8 lirr_resv[3]; /* reserved - must be zero */
  733. __u8 lirr_func; /* registration function */
  734. __u8 lirr_fmt; /* FC-4 type of RLIR requested */
  735. __u8 lirr_resv2[2]; /* reserved - must be zero */
  736. };
  737. enum fc_els_lirr_func {
  738. ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */
  739. ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */
  740. ELS_LIRR_CLEAR = 0xff /* clear registration */
  741. };
  742. /*
  743. * ELS SRL - Scan Remote Loop request.
  744. */
  745. struct fc_els_srl {
  746. __u8 srl_cmd; /* command */
  747. __u8 srl_resv[3]; /* reserved - must be zero */
  748. __u8 srl_flag; /* flag - see below */
  749. __u8 srl_flag_param[3]; /* flag parameter */
  750. };
  751. enum fc_els_srl_flag {
  752. FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */
  753. FC_ELS_SRL_ONE = 0x01, /* scan specified loop */
  754. FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */
  755. FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */
  756. };
  757. /*
  758. * ELS RLS - Read Link Error Status Block request.
  759. */
  760. struct fc_els_rls {
  761. __u8 rls_cmd; /* command */
  762. __u8 rls_resv[4]; /* reserved - must be zero */
  763. __u8 rls_port_id[3]; /* port ID */
  764. };
  765. /*
  766. * ELS RLS LS_ACC Response.
  767. */
  768. struct fc_els_rls_resp {
  769. __u8 rls_cmd; /* ELS_LS_ACC */
  770. __u8 rls_resv[3]; /* reserved - must be zero */
  771. struct fc_els_lesb rls_lesb; /* link error status block */
  772. };
  773. /*
  774. * ELS RLIR - Registered Link Incident Report.
  775. * This is followed by the CLIR and the CLID, described below.
  776. */
  777. struct fc_els_rlir {
  778. __u8 rlir_cmd; /* command */
  779. __u8 rlir_resv[3]; /* reserved - must be zero */
  780. __u8 rlir_fmt; /* format (FC4-type if type specific) */
  781. __u8 rlir_clr_len; /* common link incident record length */
  782. __u8 rlir_cld_len; /* common link incident desc. length */
  783. __u8 rlir_slr_len; /* spec. link incident record length */
  784. };
  785. /*
  786. * CLIR - Common Link Incident Record Data. - Sent via RLIR.
  787. */
  788. struct fc_els_clir {
  789. __be64 clir_wwpn; /* incident port name */
  790. __be64 clir_wwnn; /* incident port node name */
  791. __u8 clir_port_type; /* incident port type */
  792. __u8 clir_port_id[3]; /* incident port ID */
  793. __be64 clir_conn_wwpn; /* connected port name */
  794. __be64 clir_conn_wwnn; /* connected node name */
  795. __be64 clir_fab_name; /* fabric name */
  796. __be32 clir_phys_port; /* physical port number */
  797. __be32 clir_trans_id; /* transaction ID */
  798. __u8 clir_resv[3]; /* reserved */
  799. __u8 clir_ts_fmt; /* time stamp format */
  800. __be64 clir_timestamp; /* time stamp */
  801. };
  802. /*
  803. * CLIR clir_ts_fmt - time stamp format values.
  804. */
  805. enum fc_els_clir_ts_fmt {
  806. ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */
  807. ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */
  808. ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */
  809. };
  810. /*
  811. * Common Link Incident Descriptor - sent via RLIR.
  812. */
  813. struct fc_els_clid {
  814. __u8 clid_iq; /* incident qualifier flags */
  815. __u8 clid_ic; /* incident code */
  816. __be16 clid_epai; /* domain/area of ISL */
  817. };
  818. /*
  819. * CLID incident qualifier flags.
  820. */
  821. enum fc_els_clid_iq {
  822. ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */
  823. ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */
  824. ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */
  825. ELS_CLID_SEV_INFO = 0x00, /* report is informational */
  826. ELS_CLID_SEV_INOP = 0x08, /* link not operational */
  827. ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */
  828. ELS_CLID_LASER = 0x02, /* subassembly is a laser */
  829. ELS_CLID_FRU = 0x01, /* format can identify a FRU */
  830. };
  831. /*
  832. * CLID incident code.
  833. */
  834. enum fc_els_clid_ic {
  835. ELS_CLID_IC_IMPL = 1, /* implicit incident */
  836. ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */
  837. ELS_CLID_IC_LOS = 3, /* loss of synch or signal */
  838. ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */
  839. ELS_CLID_IC_PST = 5, /* primitive sequence timeout */
  840. ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */
  841. ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */
  842. ELS_CLID_IC_LIP = 8, /* receiving LIP */
  843. };
  844. /*
  845. * Link Integrity event types
  846. */
  847. enum fc_fpin_li_event_types {
  848. FPIN_LI_UNKNOWN = 0x0,
  849. FPIN_LI_LINK_FAILURE = 0x1,
  850. FPIN_LI_LOSS_OF_SYNC = 0x2,
  851. FPIN_LI_LOSS_OF_SIG = 0x3,
  852. FPIN_LI_PRIM_SEQ_ERR = 0x4,
  853. FPIN_LI_INVALID_TX_WD = 0x5,
  854. FPIN_LI_INVALID_CRC = 0x6,
  855. FPIN_LI_DEVICE_SPEC = 0xF,
  856. };
  857. /*
  858. * Initializer useful for decoding table.
  859. * Please keep this in sync with the above definitions.
  860. */
  861. #define FC_FPIN_LI_EVT_TYPES_INIT { \
  862. { FPIN_LI_UNKNOWN, "Unknown" }, \
  863. { FPIN_LI_LINK_FAILURE, "Link Failure" }, \
  864. { FPIN_LI_LOSS_OF_SYNC, "Loss of Synchronization" }, \
  865. { FPIN_LI_LOSS_OF_SIG, "Loss of Signal" }, \
  866. { FPIN_LI_PRIM_SEQ_ERR, "Primitive Sequence Protocol Error" }, \
  867. { FPIN_LI_INVALID_TX_WD, "Invalid Transmission Word" }, \
  868. { FPIN_LI_INVALID_CRC, "Invalid CRC" }, \
  869. { FPIN_LI_DEVICE_SPEC, "Device Specific" }, \
  870. }
  871. /*
  872. * Delivery event types
  873. */
  874. enum fc_fpin_deli_event_types {
  875. FPIN_DELI_UNKNOWN = 0x0,
  876. FPIN_DELI_TIMEOUT = 0x1,
  877. FPIN_DELI_UNABLE_TO_ROUTE = 0x2,
  878. FPIN_DELI_DEVICE_SPEC = 0xF,
  879. };
  880. /*
  881. * Initializer useful for decoding table.
  882. * Please keep this in sync with the above definitions.
  883. */
  884. #define FC_FPIN_DELI_EVT_TYPES_INIT { \
  885. { FPIN_DELI_UNKNOWN, "Unknown" }, \
  886. { FPIN_DELI_TIMEOUT, "Timeout" }, \
  887. { FPIN_DELI_UNABLE_TO_ROUTE, "Unable to Route" }, \
  888. { FPIN_DELI_DEVICE_SPEC, "Device Specific" }, \
  889. }
  890. /*
  891. * Congestion event types
  892. */
  893. enum fc_fpin_congn_event_types {
  894. FPIN_CONGN_CLEAR = 0x0,
  895. FPIN_CONGN_LOST_CREDIT = 0x1,
  896. FPIN_CONGN_CREDIT_STALL = 0x2,
  897. FPIN_CONGN_OVERSUBSCRIPTION = 0x3,
  898. FPIN_CONGN_DEVICE_SPEC = 0xF,
  899. };
  900. /*
  901. * Initializer useful for decoding table.
  902. * Please keep this in sync with the above definitions.
  903. */
  904. #define FC_FPIN_CONGN_EVT_TYPES_INIT { \
  905. { FPIN_CONGN_CLEAR, "Clear" }, \
  906. { FPIN_CONGN_LOST_CREDIT, "Lost Credit" }, \
  907. { FPIN_CONGN_CREDIT_STALL, "Credit Stall" }, \
  908. { FPIN_CONGN_OVERSUBSCRIPTION, "Oversubscription" }, \
  909. { FPIN_CONGN_DEVICE_SPEC, "Device Specific" }, \
  910. }
  911. enum fc_fpin_congn_severity_types {
  912. FPIN_CONGN_SEVERITY_WARNING = 0xF1,
  913. FPIN_CONGN_SEVERITY_ERROR = 0xF7,
  914. };
  915. /*
  916. * Link Integrity Notification Descriptor
  917. */
  918. struct fc_fn_li_desc {
  919. __be32 desc_tag; /* Descriptor Tag (0x00020001) */
  920. __be32 desc_len; /* Length of Descriptor (in bytes).
  921. * Size of descriptor excluding
  922. * desc_tag and desc_len fields.
  923. */
  924. __be64 detecting_wwpn; /* Port Name that detected event */
  925. __be64 attached_wwpn; /* Port Name of device attached to
  926. * detecting Port Name
  927. */
  928. __be16 event_type; /* see enum fc_fpin_li_event_types */
  929. __be16 event_modifier; /* Implementation specific value
  930. * describing the event type
  931. */
  932. __be32 event_threshold;/* duration in ms of the link
  933. * integrity detection cycle
  934. */
  935. __be32 event_count; /* minimum number of event
  936. * occurrences during the event
  937. * threshold to caause the LI event
  938. */
  939. __be32 pname_count; /* number of portname_list elements */
  940. __be64 pname_list[]; /* list of N_Port_Names accessible
  941. * through the attached port
  942. */
  943. };
  944. /*
  945. * Delivery Notification Descriptor
  946. */
  947. struct fc_fn_deli_desc {
  948. __be32 desc_tag; /* Descriptor Tag (0x00020002) */
  949. __be32 desc_len; /* Length of Descriptor (in bytes).
  950. * Size of descriptor excluding
  951. * desc_tag and desc_len fields.
  952. */
  953. __be64 detecting_wwpn; /* Port Name that detected event */
  954. __be64 attached_wwpn; /* Port Name of device attached to
  955. * detecting Port Name
  956. */
  957. __be32 deli_reason_code;/* see enum fc_fpin_deli_event_types */
  958. };
  959. /*
  960. * Peer Congestion Notification Descriptor
  961. */
  962. struct fc_fn_peer_congn_desc {
  963. __be32 desc_tag; /* Descriptor Tag (0x00020003) */
  964. __be32 desc_len; /* Length of Descriptor (in bytes).
  965. * Size of descriptor excluding
  966. * desc_tag and desc_len fields.
  967. */
  968. __be64 detecting_wwpn; /* Port Name that detected event */
  969. __be64 attached_wwpn; /* Port Name of device attached to
  970. * detecting Port Name
  971. */
  972. __be16 event_type; /* see enum fc_fpin_congn_event_types */
  973. __be16 event_modifier; /* Implementation specific value
  974. * describing the event type
  975. */
  976. __be32 event_period; /* duration (ms) of the detected
  977. * congestion event
  978. */
  979. __be32 pname_count; /* number of portname_list elements */
  980. __be64 pname_list[]; /* list of N_Port_Names accessible
  981. * through the attached port
  982. */
  983. };
  984. /*
  985. * Congestion Notification Descriptor
  986. */
  987. struct fc_fn_congn_desc {
  988. __be32 desc_tag; /* Descriptor Tag (0x00020004) */
  989. __be32 desc_len; /* Length of Descriptor (in bytes).
  990. * Size of descriptor excluding
  991. * desc_tag and desc_len fields.
  992. */
  993. __be16 event_type; /* see enum fc_fpin_congn_event_types */
  994. __be16 event_modifier; /* Implementation specific value
  995. * describing the event type
  996. */
  997. __be32 event_period; /* duration (ms) of the detected
  998. * congestion event
  999. */
  1000. __u8 severity; /* command */
  1001. __u8 resv[3]; /* reserved - must be zero */
  1002. };
  1003. /*
  1004. * ELS_FPIN - Fabric Performance Impact Notification
  1005. */
  1006. struct fc_els_fpin {
  1007. __u8 fpin_cmd; /* command (0x16) */
  1008. __u8 fpin_zero[3]; /* specified as zero - part of cmd */
  1009. __be32 desc_len; /* Length of Descriptor List (in bytes).
  1010. * Size of ELS excluding fpin_cmd,
  1011. * fpin_zero and desc_len fields.
  1012. */
  1013. struct fc_tlv_desc fpin_desc[]; /* Descriptor list */
  1014. };
  1015. /* Diagnostic Function Descriptor - FPIN Registration */
  1016. struct fc_df_desc_fpin_reg {
  1017. __be32 desc_tag; /* FPIN Registration (0x00030001) */
  1018. __be32 desc_len; /* Length of Descriptor (in bytes).
  1019. * Size of descriptor excluding
  1020. * desc_tag and desc_len fields.
  1021. */
  1022. __be32 count; /* Number of desc_tags elements */
  1023. __be32 desc_tags[]; /* Array of Descriptor Tags.
  1024. * Each tag indicates a function
  1025. * supported by the N_Port (request)
  1026. * or by the N_Port and Fabric
  1027. * Controller (reply; may be a subset
  1028. * of the request).
  1029. * See ELS_FN_DTAG_xxx for tag values.
  1030. */
  1031. };
  1032. /*
  1033. * ELS_RDF - Register Diagnostic Functions
  1034. */
  1035. struct fc_els_rdf {
  1036. __u8 fpin_cmd; /* command (0x19) */
  1037. __u8 fpin_zero[3]; /* specified as zero - part of cmd */
  1038. __be32 desc_len; /* Length of Descriptor List (in bytes).
  1039. * Size of ELS excluding fpin_cmd,
  1040. * fpin_zero and desc_len fields.
  1041. */
  1042. struct fc_tlv_desc desc[]; /* Descriptor list */
  1043. };
  1044. /*
  1045. * ELS RDF LS_ACC Response.
  1046. */
  1047. struct fc_els_rdf_resp {
  1048. struct fc_els_ls_acc acc_hdr;
  1049. __be32 desc_list_len; /* Length of response (in
  1050. * bytes). Excludes acc_hdr
  1051. * and desc_list_len fields.
  1052. */
  1053. struct fc_els_lsri_desc lsri;
  1054. struct fc_tlv_desc desc[]; /* Supported Descriptor list */
  1055. };
  1056. /*
  1057. * Diagnostic Capability Descriptors for EDC ELS
  1058. */
  1059. /*
  1060. * Diagnostic: Link Fault Capability Descriptor
  1061. */
  1062. struct fc_diag_lnkflt_desc {
  1063. __be32 desc_tag; /* Descriptor Tag (0x0001000D) */
  1064. __be32 desc_len; /* Length of Descriptor (in bytes).
  1065. * Size of descriptor excluding
  1066. * desc_tag and desc_len fields.
  1067. * 12 bytes
  1068. */
  1069. __be32 degrade_activate_threshold;
  1070. __be32 degrade_deactivate_threshold;
  1071. __be32 fec_degrade_interval;
  1072. };
  1073. enum fc_edc_cg_signal_cap_types {
  1074. /* Note: Capability: bits 31:4 Rsvd; bits 3:0 are capabilities */
  1075. EDC_CG_SIG_NOTSUPPORTED = 0x00, /* neither supported */
  1076. EDC_CG_SIG_WARN_ONLY = 0x01,
  1077. EDC_CG_SIG_WARN_ALARM = 0x02, /* both supported */
  1078. };
  1079. /*
  1080. * Initializer useful for decoding table.
  1081. * Please keep this in sync with the above definitions.
  1082. */
  1083. #define FC_EDC_CG_SIGNAL_CAP_TYPES_INIT { \
  1084. { EDC_CG_SIG_NOTSUPPORTED, "Signaling Not Supported" }, \
  1085. { EDC_CG_SIG_WARN_ONLY, "Warning Signal" }, \
  1086. { EDC_CG_SIG_WARN_ALARM, "Warning and Alarm Signals" }, \
  1087. }
  1088. enum fc_diag_cg_sig_freq_types {
  1089. EDC_CG_SIGFREQ_CNT_MIN = 1, /* Min Frequency Count */
  1090. EDC_CG_SIGFREQ_CNT_MAX = 999, /* Max Frequency Count */
  1091. EDC_CG_SIGFREQ_SEC = 0x1, /* Units: seconds */
  1092. EDC_CG_SIGFREQ_MSEC = 0x2, /* Units: milliseconds */
  1093. };
  1094. struct fc_diag_cg_sig_freq {
  1095. __be16 count; /* Time between signals
  1096. * note: upper 6 bits rsvd
  1097. */
  1098. __be16 units; /* Time unit for count
  1099. * note: upper 12 bits rsvd
  1100. */
  1101. };
  1102. /*
  1103. * Diagnostic: Congestion Signaling Capability Descriptor
  1104. */
  1105. struct fc_diag_cg_sig_desc {
  1106. __be32 desc_tag; /* Descriptor Tag (0x0001000F) */
  1107. __be32 desc_len; /* Length of Descriptor (in bytes).
  1108. * Size of descriptor excluding
  1109. * desc_tag and desc_len fields.
  1110. * 16 bytes
  1111. */
  1112. __be32 xmt_signal_capability;
  1113. struct fc_diag_cg_sig_freq xmt_signal_frequency;
  1114. __be32 rcv_signal_capability;
  1115. struct fc_diag_cg_sig_freq rcv_signal_frequency;
  1116. };
  1117. /*
  1118. * ELS_EDC - Exchange Diagnostic Capabilities
  1119. */
  1120. struct fc_els_edc {
  1121. __u8 edc_cmd; /* command (0x17) */
  1122. __u8 edc_zero[3]; /* specified as zero - part of cmd */
  1123. __be32 desc_len; /* Length of Descriptor List (in bytes).
  1124. * Size of ELS excluding edc_cmd,
  1125. * edc_zero and desc_len fields.
  1126. */
  1127. struct fc_tlv_desc desc[];
  1128. /* Diagnostic Descriptor list */
  1129. };
  1130. /*
  1131. * ELS EDC LS_ACC Response.
  1132. */
  1133. struct fc_els_edc_resp {
  1134. struct fc_els_ls_acc acc_hdr;
  1135. __be32 desc_list_len; /* Length of response (in
  1136. * bytes). Excludes acc_hdr
  1137. * and desc_list_len fields.
  1138. */
  1139. struct fc_els_lsri_desc lsri;
  1140. struct fc_tlv_desc desc[];
  1141. /* Supported Diagnostic Descriptor list */
  1142. };
  1143. #endif /* _FC_ELS_H_ */