fc_els.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Copyright(c) 2007 Intel Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  17. *
  18. * Maintained at www.Open-FCoE.org
  19. */
  20. #ifndef _FC_ELS_H_
  21. #define _FC_ELS_H_
  22. #include <linux/types.h>
  23. /*
  24. * Fibre Channel Switch - Enhanced Link Services definitions.
  25. * From T11 FC-LS Rev 1.2 June 7, 2005.
  26. */
  27. /*
  28. * ELS Command codes - byte 0 of the frame payload
  29. */
  30. enum fc_els_cmd {
  31. ELS_LS_RJT = 0x01, /* ESL reject */
  32. ELS_LS_ACC = 0x02, /* ESL Accept */
  33. ELS_PLOGI = 0x03, /* N_Port login */
  34. ELS_FLOGI = 0x04, /* F_Port login */
  35. ELS_LOGO = 0x05, /* Logout */
  36. ELS_ABTX = 0x06, /* Abort exchange - obsolete */
  37. ELS_RCS = 0x07, /* read connection status */
  38. ELS_RES = 0x08, /* read exchange status block */
  39. ELS_RSS = 0x09, /* read sequence status block */
  40. ELS_RSI = 0x0a, /* read sequence initiative */
  41. ELS_ESTS = 0x0b, /* establish streaming */
  42. ELS_ESTC = 0x0c, /* estimate credit */
  43. ELS_ADVC = 0x0d, /* advise credit */
  44. ELS_RTV = 0x0e, /* read timeout value */
  45. ELS_RLS = 0x0f, /* read link error status block */
  46. ELS_ECHO = 0x10, /* echo */
  47. ELS_TEST = 0x11, /* test */
  48. ELS_RRQ = 0x12, /* reinstate recovery qualifier */
  49. ELS_REC = 0x13, /* read exchange concise */
  50. ELS_SRR = 0x14, /* sequence retransmission request */
  51. ELS_PRLI = 0x20, /* process login */
  52. ELS_PRLO = 0x21, /* process logout */
  53. ELS_SCN = 0x22, /* state change notification */
  54. ELS_TPLS = 0x23, /* test process login state */
  55. ELS_TPRLO = 0x24, /* third party process logout */
  56. ELS_LCLM = 0x25, /* login control list mgmt (obs) */
  57. ELS_GAID = 0x30, /* get alias_ID */
  58. ELS_FACT = 0x31, /* fabric activate alias_id */
  59. ELS_FDACDT = 0x32, /* fabric deactivate alias_id */
  60. ELS_NACT = 0x33, /* N-port activate alias_id */
  61. ELS_NDACT = 0x34, /* N-port deactivate alias_id */
  62. ELS_QOSR = 0x40, /* quality of service request */
  63. ELS_RVCS = 0x41, /* read virtual circuit status */
  64. ELS_PDISC = 0x50, /* discover N_port service params */
  65. ELS_FDISC = 0x51, /* discover F_port service params */
  66. ELS_ADISC = 0x52, /* discover address */
  67. ELS_RNC = 0x53, /* report node cap (obs) */
  68. ELS_FARP_REQ = 0x54, /* FC ARP request */
  69. ELS_FARP_REPL = 0x55, /* FC ARP reply */
  70. ELS_RPS = 0x56, /* read port status block */
  71. ELS_RPL = 0x57, /* read port list */
  72. ELS_RPBC = 0x58, /* read port buffer condition */
  73. ELS_FAN = 0x60, /* fabric address notification */
  74. ELS_RSCN = 0x61, /* registered state change notification */
  75. ELS_SCR = 0x62, /* state change registration */
  76. ELS_RNFT = 0x63, /* report node FC-4 types */
  77. ELS_CSR = 0x68, /* clock synch. request */
  78. ELS_CSU = 0x69, /* clock synch. update */
  79. ELS_LINIT = 0x70, /* loop initialize */
  80. ELS_LSTS = 0x72, /* loop status */
  81. ELS_RNID = 0x78, /* request node ID data */
  82. ELS_RLIR = 0x79, /* registered link incident report */
  83. ELS_LIRR = 0x7a, /* link incident record registration */
  84. ELS_SRL = 0x7b, /* scan remote loop */
  85. ELS_SBRP = 0x7c, /* set bit-error reporting params */
  86. ELS_RPSC = 0x7d, /* report speed capabilities */
  87. ELS_QSA = 0x7e, /* query security attributes */
  88. ELS_EVFP = 0x7f, /* exchange virt. fabrics params */
  89. ELS_LKA = 0x80, /* link keep-alive */
  90. ELS_AUTH_ELS = 0x90, /* authentication ELS */
  91. };
  92. /*
  93. * Initializer useful for decoding table.
  94. * Please keep this in sync with the above definitions.
  95. */
  96. #define FC_ELS_CMDS_INIT { \
  97. [ELS_LS_RJT] = "LS_RJT", \
  98. [ELS_LS_ACC] = "LS_ACC", \
  99. [ELS_PLOGI] = "PLOGI", \
  100. [ELS_FLOGI] = "FLOGI", \
  101. [ELS_LOGO] = "LOGO", \
  102. [ELS_ABTX] = "ABTX", \
  103. [ELS_RCS] = "RCS", \
  104. [ELS_RES] = "RES", \
  105. [ELS_RSS] = "RSS", \
  106. [ELS_RSI] = "RSI", \
  107. [ELS_ESTS] = "ESTS", \
  108. [ELS_ESTC] = "ESTC", \
  109. [ELS_ADVC] = "ADVC", \
  110. [ELS_RTV] = "RTV", \
  111. [ELS_RLS] = "RLS", \
  112. [ELS_ECHO] = "ECHO", \
  113. [ELS_TEST] = "TEST", \
  114. [ELS_RRQ] = "RRQ", \
  115. [ELS_REC] = "REC", \
  116. [ELS_SRR] = "SRR", \
  117. [ELS_PRLI] = "PRLI", \
  118. [ELS_PRLO] = "PRLO", \
  119. [ELS_SCN] = "SCN", \
  120. [ELS_TPLS] = "TPLS", \
  121. [ELS_TPRLO] = "TPRLO", \
  122. [ELS_LCLM] = "LCLM", \
  123. [ELS_GAID] = "GAID", \
  124. [ELS_FACT] = "FACT", \
  125. [ELS_FDACDT] = "FDACDT", \
  126. [ELS_NACT] = "NACT", \
  127. [ELS_NDACT] = "NDACT", \
  128. [ELS_QOSR] = "QOSR", \
  129. [ELS_RVCS] = "RVCS", \
  130. [ELS_PDISC] = "PDISC", \
  131. [ELS_FDISC] = "FDISC", \
  132. [ELS_ADISC] = "ADISC", \
  133. [ELS_RNC] = "RNC", \
  134. [ELS_FARP_REQ] = "FARP_REQ", \
  135. [ELS_FARP_REPL] = "FARP_REPL", \
  136. [ELS_RPS] = "RPS", \
  137. [ELS_RPL] = "RPL", \
  138. [ELS_RPBC] = "RPBC", \
  139. [ELS_FAN] = "FAN", \
  140. [ELS_RSCN] = "RSCN", \
  141. [ELS_SCR] = "SCR", \
  142. [ELS_RNFT] = "RNFT", \
  143. [ELS_CSR] = "CSR", \
  144. [ELS_CSU] = "CSU", \
  145. [ELS_LINIT] = "LINIT", \
  146. [ELS_LSTS] = "LSTS", \
  147. [ELS_RNID] = "RNID", \
  148. [ELS_RLIR] = "RLIR", \
  149. [ELS_LIRR] = "LIRR", \
  150. [ELS_SRL] = "SRL", \
  151. [ELS_SBRP] = "SBRP", \
  152. [ELS_RPSC] = "RPSC", \
  153. [ELS_QSA] = "QSA", \
  154. [ELS_EVFP] = "EVFP", \
  155. [ELS_LKA] = "LKA", \
  156. [ELS_AUTH_ELS] = "AUTH_ELS", \
  157. }
  158. /*
  159. * LS_ACC payload.
  160. */
  161. struct fc_els_ls_acc {
  162. __u8 la_cmd; /* command code ELS_LS_ACC */
  163. __u8 la_resv[3]; /* reserved */
  164. };
  165. /*
  166. * ELS reject payload.
  167. */
  168. struct fc_els_ls_rjt {
  169. __u8 er_cmd; /* command code ELS_LS_RJT */
  170. __u8 er_resv[4]; /* reserved must be zero */
  171. __u8 er_reason; /* reason (enum fc_els_rjt_reason below) */
  172. __u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */
  173. __u8 er_vendor; /* vendor specific code */
  174. };
  175. /*
  176. * ELS reject reason codes (er_reason).
  177. */
  178. enum fc_els_rjt_reason {
  179. ELS_RJT_NONE = 0, /* no reject - not to be sent */
  180. ELS_RJT_INVAL = 0x01, /* invalid ELS command code */
  181. ELS_RJT_LOGIC = 0x03, /* logical error */
  182. ELS_RJT_BUSY = 0x05, /* logical busy */
  183. ELS_RJT_PROT = 0x07, /* protocol error */
  184. ELS_RJT_UNAB = 0x09, /* unable to perform command request */
  185. ELS_RJT_UNSUP = 0x0b, /* command not supported */
  186. ELS_RJT_INPROG = 0x0e, /* command already in progress */
  187. ELS_RJT_FIP = 0x20, /* FIP error */
  188. ELS_RJT_VENDOR = 0xff, /* vendor specific error */
  189. };
  190. /*
  191. * reason code explanation (er_explan).
  192. */
  193. enum fc_els_rjt_explan {
  194. ELS_EXPL_NONE = 0x00, /* No additional explanation */
  195. ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */
  196. ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */
  197. ELS_EXPL_AH = 0x11, /* invalid association header */
  198. ELS_EXPL_AH_REQ = 0x13, /* association_header required */
  199. ELS_EXPL_SID = 0x15, /* invalid originator S_ID */
  200. ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */
  201. ELS_EXPL_INPROG = 0x19, /* Request already in progress */
  202. ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */
  203. ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */
  204. ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */
  205. ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */
  206. ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */
  207. ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */
  208. /* TBD - above definitions incomplete */
  209. };
  210. /*
  211. * Common service parameters (N ports).
  212. */
  213. struct fc_els_csp {
  214. __u8 sp_hi_ver; /* highest version supported (obs.) */
  215. __u8 sp_lo_ver; /* highest version supported (obs.) */
  216. __be16 sp_bb_cred; /* buffer-to-buffer credits */
  217. __be16 sp_features; /* common feature flags */
  218. __be16 sp_bb_data; /* b-b state number and data field sz */
  219. union {
  220. struct {
  221. __be16 _sp_tot_seq; /* total concurrent sequences */
  222. __be16 _sp_rel_off; /* rel. offset by info cat */
  223. } sp_plogi;
  224. struct {
  225. __be32 _sp_r_a_tov; /* resource alloc. timeout msec */
  226. } sp_flogi_acc;
  227. } sp_u;
  228. __be32 sp_e_d_tov; /* error detect timeout value */
  229. };
  230. #define sp_tot_seq sp_u.sp_plogi._sp_tot_seq
  231. #define sp_rel_off sp_u.sp_plogi._sp_rel_off
  232. #define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov
  233. #define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */
  234. /*
  235. * Minimum and maximum values for max data field size in service parameters.
  236. */
  237. #define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD
  238. #define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD
  239. /*
  240. * sp_features
  241. */
  242. #define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */
  243. #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */
  244. #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */
  245. #define FC_SP_FT_RAND 0x4000 /* random relative offset */
  246. #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */
  247. #define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */
  248. #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */
  249. #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */
  250. #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */
  251. #define FC_SP_FT_MCAST 0x0200 /* multicast */
  252. #define FC_SP_FT_BCAST 0x0100 /* broadcast */
  253. #define FC_SP_FT_HUNT 0x0080 /* hunt group */
  254. #define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */
  255. #define FC_SP_FT_SEC 0x0020 /* reserved for security */
  256. #define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */
  257. #define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */
  258. #define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */
  259. #define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */
  260. #define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */
  261. /*
  262. * Class-specific service parameters.
  263. */
  264. struct fc_els_cssp {
  265. __be16 cp_class; /* class flags */
  266. __be16 cp_init; /* initiator flags */
  267. __be16 cp_recip; /* recipient flags */
  268. __be16 cp_rdfs; /* receive data field size */
  269. __be16 cp_con_seq; /* concurrent sequences */
  270. __be16 cp_ee_cred; /* N-port end-to-end credit */
  271. __u8 cp_resv1; /* reserved */
  272. __u8 cp_open_seq; /* open sequences per exchange */
  273. __u8 _cp_resv2[2]; /* reserved */
  274. };
  275. /*
  276. * cp_class flags.
  277. */
  278. #define FC_CPC_VALID 0x8000 /* class valid */
  279. #define FC_CPC_IMIX 0x4000 /* intermix mode */
  280. #define FC_CPC_SEQ 0x0800 /* sequential delivery */
  281. #define FC_CPC_CAMP 0x0200 /* camp-on */
  282. #define FC_CPC_PRI 0x0080 /* priority */
  283. /*
  284. * cp_init flags.
  285. * (TBD: not all flags defined here).
  286. */
  287. #define FC_CPI_CSYN 0x0010 /* clock synch. capable */
  288. /*
  289. * cp_recip flags.
  290. */
  291. #define FC_CPR_CSYN 0x0008 /* clock synch. capable */
  292. /*
  293. * NFC_ELS_FLOGI: Fabric login request.
  294. * NFC_ELS_PLOGI: Port login request (same format).
  295. */
  296. struct fc_els_flogi {
  297. __u8 fl_cmd; /* command */
  298. __u8 _fl_resvd[3]; /* must be zero */
  299. struct fc_els_csp fl_csp; /* common service parameters */
  300. __be64 fl_wwpn; /* port name */
  301. __be64 fl_wwnn; /* node name */
  302. struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */
  303. __u8 fl_vend[16]; /* vendor version level */
  304. } __attribute__((__packed__));
  305. /*
  306. * Process login service parameter page.
  307. */
  308. struct fc_els_spp {
  309. __u8 spp_type; /* type code or common service params */
  310. __u8 spp_type_ext; /* type code extension */
  311. __u8 spp_flags;
  312. __u8 _spp_resvd;
  313. __be32 spp_orig_pa; /* originator process associator */
  314. __be32 spp_resp_pa; /* responder process associator */
  315. __be32 spp_params; /* service parameters */
  316. };
  317. /*
  318. * spp_flags.
  319. */
  320. #define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */
  321. #define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */
  322. #define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */
  323. #define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */
  324. /*
  325. * SPP response code in spp_flags - lower 4 bits.
  326. */
  327. enum fc_els_spp_resp {
  328. FC_SPP_RESP_ACK = 1, /* request executed */
  329. FC_SPP_RESP_RES = 2, /* unable due to lack of resources */
  330. FC_SPP_RESP_INIT = 3, /* initialization not complete */
  331. FC_SPP_RESP_NO_PA = 4, /* unknown process associator */
  332. FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */
  333. FC_SPP_RESP_COND = 6, /* request completed conditionally */
  334. FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */
  335. FC_SPP_RESP_INVL = 8, /* SPP is invalid */
  336. };
  337. /*
  338. * ELS_RRQ - Reinstate Recovery Qualifier
  339. */
  340. struct fc_els_rrq {
  341. __u8 rrq_cmd; /* command (0x12) */
  342. __u8 rrq_zero[3]; /* specified as zero - part of cmd */
  343. __u8 rrq_resvd; /* reserved */
  344. __u8 rrq_s_id[3]; /* originator FID */
  345. __be16 rrq_ox_id; /* originator exchange ID */
  346. __be16 rrq_rx_id; /* responders exchange ID */
  347. };
  348. /*
  349. * ELS_REC - Read exchange concise.
  350. */
  351. struct fc_els_rec {
  352. __u8 rec_cmd; /* command (0x13) */
  353. __u8 rec_zero[3]; /* specified as zero - part of cmd */
  354. __u8 rec_resvd; /* reserved */
  355. __u8 rec_s_id[3]; /* originator FID */
  356. __be16 rec_ox_id; /* originator exchange ID */
  357. __be16 rec_rx_id; /* responders exchange ID */
  358. };
  359. /*
  360. * ELS_REC LS_ACC payload.
  361. */
  362. struct fc_els_rec_acc {
  363. __u8 reca_cmd; /* accept (0x02) */
  364. __u8 reca_zero[3]; /* specified as zero - part of cmd */
  365. __be16 reca_ox_id; /* originator exchange ID */
  366. __be16 reca_rx_id; /* responders exchange ID */
  367. __u8 reca_resvd1; /* reserved */
  368. __u8 reca_ofid[3]; /* originator FID */
  369. __u8 reca_resvd2; /* reserved */
  370. __u8 reca_rfid[3]; /* responder FID */
  371. __be32 reca_fc4value; /* FC4 value */
  372. __be32 reca_e_stat; /* ESB (exchange status block) status */
  373. };
  374. /*
  375. * ELS_PRLI - Process login request and response.
  376. */
  377. struct fc_els_prli {
  378. __u8 prli_cmd; /* command */
  379. __u8 prli_spp_len; /* length of each serv. parm. page */
  380. __be16 prli_len; /* length of entire payload */
  381. /* service parameter pages follow */
  382. };
  383. /*
  384. * ELS_PRLO - Process logout request and response.
  385. */
  386. struct fc_els_prlo {
  387. __u8 prlo_cmd; /* command */
  388. __u8 prlo_obs; /* obsolete, but shall be set to 10h */
  389. __be16 prlo_len; /* payload length */
  390. };
  391. /*
  392. * ELS_ADISC payload
  393. */
  394. struct fc_els_adisc {
  395. __u8 adisc_cmd;
  396. __u8 adisc_resv[3];
  397. __u8 adisc_resv1;
  398. __u8 adisc_hard_addr[3];
  399. __be64 adisc_wwpn;
  400. __be64 adisc_wwnn;
  401. __u8 adisc_resv2;
  402. __u8 adisc_port_id[3];
  403. } __attribute__((__packed__));
  404. /*
  405. * ELS_LOGO - process or fabric logout.
  406. */
  407. struct fc_els_logo {
  408. __u8 fl_cmd; /* command code */
  409. __u8 fl_zero[3]; /* specified as zero - part of cmd */
  410. __u8 fl_resvd; /* reserved */
  411. __u8 fl_n_port_id[3];/* N port ID */
  412. __be64 fl_n_port_wwn; /* port name */
  413. };
  414. /*
  415. * ELS_RTV - read timeout value.
  416. */
  417. struct fc_els_rtv {
  418. __u8 rtv_cmd; /* command code 0x0e */
  419. __u8 rtv_zero[3]; /* specified as zero - part of cmd */
  420. };
  421. /*
  422. * LS_ACC for ELS_RTV - read timeout value.
  423. */
  424. struct fc_els_rtv_acc {
  425. __u8 rtv_cmd; /* command code 0x02 */
  426. __u8 rtv_zero[3]; /* specified as zero - part of cmd */
  427. __be32 rtv_r_a_tov; /* resource allocation timeout value */
  428. __be32 rtv_e_d_tov; /* error detection timeout value */
  429. __be32 rtv_toq; /* timeout qualifier (see below) */
  430. };
  431. /*
  432. * rtv_toq bits.
  433. */
  434. #define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */
  435. #define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */
  436. /*
  437. * ELS_SCR - state change registration payload.
  438. */
  439. struct fc_els_scr {
  440. __u8 scr_cmd; /* command code */
  441. __u8 scr_resv[6]; /* reserved */
  442. __u8 scr_reg_func; /* registration function (see below) */
  443. };
  444. enum fc_els_scr_func {
  445. ELS_SCRF_FAB = 1, /* fabric-detected registration */
  446. ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */
  447. ELS_SCRF_FULL = 3, /* full registration */
  448. ELS_SCRF_CLEAR = 255, /* remove any current registrations */
  449. };
  450. /*
  451. * ELS_RSCN - registered state change notification payload.
  452. */
  453. struct fc_els_rscn {
  454. __u8 rscn_cmd; /* RSCN opcode (0x61) */
  455. __u8 rscn_page_len; /* page length (4) */
  456. __be16 rscn_plen; /* payload length including this word */
  457. /* followed by 4-byte generic affected Port_ID pages */
  458. };
  459. struct fc_els_rscn_page {
  460. __u8 rscn_page_flags; /* event and address format */
  461. __u8 rscn_fid[3]; /* fabric ID */
  462. };
  463. #define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */
  464. #define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */
  465. #define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */
  466. #define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */
  467. enum fc_els_rscn_ev_qual {
  468. ELS_EV_QUAL_NONE = 0, /* unspecified */
  469. ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */
  470. ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */
  471. ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */
  472. ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */
  473. ELS_EV_QUAL_REM_OBJ = 5, /* removed object */
  474. };
  475. enum fc_els_rscn_addr_fmt {
  476. ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */
  477. ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */
  478. ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */
  479. ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */
  480. };
  481. /*
  482. * ELS_RNID - request Node ID.
  483. */
  484. struct fc_els_rnid {
  485. __u8 rnid_cmd; /* RNID opcode (0x78) */
  486. __u8 rnid_resv[3]; /* reserved */
  487. __u8 rnid_fmt; /* data format */
  488. __u8 rnid_resv2[3]; /* reserved */
  489. };
  490. /*
  491. * Node Identification Data formats (rnid_fmt)
  492. */
  493. enum fc_els_rnid_fmt {
  494. ELS_RNIDF_NONE = 0, /* no specific identification data */
  495. ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */
  496. };
  497. /*
  498. * ELS_RNID response.
  499. */
  500. struct fc_els_rnid_resp {
  501. __u8 rnid_cmd; /* response code (LS_ACC) */
  502. __u8 rnid_resv[3]; /* reserved */
  503. __u8 rnid_fmt; /* data format */
  504. __u8 rnid_cid_len; /* common ID data length */
  505. __u8 rnid_resv2; /* reserved */
  506. __u8 rnid_sid_len; /* specific ID data length */
  507. };
  508. struct fc_els_rnid_cid {
  509. __be64 rnid_wwpn; /* N port name */
  510. __be64 rnid_wwnn; /* node name */
  511. };
  512. struct fc_els_rnid_gen {
  513. __u8 rnid_vend_id[16]; /* vendor-unique ID */
  514. __be32 rnid_atype; /* associated type (see below) */
  515. __be32 rnid_phys_port; /* physical port number */
  516. __be32 rnid_att_nodes; /* number of attached nodes */
  517. __u8 rnid_node_mgmt; /* node management (see below) */
  518. __u8 rnid_ip_ver; /* IP version (see below) */
  519. __be16 rnid_prot_port; /* UDP / TCP port number */
  520. __be32 rnid_ip_addr[4]; /* IP address */
  521. __u8 rnid_resvd[2]; /* reserved */
  522. __be16 rnid_vend_spec; /* vendor-specific field */
  523. };
  524. enum fc_els_rnid_atype {
  525. ELS_RNIDA_UNK = 0x01, /* unknown */
  526. ELS_RNIDA_OTHER = 0x02, /* none of the following */
  527. ELS_RNIDA_HUB = 0x03,
  528. ELS_RNIDA_SWITCH = 0x04,
  529. ELS_RNIDA_GATEWAY = 0x05,
  530. ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */
  531. ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */
  532. ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */
  533. ELS_RNIDA_STORAGE = 0x09,
  534. ELS_RNIDA_HOST = 0x0a,
  535. ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */
  536. ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */
  537. ELS_RNIDA_NAS = 0x11, /* NAS server */
  538. ELS_RNIDA_BRIDGE = 0x12, /* bridge */
  539. ELS_RNIDA_VIRT = 0x13, /* virtualization device */
  540. ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */
  541. ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */
  542. ELS_RNIDA_MF_SW = 1UL << 30, /* switch */
  543. ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */
  544. ELS_RNIDA_MF_ST = 1UL << 28, /* storage */
  545. ELS_RNIDA_MF_HOST = 1UL << 27, /* host */
  546. ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */
  547. ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */
  548. ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */
  549. ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */
  550. ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */
  551. ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */
  552. };
  553. enum fc_els_rnid_mgmt {
  554. ELS_RNIDM_SNMP = 0,
  555. ELS_RNIDM_TELNET = 1,
  556. ELS_RNIDM_HTTP = 2,
  557. ELS_RNIDM_HTTPS = 3,
  558. ELS_RNIDM_XML = 4, /* HTTP + XML */
  559. };
  560. enum fc_els_rnid_ipver {
  561. ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */
  562. ELS_RNIDIP_V4 = 1, /* IPv4 */
  563. ELS_RNIDIP_V6 = 2, /* IPv6 */
  564. };
  565. /*
  566. * ELS RPL - Read Port List.
  567. */
  568. struct fc_els_rpl {
  569. __u8 rpl_cmd; /* command */
  570. __u8 rpl_resv[5]; /* reserved - must be zero */
  571. __be16 rpl_max_size; /* maximum response size or zero */
  572. __u8 rpl_resv1; /* reserved - must be zero */
  573. __u8 rpl_index[3]; /* starting index */
  574. };
  575. /*
  576. * Port number block in RPL response.
  577. */
  578. struct fc_els_pnb {
  579. __be32 pnb_phys_pn; /* physical port number */
  580. __u8 pnb_resv; /* reserved */
  581. __u8 pnb_port_id[3]; /* port ID */
  582. __be64 pnb_wwpn; /* port name */
  583. };
  584. /*
  585. * RPL LS_ACC response.
  586. */
  587. struct fc_els_rpl_resp {
  588. __u8 rpl_cmd; /* ELS_LS_ACC */
  589. __u8 rpl_resv1; /* reserved - must be zero */
  590. __be16 rpl_plen; /* payload length */
  591. __u8 rpl_resv2; /* reserved - must be zero */
  592. __u8 rpl_llen[3]; /* list length */
  593. __u8 rpl_resv3; /* reserved - must be zero */
  594. __u8 rpl_index[3]; /* starting index */
  595. struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */
  596. };
  597. /*
  598. * Link Error Status Block.
  599. */
  600. struct fc_els_lesb {
  601. __be32 lesb_link_fail; /* link failure count */
  602. __be32 lesb_sync_loss; /* loss of synchronization count */
  603. __be32 lesb_sig_loss; /* loss of signal count */
  604. __be32 lesb_prim_err; /* primitive sequence error count */
  605. __be32 lesb_inv_word; /* invalid transmission word count */
  606. __be32 lesb_inv_crc; /* invalid CRC count */
  607. };
  608. /*
  609. * ELS RPS - Read Port Status Block request.
  610. */
  611. struct fc_els_rps {
  612. __u8 rps_cmd; /* command */
  613. __u8 rps_resv[2]; /* reserved - must be zero */
  614. __u8 rps_flag; /* flag - see below */
  615. __be64 rps_port_spec; /* port selection */
  616. };
  617. enum fc_els_rps_flag {
  618. FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */
  619. FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */
  620. FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */
  621. };
  622. /*
  623. * ELS RPS LS_ACC response.
  624. */
  625. struct fc_els_rps_resp {
  626. __u8 rps_cmd; /* command - LS_ACC */
  627. __u8 rps_resv[2]; /* reserved - must be zero */
  628. __u8 rps_flag; /* flag - see below */
  629. __u8 rps_resv2[2]; /* reserved */
  630. __be16 rps_status; /* port status - see below */
  631. struct fc_els_lesb rps_lesb; /* link error status block */
  632. };
  633. enum fc_els_rps_resp_flag {
  634. FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */
  635. };
  636. enum fc_els_rps_resp_status {
  637. FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */
  638. FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */
  639. FC_ELS_RPS_FAB = 1 << 3, /* fabric present */
  640. FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */
  641. FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */
  642. FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */
  643. };
  644. /*
  645. * ELS LIRR - Link Incident Record Registration request.
  646. */
  647. struct fc_els_lirr {
  648. __u8 lirr_cmd; /* command */
  649. __u8 lirr_resv[3]; /* reserved - must be zero */
  650. __u8 lirr_func; /* registration function */
  651. __u8 lirr_fmt; /* FC-4 type of RLIR requested */
  652. __u8 lirr_resv2[2]; /* reserved - must be zero */
  653. };
  654. enum fc_els_lirr_func {
  655. ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */
  656. ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */
  657. ELS_LIRR_CLEAR = 0xff /* clear registration */
  658. };
  659. /*
  660. * ELS SRL - Scan Remote Loop request.
  661. */
  662. struct fc_els_srl {
  663. __u8 srl_cmd; /* command */
  664. __u8 srl_resv[3]; /* reserved - must be zero */
  665. __u8 srl_flag; /* flag - see below */
  666. __u8 srl_flag_param[3]; /* flag parameter */
  667. };
  668. enum fc_els_srl_flag {
  669. FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */
  670. FC_ELS_SRL_ONE = 0x01, /* scan specified loop */
  671. FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */
  672. FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */
  673. };
  674. /*
  675. * ELS RLS - Read Link Error Status Block request.
  676. */
  677. struct fc_els_rls {
  678. __u8 rls_cmd; /* command */
  679. __u8 rls_resv[4]; /* reserved - must be zero */
  680. __u8 rls_port_id[3]; /* port ID */
  681. };
  682. /*
  683. * ELS RLS LS_ACC Response.
  684. */
  685. struct fc_els_rls_resp {
  686. __u8 rls_cmd; /* ELS_LS_ACC */
  687. __u8 rls_resv[3]; /* reserved - must be zero */
  688. struct fc_els_lesb rls_lesb; /* link error status block */
  689. };
  690. /*
  691. * ELS RLIR - Registered Link Incident Report.
  692. * This is followed by the CLIR and the CLID, described below.
  693. */
  694. struct fc_els_rlir {
  695. __u8 rlir_cmd; /* command */
  696. __u8 rlir_resv[3]; /* reserved - must be zero */
  697. __u8 rlir_fmt; /* format (FC4-type if type specific) */
  698. __u8 rlir_clr_len; /* common link incident record length */
  699. __u8 rlir_cld_len; /* common link incident desc. length */
  700. __u8 rlir_slr_len; /* spec. link incident record length */
  701. };
  702. /*
  703. * CLIR - Common Link Incident Record Data. - Sent via RLIR.
  704. */
  705. struct fc_els_clir {
  706. __be64 clir_wwpn; /* incident port name */
  707. __be64 clir_wwnn; /* incident port node name */
  708. __u8 clir_port_type; /* incident port type */
  709. __u8 clir_port_id[3]; /* incident port ID */
  710. __be64 clir_conn_wwpn; /* connected port name */
  711. __be64 clir_conn_wwnn; /* connected node name */
  712. __be64 clir_fab_name; /* fabric name */
  713. __be32 clir_phys_port; /* physical port number */
  714. __be32 clir_trans_id; /* transaction ID */
  715. __u8 clir_resv[3]; /* reserved */
  716. __u8 clir_ts_fmt; /* time stamp format */
  717. __be64 clir_timestamp; /* time stamp */
  718. };
  719. /*
  720. * CLIR clir_ts_fmt - time stamp format values.
  721. */
  722. enum fc_els_clir_ts_fmt {
  723. ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */
  724. ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */
  725. ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */
  726. };
  727. /*
  728. * Common Link Incident Descriptor - sent via RLIR.
  729. */
  730. struct fc_els_clid {
  731. __u8 clid_iq; /* incident qualifier flags */
  732. __u8 clid_ic; /* incident code */
  733. __be16 clid_epai; /* domain/area of ISL */
  734. };
  735. /*
  736. * CLID incident qualifier flags.
  737. */
  738. enum fc_els_clid_iq {
  739. ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */
  740. ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */
  741. ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */
  742. ELS_CLID_SEV_INFO = 0x00, /* report is informational */
  743. ELS_CLID_SEV_INOP = 0x08, /* link not operational */
  744. ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */
  745. ELS_CLID_LASER = 0x02, /* subassembly is a laser */
  746. ELS_CLID_FRU = 0x01, /* format can identify a FRU */
  747. };
  748. /*
  749. * CLID incident code.
  750. */
  751. enum fc_els_clid_ic {
  752. ELS_CLID_IC_IMPL = 1, /* implicit incident */
  753. ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */
  754. ELS_CLID_IC_LOS = 3, /* loss of synch or signal */
  755. ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */
  756. ELS_CLID_IC_PST = 5, /* primitive sequence timeout */
  757. ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */
  758. ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */
  759. ELS_CLID_IC_LIP = 8, /* receiving LIP */
  760. };
  761. #endif /* _FC_ELS_H_ */