fc_els.h 40 KB

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