fc_els.h 26 KB

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