bfa_defs_fcs.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. /*
  2. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef __BFA_DEFS_FCS_H__
  18. #define __BFA_DEFS_FCS_H__
  19. #include "bfa_fc.h"
  20. #include "bfa_defs_svc.h"
  21. /*
  22. * VF states
  23. */
  24. enum bfa_vf_state {
  25. BFA_VF_UNINIT = 0, /* fabric is not yet initialized */
  26. BFA_VF_LINK_DOWN = 1, /* link is down */
  27. BFA_VF_FLOGI = 2, /* flogi is in progress */
  28. BFA_VF_AUTH = 3, /* authentication in progress */
  29. BFA_VF_NOFABRIC = 4, /* fabric is not present */
  30. BFA_VF_ONLINE = 5, /* login to fabric is complete */
  31. BFA_VF_EVFP = 6, /* EVFP is in progress */
  32. BFA_VF_ISOLATED = 7, /* port isolated due to vf_id mismatch */
  33. };
  34. /*
  35. * VF statistics
  36. */
  37. struct bfa_vf_stats_s {
  38. u32 flogi_sent; /* Num FLOGIs sent */
  39. u32 flogi_rsp_err; /* FLOGI response errors */
  40. u32 flogi_acc_err; /* FLOGI accept errors */
  41. u32 flogi_accepts; /* FLOGI accepts received */
  42. u32 flogi_rejects; /* FLOGI rejects received */
  43. u32 flogi_unknown_rsp; /* Unknown responses for FLOGI */
  44. u32 flogi_alloc_wait; /* Allocation waits prior to sending FLOGI */
  45. u32 flogi_rcvd; /* FLOGIs received */
  46. u32 flogi_rejected; /* Incoming FLOGIs rejected */
  47. u32 fabric_onlines; /* Internal fabric online notification sent
  48. * to other modules */
  49. u32 fabric_offlines; /* Internal fabric offline notification sent
  50. * to other modules */
  51. u32 resvd; /* padding for 64 bit alignment */
  52. };
  53. /*
  54. * VF attributes returned in queries
  55. */
  56. struct bfa_vf_attr_s {
  57. enum bfa_vf_state state; /* VF state */
  58. u32 rsvd;
  59. wwn_t fabric_name; /* fabric name */
  60. };
  61. #define BFA_FCS_MAX_LPORTS 256
  62. #define BFA_FCS_FABRIC_IPADDR_SZ 16
  63. /*
  64. * symbolic names for base port/virtual port
  65. */
  66. #define BFA_SYMNAME_MAXLEN 128 /* 128 bytes */
  67. struct bfa_lport_symname_s {
  68. char symname[BFA_SYMNAME_MAXLEN];
  69. };
  70. /*
  71. * Roles of FCS port:
  72. * - FCP IM and FCP TM roles cannot be enabled together for a FCS port
  73. * - Create multiple ports if both IM and TM functions required.
  74. * - Atleast one role must be specified.
  75. */
  76. enum bfa_lport_role {
  77. BFA_LPORT_ROLE_FCP_IM = 0x01, /* FCP initiator role */
  78. BFA_LPORT_ROLE_FCP_MAX = BFA_LPORT_ROLE_FCP_IM,
  79. };
  80. /*
  81. * FCS port configuration.
  82. */
  83. struct bfa_lport_cfg_s {
  84. wwn_t pwwn; /* port wwn */
  85. wwn_t nwwn; /* node wwn */
  86. struct bfa_lport_symname_s sym_name; /* vm port symbolic name */
  87. bfa_boolean_t preboot_vp; /* vport created from PBC */
  88. enum bfa_lport_role roles; /* FCS port roles */
  89. u8 tag[16]; /* opaque tag from application */
  90. };
  91. /*
  92. * FCS port states
  93. */
  94. enum bfa_lport_state {
  95. BFA_LPORT_UNINIT = 0, /* PORT is not yet initialized */
  96. BFA_LPORT_FDISC = 1, /* FDISC is in progress */
  97. BFA_LPORT_ONLINE = 2, /* login to fabric is complete */
  98. BFA_LPORT_OFFLINE = 3, /* No login to fabric */
  99. };
  100. /*
  101. * FCS port type.
  102. */
  103. enum bfa_lport_type {
  104. BFA_LPORT_TYPE_PHYSICAL = 0,
  105. BFA_LPORT_TYPE_VIRTUAL,
  106. };
  107. /*
  108. * FCS port offline reason.
  109. */
  110. enum bfa_lport_offline_reason {
  111. BFA_LPORT_OFFLINE_UNKNOWN = 0,
  112. BFA_LPORT_OFFLINE_LINKDOWN,
  113. BFA_LPORT_OFFLINE_FAB_UNSUPPORTED, /* NPIV not supported by the
  114. * fabric */
  115. BFA_LPORT_OFFLINE_FAB_NORESOURCES,
  116. BFA_LPORT_OFFLINE_FAB_LOGOUT,
  117. };
  118. /*
  119. * FCS lport info.
  120. */
  121. struct bfa_lport_info_s {
  122. u8 port_type; /* bfa_lport_type_t : physical or
  123. * virtual */
  124. u8 port_state; /* one of bfa_lport_state values */
  125. u8 offline_reason; /* one of bfa_lport_offline_reason_t
  126. * values */
  127. wwn_t port_wwn;
  128. wwn_t node_wwn;
  129. /*
  130. * following 4 feilds are valid for Physical Ports only
  131. */
  132. u32 max_vports_supp; /* Max supported vports */
  133. u32 num_vports_inuse; /* Num of in use vports */
  134. u32 max_rports_supp; /* Max supported rports */
  135. u32 num_rports_inuse; /* Num of doscovered rports */
  136. };
  137. /*
  138. * FCS port statistics
  139. */
  140. struct bfa_lport_stats_s {
  141. u32 ns_plogi_sent;
  142. u32 ns_plogi_rsp_err;
  143. u32 ns_plogi_acc_err;
  144. u32 ns_plogi_accepts;
  145. u32 ns_rejects; /* NS command rejects */
  146. u32 ns_plogi_unknown_rsp;
  147. u32 ns_plogi_alloc_wait;
  148. u32 ns_retries; /* NS command retries */
  149. u32 ns_timeouts; /* NS command timeouts */
  150. u32 ns_rspnid_sent;
  151. u32 ns_rspnid_accepts;
  152. u32 ns_rspnid_rsp_err;
  153. u32 ns_rspnid_rejects;
  154. u32 ns_rspnid_alloc_wait;
  155. u32 ns_rftid_sent;
  156. u32 ns_rftid_accepts;
  157. u32 ns_rftid_rsp_err;
  158. u32 ns_rftid_rejects;
  159. u32 ns_rftid_alloc_wait;
  160. u32 ns_rffid_sent;
  161. u32 ns_rffid_accepts;
  162. u32 ns_rffid_rsp_err;
  163. u32 ns_rffid_rejects;
  164. u32 ns_rffid_alloc_wait;
  165. u32 ns_gidft_sent;
  166. u32 ns_gidft_accepts;
  167. u32 ns_gidft_rsp_err;
  168. u32 ns_gidft_rejects;
  169. u32 ns_gidft_unknown_rsp;
  170. u32 ns_gidft_alloc_wait;
  171. /*
  172. * Mgmt Server stats
  173. */
  174. u32 ms_retries; /* MS command retries */
  175. u32 ms_timeouts; /* MS command timeouts */
  176. u32 ms_plogi_sent;
  177. u32 ms_plogi_rsp_err;
  178. u32 ms_plogi_acc_err;
  179. u32 ms_plogi_accepts;
  180. u32 ms_rejects; /* MS command rejects */
  181. u32 ms_plogi_unknown_rsp;
  182. u32 ms_plogi_alloc_wait;
  183. u32 num_rscn; /* Num of RSCN received */
  184. u32 num_portid_rscn;/* Num portid format RSCN
  185. * received */
  186. u32 uf_recvs; /* Unsolicited recv frames */
  187. u32 uf_recv_drops; /* Dropped received frames */
  188. u32 plogi_rcvd; /* Received plogi */
  189. u32 prli_rcvd; /* Received prli */
  190. u32 adisc_rcvd; /* Received adisc */
  191. u32 prlo_rcvd; /* Received prlo */
  192. u32 logo_rcvd; /* Received logo */
  193. u32 rpsc_rcvd; /* Received rpsc */
  194. u32 un_handled_els_rcvd; /* Received unhandled ELS */
  195. u32 rport_plogi_timeouts; /* Rport plogi retry timeout count */
  196. u32 rport_del_max_plogi_retry; /* Deleted rport
  197. * (max retry of plogi) */
  198. };
  199. /*
  200. * BFA port attribute returned in queries
  201. */
  202. struct bfa_lport_attr_s {
  203. enum bfa_lport_state state; /* port state */
  204. u32 pid; /* port ID */
  205. struct bfa_lport_cfg_s port_cfg; /* port configuration */
  206. enum bfa_port_type port_type; /* current topology */
  207. u32 loopback; /* cable is externally looped back */
  208. wwn_t fabric_name; /* attached switch's nwwn */
  209. u8 fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ]; /* attached
  210. * fabric's ip addr */
  211. mac_t fpma_mac; /* Lport's FPMA Mac address */
  212. u16 authfail; /* auth failed state */
  213. };
  214. /*
  215. * VPORT states
  216. */
  217. enum bfa_vport_state {
  218. BFA_FCS_VPORT_UNINIT = 0,
  219. BFA_FCS_VPORT_CREATED = 1,
  220. BFA_FCS_VPORT_OFFLINE = 1,
  221. BFA_FCS_VPORT_FDISC_SEND = 2,
  222. BFA_FCS_VPORT_FDISC = 3,
  223. BFA_FCS_VPORT_FDISC_RETRY = 4,
  224. BFA_FCS_VPORT_ONLINE = 5,
  225. BFA_FCS_VPORT_DELETING = 6,
  226. BFA_FCS_VPORT_CLEANUP = 6,
  227. BFA_FCS_VPORT_LOGO_SEND = 7,
  228. BFA_FCS_VPORT_LOGO = 8,
  229. BFA_FCS_VPORT_ERROR = 9,
  230. BFA_FCS_VPORT_MAX_STATE,
  231. };
  232. /*
  233. * vport statistics
  234. */
  235. struct bfa_vport_stats_s {
  236. struct bfa_lport_stats_s port_stats; /* base class (port) stats */
  237. /*
  238. * TODO - remove
  239. */
  240. u32 fdisc_sent; /* num fdisc sent */
  241. u32 fdisc_accepts; /* fdisc accepts */
  242. u32 fdisc_retries; /* fdisc retries */
  243. u32 fdisc_timeouts; /* fdisc timeouts */
  244. u32 fdisc_rsp_err; /* fdisc response error */
  245. u32 fdisc_acc_bad; /* bad fdisc accepts */
  246. u32 fdisc_rejects; /* fdisc rejects */
  247. u32 fdisc_unknown_rsp;
  248. /*
  249. *!< fdisc rsp unknown error
  250. */
  251. u32 fdisc_alloc_wait;/* fdisc req (fcxp)alloc wait */
  252. u32 logo_alloc_wait;/* logo req (fcxp) alloc wait */
  253. u32 logo_sent; /* logo sent */
  254. u32 logo_accepts; /* logo accepts */
  255. u32 logo_rejects; /* logo rejects */
  256. u32 logo_rsp_err; /* logo rsp errors */
  257. u32 logo_unknown_rsp;
  258. /* logo rsp unknown errors */
  259. u32 fab_no_npiv; /* fabric does not support npiv */
  260. u32 fab_offline; /* offline events from fab SM */
  261. u32 fab_online; /* online events from fab SM */
  262. u32 fab_cleanup; /* cleanup request from fab SM */
  263. u32 rsvd;
  264. };
  265. /*
  266. * BFA vport attribute returned in queries
  267. */
  268. struct bfa_vport_attr_s {
  269. struct bfa_lport_attr_s port_attr; /* base class (port) attributes */
  270. enum bfa_vport_state vport_state; /* vport state */
  271. u32 rsvd;
  272. };
  273. /*
  274. * FCS remote port states
  275. */
  276. enum bfa_rport_state {
  277. BFA_RPORT_UNINIT = 0, /* PORT is not yet initialized */
  278. BFA_RPORT_OFFLINE = 1, /* rport is offline */
  279. BFA_RPORT_PLOGI = 2, /* PLOGI to rport is in progress */
  280. BFA_RPORT_ONLINE = 3, /* login to rport is complete */
  281. BFA_RPORT_PLOGI_RETRY = 4, /* retrying login to rport */
  282. BFA_RPORT_NSQUERY = 5, /* nameserver query */
  283. BFA_RPORT_ADISC = 6, /* ADISC authentication */
  284. BFA_RPORT_LOGO = 7, /* logging out with rport */
  285. BFA_RPORT_LOGORCV = 8, /* handling LOGO from rport */
  286. BFA_RPORT_NSDISC = 9, /* re-discover rport */
  287. };
  288. /*
  289. * Rport Scsi Function : Initiator/Target.
  290. */
  291. enum bfa_rport_function {
  292. BFA_RPORT_INITIATOR = 0x01, /* SCSI Initiator */
  293. BFA_RPORT_TARGET = 0x02, /* SCSI Target */
  294. };
  295. /*
  296. * port/node symbolic names for rport
  297. */
  298. #define BFA_RPORT_SYMNAME_MAXLEN 255
  299. struct bfa_rport_symname_s {
  300. char symname[BFA_RPORT_SYMNAME_MAXLEN];
  301. };
  302. /*
  303. * FCS remote port statistics
  304. */
  305. struct bfa_rport_stats_s {
  306. u32 offlines; /* remote port offline count */
  307. u32 onlines; /* remote port online count */
  308. u32 rscns; /* RSCN affecting rport */
  309. u32 plogis; /* plogis sent */
  310. u32 plogi_accs; /* plogi accepts */
  311. u32 plogi_timeouts; /* plogi timeouts */
  312. u32 plogi_rejects; /* rcvd plogi rejects */
  313. u32 plogi_failed; /* local failure */
  314. u32 plogi_rcvd; /* plogis rcvd */
  315. u32 prli_rcvd; /* inbound PRLIs */
  316. u32 adisc_rcvd; /* ADISCs received */
  317. u32 adisc_rejects; /* recvd ADISC rejects */
  318. u32 adisc_sent; /* ADISC requests sent */
  319. u32 adisc_accs; /* ADISC accepted by rport */
  320. u32 adisc_failed; /* ADISC failed (no response) */
  321. u32 adisc_rejected; /* ADISC rejected by us */
  322. u32 logos; /* logos sent */
  323. u32 logo_accs; /* LOGO accepts from rport */
  324. u32 logo_failed; /* LOGO failures */
  325. u32 logo_rejected; /* LOGO rejects from rport */
  326. u32 logo_rcvd; /* LOGO from remote port */
  327. u32 rpsc_rcvd; /* RPSC received */
  328. u32 rpsc_rejects; /* recvd RPSC rejects */
  329. u32 rpsc_sent; /* RPSC requests sent */
  330. u32 rpsc_accs; /* RPSC accepted by rport */
  331. u32 rpsc_failed; /* RPSC failed (no response) */
  332. u32 rpsc_rejected; /* RPSC rejected by us */
  333. u32 rjt_insuff_res; /* LS RJT with insuff resources */
  334. struct bfa_rport_hal_stats_s hal_stats; /* BFA rport stats */
  335. };
  336. /*
  337. * FCS remote port attributes returned in queries
  338. */
  339. struct bfa_rport_attr_s {
  340. wwn_t nwwn; /* node wwn */
  341. wwn_t pwwn; /* port wwn */
  342. enum fc_cos cos_supported; /* supported class of services */
  343. u32 pid; /* port ID */
  344. u32 df_sz; /* Max payload size */
  345. enum bfa_rport_state state; /* Rport State machine state */
  346. enum fc_cos fc_cos; /* FC classes of services */
  347. bfa_boolean_t cisc; /* CISC capable device */
  348. struct bfa_rport_symname_s symname; /* Symbolic Name */
  349. enum bfa_rport_function scsi_function; /* Initiator/Target */
  350. struct bfa_rport_qos_attr_s qos_attr; /* qos attributes */
  351. enum bfa_port_speed curr_speed; /* operating speed got from
  352. * RPSC ELS. UNKNOWN, if RPSC
  353. * is not supported */
  354. bfa_boolean_t trl_enforced; /* TRL enforced ? TRUE/FALSE */
  355. enum bfa_port_speed assigned_speed; /* Speed assigned by the user.
  356. * will be used if RPSC is not
  357. * supported by the rport */
  358. };
  359. struct bfa_rport_remote_link_stats_s {
  360. u32 lfc; /* Link Failure Count */
  361. u32 lsyc; /* Loss of Synchronization Count */
  362. u32 lsic; /* Loss of Signal Count */
  363. u32 pspec; /* Primitive Sequence Protocol Error Count */
  364. u32 itwc; /* Invalid Transmission Word Count */
  365. u32 icc; /* Invalid CRC Count */
  366. };
  367. #define BFA_MAX_IO_INDEX 7
  368. #define BFA_NO_IO_INDEX 9
  369. /*
  370. * FCS itnim states
  371. */
  372. enum bfa_itnim_state {
  373. BFA_ITNIM_OFFLINE = 0, /* offline */
  374. BFA_ITNIM_PRLI_SEND = 1, /* prli send */
  375. BFA_ITNIM_PRLI_SENT = 2, /* prli sent */
  376. BFA_ITNIM_PRLI_RETRY = 3, /* prli retry */
  377. BFA_ITNIM_HCB_ONLINE = 4, /* online callback */
  378. BFA_ITNIM_ONLINE = 5, /* online */
  379. BFA_ITNIM_HCB_OFFLINE = 6, /* offline callback */
  380. BFA_ITNIM_INITIATIOR = 7, /* initiator */
  381. };
  382. /*
  383. * FCS remote port statistics
  384. */
  385. struct bfa_itnim_stats_s {
  386. u32 onlines; /* num rport online */
  387. u32 offlines; /* num rport offline */
  388. u32 prli_sent; /* num prli sent out */
  389. u32 fcxp_alloc_wait;/* num fcxp alloc waits */
  390. u32 prli_rsp_err; /* num prli rsp errors */
  391. u32 prli_rsp_acc; /* num prli rsp accepts */
  392. u32 initiator; /* rport is an initiator */
  393. u32 prli_rsp_parse_err; /* prli rsp parsing errors */
  394. u32 prli_rsp_rjt; /* num prli rsp rejects */
  395. u32 timeout; /* num timeouts detected */
  396. u32 sler; /* num sler notification from BFA */
  397. u32 rsvd; /* padding for 64 bit alignment */
  398. };
  399. /*
  400. * FCS itnim attributes returned in queries
  401. */
  402. struct bfa_itnim_attr_s {
  403. enum bfa_itnim_state state; /* FCS itnim state */
  404. u8 retry; /* data retransmision support */
  405. u8 task_retry_id; /* task retry ident support */
  406. u8 rec_support; /* REC supported */
  407. u8 conf_comp; /* confirmed completion supp */
  408. };
  409. #endif /* __BFA_DEFS_FCS_H__ */