fc_els.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  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_FIP = 0x20, /* FIP error */
  187. ELS_RJT_VENDOR = 0xff, /* vendor specific error */
  188. };
  189. /*
  190. * reason code explanation (er_explan).
  191. */
  192. enum fc_els_rjt_explan {
  193. ELS_EXPL_NONE = 0x00, /* No additional explanation */
  194. ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */
  195. ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */
  196. ELS_EXPL_AH = 0x11, /* invalid association header */
  197. ELS_EXPL_AH_REQ = 0x13, /* association_header required */
  198. ELS_EXPL_SID = 0x15, /* invalid originator S_ID */
  199. ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */
  200. ELS_EXPL_INPROG = 0x19, /* Request already in progress */
  201. ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */
  202. ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */
  203. ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */
  204. ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */
  205. ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */
  206. ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */
  207. /* TBD - above definitions incomplete */
  208. };
  209. /*
  210. * Common service parameters (N ports).
  211. */
  212. struct fc_els_csp {
  213. __u8 sp_hi_ver; /* highest version supported (obs.) */
  214. __u8 sp_lo_ver; /* highest version supported (obs.) */
  215. __be16 sp_bb_cred; /* buffer-to-buffer credits */
  216. __be16 sp_features; /* common feature flags */
  217. __be16 sp_bb_data; /* b-b state number and data field sz */
  218. union {
  219. struct {
  220. __be16 _sp_tot_seq; /* total concurrent sequences */
  221. __be16 _sp_rel_off; /* rel. offset by info cat */
  222. } sp_plogi;
  223. struct {
  224. __be32 _sp_r_a_tov; /* resource alloc. timeout msec */
  225. } sp_flogi_acc;
  226. } sp_u;
  227. __be32 sp_e_d_tov; /* error detect timeout value */
  228. };
  229. #define sp_tot_seq sp_u.sp_plogi._sp_tot_seq
  230. #define sp_rel_off sp_u.sp_plogi._sp_rel_off
  231. #define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov
  232. #define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */
  233. /*
  234. * Minimum and maximum values for max data field size in service parameters.
  235. */
  236. #define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD
  237. #define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD
  238. /*
  239. * sp_features
  240. */
  241. #define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */
  242. #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */
  243. #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */
  244. #define FC_SP_FT_RAND 0x4000 /* random relative offset */
  245. #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */
  246. #define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */
  247. #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */
  248. #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */
  249. #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */
  250. #define FC_SP_FT_MCAST 0x0200 /* multicast */
  251. #define FC_SP_FT_BCAST 0x0100 /* broadcast */
  252. #define FC_SP_FT_HUNT 0x0080 /* hunt group */
  253. #define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */
  254. #define FC_SP_FT_SEC 0x0020 /* reserved for security */
  255. #define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */
  256. #define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */
  257. #define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */
  258. #define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */
  259. #define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */
  260. /*
  261. * Class-specific service parameters.
  262. */
  263. struct fc_els_cssp {
  264. __be16 cp_class; /* class flags */
  265. __be16 cp_init; /* initiator flags */
  266. __be16 cp_recip; /* recipient flags */
  267. __be16 cp_rdfs; /* receive data field size */
  268. __be16 cp_con_seq; /* concurrent sequences */
  269. __be16 cp_ee_cred; /* N-port end-to-end credit */
  270. __u8 cp_resv1; /* reserved */
  271. __u8 cp_open_seq; /* open sequences per exchange */
  272. __u8 _cp_resv2[2]; /* reserved */
  273. };
  274. /*
  275. * cp_class flags.
  276. */
  277. #define FC_CPC_VALID 0x8000 /* class valid */
  278. #define FC_CPC_IMIX 0x4000 /* intermix mode */
  279. #define FC_CPC_SEQ 0x0800 /* sequential delivery */
  280. #define FC_CPC_CAMP 0x0200 /* camp-on */
  281. #define FC_CPC_PRI 0x0080 /* priority */
  282. /*
  283. * cp_init flags.
  284. * (TBD: not all flags defined here).
  285. */
  286. #define FC_CPI_CSYN 0x0010 /* clock synch. capable */
  287. /*
  288. * cp_recip flags.
  289. */
  290. #define FC_CPR_CSYN 0x0008 /* clock synch. capable */
  291. /*
  292. * NFC_ELS_FLOGI: Fabric login request.
  293. * NFC_ELS_PLOGI: Port login request (same format).
  294. */
  295. struct fc_els_flogi {
  296. __u8 fl_cmd; /* command */
  297. __u8 _fl_resvd[3]; /* must be zero */
  298. struct fc_els_csp fl_csp; /* common service parameters */
  299. __be64 fl_wwpn; /* port name */
  300. __be64 fl_wwnn; /* node name */
  301. struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */
  302. __u8 fl_vend[16]; /* vendor version level */
  303. } __attribute__((__packed__));
  304. /*
  305. * Process login service parameter page.
  306. */
  307. struct fc_els_spp {
  308. __u8 spp_type; /* type code or common service params */
  309. __u8 spp_type_ext; /* type code extension */
  310. __u8 spp_flags;
  311. __u8 _spp_resvd;
  312. __be32 spp_orig_pa; /* originator process associator */
  313. __be32 spp_resp_pa; /* responder process associator */
  314. __be32 spp_params; /* service parameters */
  315. };
  316. /*
  317. * spp_flags.
  318. */
  319. #define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */
  320. #define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */
  321. #define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */
  322. #define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */
  323. /*
  324. * SPP response code in spp_flags - lower 4 bits.
  325. */
  326. enum fc_els_spp_resp {
  327. FC_SPP_RESP_ACK = 1, /* request executed */
  328. FC_SPP_RESP_RES = 2, /* unable due to lack of resources */
  329. FC_SPP_RESP_INIT = 3, /* initialization not complete */
  330. FC_SPP_RESP_NO_PA = 4, /* unknown process associator */
  331. FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */
  332. FC_SPP_RESP_COND = 6, /* request completed conditionally */
  333. FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */
  334. FC_SPP_RESP_INVL = 8, /* SPP is invalid */
  335. };
  336. /*
  337. * ELS_RRQ - Reinstate Recovery Qualifier
  338. */
  339. struct fc_els_rrq {
  340. __u8 rrq_cmd; /* command (0x12) */
  341. __u8 rrq_zero[3]; /* specified as zero - part of cmd */
  342. __u8 rrq_resvd; /* reserved */
  343. __u8 rrq_s_id[3]; /* originator FID */
  344. __be16 rrq_ox_id; /* originator exchange ID */
  345. __be16 rrq_rx_id; /* responders exchange ID */
  346. };
  347. /*
  348. * ELS_REC - Read exchange concise.
  349. */
  350. struct fc_els_rec {
  351. __u8 rec_cmd; /* command (0x13) */
  352. __u8 rec_zero[3]; /* specified as zero - part of cmd */
  353. __u8 rec_resvd; /* reserved */
  354. __u8 rec_s_id[3]; /* originator FID */
  355. __be16 rec_ox_id; /* originator exchange ID */
  356. __be16 rec_rx_id; /* responders exchange ID */
  357. };
  358. /*
  359. * ELS_REC LS_ACC payload.
  360. */
  361. struct fc_els_rec_acc {
  362. __u8 reca_cmd; /* accept (0x02) */
  363. __u8 reca_zero[3]; /* specified as zero - part of cmd */
  364. __be16 reca_ox_id; /* originator exchange ID */
  365. __be16 reca_rx_id; /* responders exchange ID */
  366. __u8 reca_resvd1; /* reserved */
  367. __u8 reca_ofid[3]; /* originator FID */
  368. __u8 reca_resvd2; /* reserved */
  369. __u8 reca_rfid[3]; /* responder FID */
  370. __be32 reca_fc4value; /* FC4 value */
  371. __be32 reca_e_stat; /* ESB (exchange status block) status */
  372. };
  373. /*
  374. * ELS_PRLI - Process login request and response.
  375. */
  376. struct fc_els_prli {
  377. __u8 prli_cmd; /* command */
  378. __u8 prli_spp_len; /* length of each serv. parm. page */
  379. __be16 prli_len; /* length of entire payload */
  380. /* service parameter pages follow */
  381. };
  382. /*
  383. * ELS_PRLO - Process logout request and response.
  384. */
  385. struct fc_els_prlo {
  386. __u8 prlo_cmd; /* command */
  387. __u8 prlo_obs; /* obsolete, but shall be set to 10h */
  388. __be16 prlo_len; /* payload length */
  389. };
  390. /*
  391. * ELS_ADISC payload
  392. */
  393. struct fc_els_adisc {
  394. __u8 adisc_cmd;
  395. __u8 adisc_resv[3];
  396. __u8 adisc_resv1;
  397. __u8 adisc_hard_addr[3];
  398. __be64 adisc_wwpn;
  399. __be64 adisc_wwnn;
  400. __u8 adisc_resv2;
  401. __u8 adisc_port_id[3];
  402. } __attribute__((__packed__));
  403. /*
  404. * ELS_LOGO - process or fabric logout.
  405. */
  406. struct fc_els_logo {
  407. __u8 fl_cmd; /* command code */
  408. __u8 fl_zero[3]; /* specified as zero - part of cmd */
  409. __u8 fl_resvd; /* reserved */
  410. __u8 fl_n_port_id[3];/* N port ID */
  411. __be64 fl_n_port_wwn; /* port name */
  412. };
  413. /*
  414. * ELS_RTV - read timeout value.
  415. */
  416. struct fc_els_rtv {
  417. __u8 rtv_cmd; /* command code 0x0e */
  418. __u8 rtv_zero[3]; /* specified as zero - part of cmd */
  419. };
  420. /*
  421. * LS_ACC for ELS_RTV - read timeout value.
  422. */
  423. struct fc_els_rtv_acc {
  424. __u8 rtv_cmd; /* command code 0x02 */
  425. __u8 rtv_zero[3]; /* specified as zero - part of cmd */
  426. __be32 rtv_r_a_tov; /* resource allocation timeout value */
  427. __be32 rtv_e_d_tov; /* error detection timeout value */
  428. __be32 rtv_toq; /* timeout qualifier (see below) */
  429. };
  430. /*
  431. * rtv_toq bits.
  432. */
  433. #define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */
  434. #define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */
  435. /*
  436. * ELS_SCR - state change registration payload.
  437. */
  438. struct fc_els_scr {
  439. __u8 scr_cmd; /* command code */
  440. __u8 scr_resv[6]; /* reserved */
  441. __u8 scr_reg_func; /* registration function (see below) */
  442. };
  443. enum fc_els_scr_func {
  444. ELS_SCRF_FAB = 1, /* fabric-detected registration */
  445. ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */
  446. ELS_SCRF_FULL = 3, /* full registration */
  447. ELS_SCRF_CLEAR = 255, /* remove any current registrations */
  448. };
  449. /*
  450. * ELS_RSCN - registered state change notification payload.
  451. */
  452. struct fc_els_rscn {
  453. __u8 rscn_cmd; /* RSCN opcode (0x61) */
  454. __u8 rscn_page_len; /* page length (4) */
  455. __be16 rscn_plen; /* payload length including this word */
  456. /* followed by 4-byte generic affected Port_ID pages */
  457. };
  458. struct fc_els_rscn_page {
  459. __u8 rscn_page_flags; /* event and address format */
  460. __u8 rscn_fid[3]; /* fabric ID */
  461. };
  462. #define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */
  463. #define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */
  464. #define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */
  465. #define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */
  466. enum fc_els_rscn_ev_qual {
  467. ELS_EV_QUAL_NONE = 0, /* unspecified */
  468. ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */
  469. ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */
  470. ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */
  471. ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */
  472. ELS_EV_QUAL_REM_OBJ = 5, /* removed object */
  473. };
  474. enum fc_els_rscn_addr_fmt {
  475. ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */
  476. ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */
  477. ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */
  478. ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */
  479. };
  480. /*
  481. * ELS_RNID - request Node ID.
  482. */
  483. struct fc_els_rnid {
  484. __u8 rnid_cmd; /* RNID opcode (0x78) */
  485. __u8 rnid_resv[3]; /* reserved */
  486. __u8 rnid_fmt; /* data format */
  487. __u8 rnid_resv2[3]; /* reserved */
  488. };
  489. /*
  490. * Node Identification Data formats (rnid_fmt)
  491. */
  492. enum fc_els_rnid_fmt {
  493. ELS_RNIDF_NONE = 0, /* no specific identification data */
  494. ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */
  495. };
  496. /*
  497. * ELS_RNID response.
  498. */
  499. struct fc_els_rnid_resp {
  500. __u8 rnid_cmd; /* response code (LS_ACC) */
  501. __u8 rnid_resv[3]; /* reserved */
  502. __u8 rnid_fmt; /* data format */
  503. __u8 rnid_cid_len; /* common ID data length */
  504. __u8 rnid_resv2; /* reserved */
  505. __u8 rnid_sid_len; /* specific ID data length */
  506. };
  507. struct fc_els_rnid_cid {
  508. __be64 rnid_wwpn; /* N port name */
  509. __be64 rnid_wwnn; /* node name */
  510. };
  511. struct fc_els_rnid_gen {
  512. __u8 rnid_vend_id[16]; /* vendor-unique ID */
  513. __be32 rnid_atype; /* associated type (see below) */
  514. __be32 rnid_phys_port; /* physical port number */
  515. __be32 rnid_att_nodes; /* number of attached nodes */
  516. __u8 rnid_node_mgmt; /* node management (see below) */
  517. __u8 rnid_ip_ver; /* IP version (see below) */
  518. __be16 rnid_prot_port; /* UDP / TCP port number */
  519. __be32 rnid_ip_addr[4]; /* IP address */
  520. __u8 rnid_resvd[2]; /* reserved */
  521. __be16 rnid_vend_spec; /* vendor-specific field */
  522. };
  523. enum fc_els_rnid_atype {
  524. ELS_RNIDA_UNK = 0x01, /* unknown */
  525. ELS_RNIDA_OTHER = 0x02, /* none of the following */
  526. ELS_RNIDA_HUB = 0x03,
  527. ELS_RNIDA_SWITCH = 0x04,
  528. ELS_RNIDA_GATEWAY = 0x05,
  529. ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */
  530. ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */
  531. ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */
  532. ELS_RNIDA_STORAGE = 0x09,
  533. ELS_RNIDA_HOST = 0x0a,
  534. ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */
  535. ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */
  536. ELS_RNIDA_NAS = 0x11, /* NAS server */
  537. ELS_RNIDA_BRIDGE = 0x12, /* bridge */
  538. ELS_RNIDA_VIRT = 0x13, /* virtualization device */
  539. ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */
  540. ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */
  541. ELS_RNIDA_MF_SW = 1UL << 30, /* switch */
  542. ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */
  543. ELS_RNIDA_MF_ST = 1UL << 28, /* storage */
  544. ELS_RNIDA_MF_HOST = 1UL << 27, /* host */
  545. ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */
  546. ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */
  547. ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */
  548. ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */
  549. ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */
  550. ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */
  551. };
  552. enum fc_els_rnid_mgmt {
  553. ELS_RNIDM_SNMP = 0,
  554. ELS_RNIDM_TELNET = 1,
  555. ELS_RNIDM_HTTP = 2,
  556. ELS_RNIDM_HTTPS = 3,
  557. ELS_RNIDM_XML = 4, /* HTTP + XML */
  558. };
  559. enum fc_els_rnid_ipver {
  560. ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */
  561. ELS_RNIDIP_V4 = 1, /* IPv4 */
  562. ELS_RNIDIP_V6 = 2, /* IPv6 */
  563. };
  564. /*
  565. * ELS RPL - Read Port List.
  566. */
  567. struct fc_els_rpl {
  568. __u8 rpl_cmd; /* command */
  569. __u8 rpl_resv[5]; /* reserved - must be zero */
  570. __be16 rpl_max_size; /* maximum response size or zero */
  571. __u8 rpl_resv1; /* reserved - must be zero */
  572. __u8 rpl_index[3]; /* starting index */
  573. };
  574. /*
  575. * Port number block in RPL response.
  576. */
  577. struct fc_els_pnb {
  578. __be32 pnb_phys_pn; /* physical port number */
  579. __u8 pnb_resv; /* reserved */
  580. __u8 pnb_port_id[3]; /* port ID */
  581. __be64 pnb_wwpn; /* port name */
  582. };
  583. /*
  584. * RPL LS_ACC response.
  585. */
  586. struct fc_els_rpl_resp {
  587. __u8 rpl_cmd; /* ELS_LS_ACC */
  588. __u8 rpl_resv1; /* reserved - must be zero */
  589. __be16 rpl_plen; /* payload length */
  590. __u8 rpl_resv2; /* reserved - must be zero */
  591. __u8 rpl_llen[3]; /* list length */
  592. __u8 rpl_resv3; /* reserved - must be zero */
  593. __u8 rpl_index[3]; /* starting index */
  594. struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */
  595. };
  596. /*
  597. * Link Error Status Block.
  598. */
  599. struct fc_els_lesb {
  600. __be32 lesb_link_fail; /* link failure count */
  601. __be32 lesb_sync_loss; /* loss of synchronization count */
  602. __be32 lesb_sig_loss; /* loss of signal count */
  603. __be32 lesb_prim_err; /* primitive sequence error count */
  604. __be32 lesb_inv_word; /* invalid transmission word count */
  605. __be32 lesb_inv_crc; /* invalid CRC count */
  606. };
  607. /*
  608. * ELS RPS - Read Port Status Block request.
  609. */
  610. struct fc_els_rps {
  611. __u8 rps_cmd; /* command */
  612. __u8 rps_resv[2]; /* reserved - must be zero */
  613. __u8 rps_flag; /* flag - see below */
  614. __be64 rps_port_spec; /* port selection */
  615. };
  616. enum fc_els_rps_flag {
  617. FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */
  618. FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */
  619. FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */
  620. };
  621. /*
  622. * ELS RPS LS_ACC response.
  623. */
  624. struct fc_els_rps_resp {
  625. __u8 rps_cmd; /* command - LS_ACC */
  626. __u8 rps_resv[2]; /* reserved - must be zero */
  627. __u8 rps_flag; /* flag - see below */
  628. __u8 rps_resv2[2]; /* reserved */
  629. __be16 rps_status; /* port status - see below */
  630. struct fc_els_lesb rps_lesb; /* link error status block */
  631. };
  632. enum fc_els_rps_resp_flag {
  633. FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */
  634. };
  635. enum fc_els_rps_resp_status {
  636. FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */
  637. FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */
  638. FC_ELS_RPS_FAB = 1 << 3, /* fabric present */
  639. FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */
  640. FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */
  641. FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */
  642. };
  643. /*
  644. * ELS LIRR - Link Incident Record Registration request.
  645. */
  646. struct fc_els_lirr {
  647. __u8 lirr_cmd; /* command */
  648. __u8 lirr_resv[3]; /* reserved - must be zero */
  649. __u8 lirr_func; /* registration function */
  650. __u8 lirr_fmt; /* FC-4 type of RLIR requested */
  651. __u8 lirr_resv2[2]; /* reserved - must be zero */
  652. };
  653. enum fc_els_lirr_func {
  654. ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */
  655. ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */
  656. ELS_LIRR_CLEAR = 0xff /* clear registration */
  657. };
  658. /*
  659. * ELS SRL - Scan Remote Loop request.
  660. */
  661. struct fc_els_srl {
  662. __u8 srl_cmd; /* command */
  663. __u8 srl_resv[3]; /* reserved - must be zero */
  664. __u8 srl_flag; /* flag - see below */
  665. __u8 srl_flag_param[3]; /* flag parameter */
  666. };
  667. enum fc_els_srl_flag {
  668. FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */
  669. FC_ELS_SRL_ONE = 0x01, /* scan specified loop */
  670. FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */
  671. FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */
  672. };
  673. /*
  674. * ELS RLS - Read Link Error Status Block request.
  675. */
  676. struct fc_els_rls {
  677. __u8 rls_cmd; /* command */
  678. __u8 rls_resv[4]; /* reserved - must be zero */
  679. __u8 rls_port_id[3]; /* port ID */
  680. };
  681. /*
  682. * ELS RLS LS_ACC Response.
  683. */
  684. struct fc_els_rls_resp {
  685. __u8 rls_cmd; /* ELS_LS_ACC */
  686. __u8 rls_resv[3]; /* reserved - must be zero */
  687. struct fc_els_lesb rls_lesb; /* link error status block */
  688. };
  689. /*
  690. * ELS RLIR - Registered Link Incident Report.
  691. * This is followed by the CLIR and the CLID, described below.
  692. */
  693. struct fc_els_rlir {
  694. __u8 rlir_cmd; /* command */
  695. __u8 rlir_resv[3]; /* reserved - must be zero */
  696. __u8 rlir_fmt; /* format (FC4-type if type specific) */
  697. __u8 rlir_clr_len; /* common link incident record length */
  698. __u8 rlir_cld_len; /* common link incident desc. length */
  699. __u8 rlir_slr_len; /* spec. link incident record length */
  700. };
  701. /*
  702. * CLIR - Common Link Incident Record Data. - Sent via RLIR.
  703. */
  704. struct fc_els_clir {
  705. __be64 clir_wwpn; /* incident port name */
  706. __be64 clir_wwnn; /* incident port node name */
  707. __u8 clir_port_type; /* incident port type */
  708. __u8 clir_port_id[3]; /* incident port ID */
  709. __be64 clir_conn_wwpn; /* connected port name */
  710. __be64 clir_conn_wwnn; /* connected node name */
  711. __be64 clir_fab_name; /* fabric name */
  712. __be32 clir_phys_port; /* physical port number */
  713. __be32 clir_trans_id; /* transaction ID */
  714. __u8 clir_resv[3]; /* reserved */
  715. __u8 clir_ts_fmt; /* time stamp format */
  716. __be64 clir_timestamp; /* time stamp */
  717. };
  718. /*
  719. * CLIR clir_ts_fmt - time stamp format values.
  720. */
  721. enum fc_els_clir_ts_fmt {
  722. ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */
  723. ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */
  724. ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */
  725. };
  726. /*
  727. * Common Link Incident Descriptor - sent via RLIR.
  728. */
  729. struct fc_els_clid {
  730. __u8 clid_iq; /* incident qualifier flags */
  731. __u8 clid_ic; /* incident code */
  732. __be16 clid_epai; /* domain/area of ISL */
  733. };
  734. /*
  735. * CLID incident qualifier flags.
  736. */
  737. enum fc_els_clid_iq {
  738. ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */
  739. ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */
  740. ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */
  741. ELS_CLID_SEV_INFO = 0x00, /* report is informational */
  742. ELS_CLID_SEV_INOP = 0x08, /* link not operational */
  743. ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */
  744. ELS_CLID_LASER = 0x02, /* subassembly is a laser */
  745. ELS_CLID_FRU = 0x01, /* format can identify a FRU */
  746. };
  747. /*
  748. * CLID incident code.
  749. */
  750. enum fc_els_clid_ic {
  751. ELS_CLID_IC_IMPL = 1, /* implicit incident */
  752. ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */
  753. ELS_CLID_IC_LOS = 3, /* loss of synch or signal */
  754. ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */
  755. ELS_CLID_IC_PST = 5, /* primitive sequence timeout */
  756. ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */
  757. ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */
  758. ELS_CLID_IC_LIP = 8, /* receiving LIP */
  759. };
  760. #endif /* _FC_ELS_H_ */