fc_els.h 39 KB

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