bfa_defs_fcs.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  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. enum bfa_lport_role roles; /* FCS port roles */
  88. u32 rsvd;
  89. bfa_boolean_t preboot_vp; /* vport created from PBC */
  90. u8 tag[16]; /* opaque tag from application */
  91. u8 padding[4];
  92. };
  93. /*
  94. * FCS port states
  95. */
  96. enum bfa_lport_state {
  97. BFA_LPORT_UNINIT = 0, /* PORT is not yet initialized */
  98. BFA_LPORT_FDISC = 1, /* FDISC is in progress */
  99. BFA_LPORT_ONLINE = 2, /* login to fabric is complete */
  100. BFA_LPORT_OFFLINE = 3, /* No login to fabric */
  101. };
  102. /*
  103. * FCS port type.
  104. */
  105. enum bfa_lport_type {
  106. BFA_LPORT_TYPE_PHYSICAL = 0,
  107. BFA_LPORT_TYPE_VIRTUAL,
  108. };
  109. /*
  110. * FCS port offline reason.
  111. */
  112. enum bfa_lport_offline_reason {
  113. BFA_LPORT_OFFLINE_UNKNOWN = 0,
  114. BFA_LPORT_OFFLINE_LINKDOWN,
  115. BFA_LPORT_OFFLINE_FAB_UNSUPPORTED, /* NPIV not supported by the
  116. * fabric */
  117. BFA_LPORT_OFFLINE_FAB_NORESOURCES,
  118. BFA_LPORT_OFFLINE_FAB_LOGOUT,
  119. };
  120. /*
  121. * FCS lport info.
  122. */
  123. struct bfa_lport_info_s {
  124. u8 port_type; /* bfa_lport_type_t : physical or
  125. * virtual */
  126. u8 port_state; /* one of bfa_lport_state values */
  127. u8 offline_reason; /* one of bfa_lport_offline_reason_t
  128. * values */
  129. wwn_t port_wwn;
  130. wwn_t node_wwn;
  131. /*
  132. * following 4 feilds are valid for Physical Ports only
  133. */
  134. u32 max_vports_supp; /* Max supported vports */
  135. u32 num_vports_inuse; /* Num of in use vports */
  136. u32 max_rports_supp; /* Max supported rports */
  137. u32 num_rports_inuse; /* Num of doscovered rports */
  138. };
  139. /*
  140. * FCS port statistics
  141. */
  142. struct bfa_lport_stats_s {
  143. u32 ns_plogi_sent;
  144. u32 ns_plogi_rsp_err;
  145. u32 ns_plogi_acc_err;
  146. u32 ns_plogi_accepts;
  147. u32 ns_rejects; /* NS command rejects */
  148. u32 ns_plogi_unknown_rsp;
  149. u32 ns_plogi_alloc_wait;
  150. u32 ns_retries; /* NS command retries */
  151. u32 ns_timeouts; /* NS command timeouts */
  152. u32 ns_rspnid_sent;
  153. u32 ns_rspnid_accepts;
  154. u32 ns_rspnid_rsp_err;
  155. u32 ns_rspnid_rejects;
  156. u32 ns_rspnid_alloc_wait;
  157. u32 ns_rftid_sent;
  158. u32 ns_rftid_accepts;
  159. u32 ns_rftid_rsp_err;
  160. u32 ns_rftid_rejects;
  161. u32 ns_rftid_alloc_wait;
  162. u32 ns_rffid_sent;
  163. u32 ns_rffid_accepts;
  164. u32 ns_rffid_rsp_err;
  165. u32 ns_rffid_rejects;
  166. u32 ns_rffid_alloc_wait;
  167. u32 ns_gidft_sent;
  168. u32 ns_gidft_accepts;
  169. u32 ns_gidft_rsp_err;
  170. u32 ns_gidft_rejects;
  171. u32 ns_gidft_unknown_rsp;
  172. u32 ns_gidft_alloc_wait;
  173. /*
  174. * Mgmt Server stats
  175. */
  176. u32 ms_retries; /* MS command retries */
  177. u32 ms_timeouts; /* MS command timeouts */
  178. u32 ms_plogi_sent;
  179. u32 ms_plogi_rsp_err;
  180. u32 ms_plogi_acc_err;
  181. u32 ms_plogi_accepts;
  182. u32 ms_rejects; /* MS command rejects */
  183. u32 ms_plogi_unknown_rsp;
  184. u32 ms_plogi_alloc_wait;
  185. u32 num_rscn; /* Num of RSCN received */
  186. u32 num_portid_rscn;/* Num portid format RSCN
  187. * received */
  188. u32 uf_recvs; /* Unsolicited recv frames */
  189. u32 uf_recv_drops; /* Dropped received frames */
  190. u32 plogi_rcvd; /* Received plogi */
  191. u32 prli_rcvd; /* Received prli */
  192. u32 adisc_rcvd; /* Received adisc */
  193. u32 prlo_rcvd; /* Received prlo */
  194. u32 logo_rcvd; /* Received logo */
  195. u32 rpsc_rcvd; /* Received rpsc */
  196. u32 un_handled_els_rcvd; /* Received unhandled ELS */
  197. u32 rport_plogi_timeouts; /* Rport plogi retry timeout count */
  198. u32 rport_del_max_plogi_retry; /* Deleted rport
  199. * (max retry of plogi) */
  200. };
  201. /*
  202. * BFA port attribute returned in queries
  203. */
  204. struct bfa_lport_attr_s {
  205. enum bfa_lport_state state; /* port state */
  206. u32 pid; /* port ID */
  207. struct bfa_lport_cfg_s port_cfg; /* port configuration */
  208. enum bfa_port_type port_type; /* current topology */
  209. u32 loopback; /* cable is externally looped back */
  210. wwn_t fabric_name; /* attached switch's nwwn */
  211. u8 fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ]; /* attached
  212. * fabric's ip addr */
  213. mac_t fpma_mac; /* Lport's FPMA Mac address */
  214. u16 authfail; /* auth failed state */
  215. };
  216. /*
  217. * VPORT states
  218. */
  219. enum bfa_vport_state {
  220. BFA_FCS_VPORT_UNINIT = 0,
  221. BFA_FCS_VPORT_CREATED = 1,
  222. BFA_FCS_VPORT_OFFLINE = 1,
  223. BFA_FCS_VPORT_FDISC_SEND = 2,
  224. BFA_FCS_VPORT_FDISC = 3,
  225. BFA_FCS_VPORT_FDISC_RETRY = 4,
  226. BFA_FCS_VPORT_FDISC_RSP_WAIT = 5,
  227. BFA_FCS_VPORT_ONLINE = 6,
  228. BFA_FCS_VPORT_DELETING = 7,
  229. BFA_FCS_VPORT_CLEANUP = 8,
  230. BFA_FCS_VPORT_LOGO_SEND = 9,
  231. BFA_FCS_VPORT_LOGO = 10,
  232. BFA_FCS_VPORT_ERROR = 11,
  233. BFA_FCS_VPORT_MAX_STATE,
  234. };
  235. /*
  236. * vport statistics
  237. */
  238. struct bfa_vport_stats_s {
  239. struct bfa_lport_stats_s port_stats; /* base class (port) stats */
  240. /*
  241. * TODO - remove
  242. */
  243. u32 fdisc_sent; /* num fdisc sent */
  244. u32 fdisc_accepts; /* fdisc accepts */
  245. u32 fdisc_retries; /* fdisc retries */
  246. u32 fdisc_timeouts; /* fdisc timeouts */
  247. u32 fdisc_rsp_err; /* fdisc response error */
  248. u32 fdisc_acc_bad; /* bad fdisc accepts */
  249. u32 fdisc_rejects; /* fdisc rejects */
  250. u32 fdisc_unknown_rsp;
  251. /*
  252. *!< fdisc rsp unknown error
  253. */
  254. u32 fdisc_alloc_wait;/* fdisc req (fcxp)alloc wait */
  255. u32 logo_alloc_wait;/* logo req (fcxp) alloc wait */
  256. u32 logo_sent; /* logo sent */
  257. u32 logo_accepts; /* logo accepts */
  258. u32 logo_rejects; /* logo rejects */
  259. u32 logo_rsp_err; /* logo rsp errors */
  260. u32 logo_unknown_rsp;
  261. /* logo rsp unknown errors */
  262. u32 fab_no_npiv; /* fabric does not support npiv */
  263. u32 fab_offline; /* offline events from fab SM */
  264. u32 fab_online; /* online events from fab SM */
  265. u32 fab_cleanup; /* cleanup request from fab SM */
  266. u32 rsvd;
  267. };
  268. /*
  269. * BFA vport attribute returned in queries
  270. */
  271. struct bfa_vport_attr_s {
  272. struct bfa_lport_attr_s port_attr; /* base class (port) attributes */
  273. enum bfa_vport_state vport_state; /* vport state */
  274. u32 rsvd;
  275. };
  276. /*
  277. * FCS remote port states
  278. */
  279. enum bfa_rport_state {
  280. BFA_RPORT_UNINIT = 0, /* PORT is not yet initialized */
  281. BFA_RPORT_OFFLINE = 1, /* rport is offline */
  282. BFA_RPORT_PLOGI = 2, /* PLOGI to rport is in progress */
  283. BFA_RPORT_ONLINE = 3, /* login to rport is complete */
  284. BFA_RPORT_PLOGI_RETRY = 4, /* retrying login to rport */
  285. BFA_RPORT_NSQUERY = 5, /* nameserver query */
  286. BFA_RPORT_ADISC = 6, /* ADISC authentication */
  287. BFA_RPORT_LOGO = 7, /* logging out with rport */
  288. BFA_RPORT_LOGORCV = 8, /* handling LOGO from rport */
  289. BFA_RPORT_NSDISC = 9, /* re-discover rport */
  290. };
  291. /*
  292. * Rport Scsi Function : Initiator/Target.
  293. */
  294. enum bfa_rport_function {
  295. BFA_RPORT_INITIATOR = 0x01, /* SCSI Initiator */
  296. BFA_RPORT_TARGET = 0x02, /* SCSI Target */
  297. };
  298. /*
  299. * port/node symbolic names for rport
  300. */
  301. #define BFA_RPORT_SYMNAME_MAXLEN 255
  302. struct bfa_rport_symname_s {
  303. char symname[BFA_RPORT_SYMNAME_MAXLEN];
  304. };
  305. /*
  306. * FCS remote port statistics
  307. */
  308. struct bfa_rport_stats_s {
  309. u32 offlines; /* remote port offline count */
  310. u32 onlines; /* remote port online count */
  311. u32 rscns; /* RSCN affecting rport */
  312. u32 plogis; /* plogis sent */
  313. u32 plogi_accs; /* plogi accepts */
  314. u32 plogi_timeouts; /* plogi timeouts */
  315. u32 plogi_rejects; /* rcvd plogi rejects */
  316. u32 plogi_failed; /* local failure */
  317. u32 plogi_rcvd; /* plogis rcvd */
  318. u32 prli_rcvd; /* inbound PRLIs */
  319. u32 adisc_rcvd; /* ADISCs received */
  320. u32 adisc_rejects; /* recvd ADISC rejects */
  321. u32 adisc_sent; /* ADISC requests sent */
  322. u32 adisc_accs; /* ADISC accepted by rport */
  323. u32 adisc_failed; /* ADISC failed (no response) */
  324. u32 adisc_rejected; /* ADISC rejected by us */
  325. u32 logos; /* logos sent */
  326. u32 logo_accs; /* LOGO accepts from rport */
  327. u32 logo_failed; /* LOGO failures */
  328. u32 logo_rejected; /* LOGO rejects from rport */
  329. u32 logo_rcvd; /* LOGO from remote port */
  330. u32 rpsc_rcvd; /* RPSC received */
  331. u32 rpsc_rejects; /* recvd RPSC rejects */
  332. u32 rpsc_sent; /* RPSC requests sent */
  333. u32 rpsc_accs; /* RPSC accepted by rport */
  334. u32 rpsc_failed; /* RPSC failed (no response) */
  335. u32 rpsc_rejected; /* RPSC rejected by us */
  336. u32 rjt_insuff_res; /* LS RJT with insuff resources */
  337. struct bfa_rport_hal_stats_s hal_stats; /* BFA rport stats */
  338. };
  339. /*
  340. * FCS remote port attributes returned in queries
  341. */
  342. struct bfa_rport_attr_s {
  343. wwn_t nwwn; /* node wwn */
  344. wwn_t pwwn; /* port wwn */
  345. enum fc_cos cos_supported; /* supported class of services */
  346. u32 pid; /* port ID */
  347. u32 df_sz; /* Max payload size */
  348. enum bfa_rport_state state; /* Rport State machine state */
  349. enum fc_cos fc_cos; /* FC classes of services */
  350. bfa_boolean_t cisc; /* CISC capable device */
  351. struct bfa_rport_symname_s symname; /* Symbolic Name */
  352. enum bfa_rport_function scsi_function; /* Initiator/Target */
  353. struct bfa_rport_qos_attr_s qos_attr; /* qos attributes */
  354. enum bfa_port_speed curr_speed; /* operating speed got from
  355. * RPSC ELS. UNKNOWN, if RPSC
  356. * is not supported */
  357. bfa_boolean_t trl_enforced; /* TRL enforced ? TRUE/FALSE */
  358. enum bfa_port_speed assigned_speed; /* Speed assigned by the user.
  359. * will be used if RPSC is not
  360. * supported by the rport */
  361. };
  362. struct bfa_rport_remote_link_stats_s {
  363. u32 lfc; /* Link Failure Count */
  364. u32 lsyc; /* Loss of Synchronization Count */
  365. u32 lsic; /* Loss of Signal Count */
  366. u32 pspec; /* Primitive Sequence Protocol Error Count */
  367. u32 itwc; /* Invalid Transmission Word Count */
  368. u32 icc; /* Invalid CRC Count */
  369. };
  370. #define BFA_MAX_IO_INDEX 7
  371. #define BFA_NO_IO_INDEX 9
  372. /*
  373. * FCS itnim states
  374. */
  375. enum bfa_itnim_state {
  376. BFA_ITNIM_OFFLINE = 0, /* offline */
  377. BFA_ITNIM_PRLI_SEND = 1, /* prli send */
  378. BFA_ITNIM_PRLI_SENT = 2, /* prli sent */
  379. BFA_ITNIM_PRLI_RETRY = 3, /* prli retry */
  380. BFA_ITNIM_HCB_ONLINE = 4, /* online callback */
  381. BFA_ITNIM_ONLINE = 5, /* online */
  382. BFA_ITNIM_HCB_OFFLINE = 6, /* offline callback */
  383. BFA_ITNIM_INITIATIOR = 7, /* initiator */
  384. };
  385. /*
  386. * FCS remote port statistics
  387. */
  388. struct bfa_itnim_stats_s {
  389. u32 onlines; /* num rport online */
  390. u32 offlines; /* num rport offline */
  391. u32 prli_sent; /* num prli sent out */
  392. u32 fcxp_alloc_wait;/* num fcxp alloc waits */
  393. u32 prli_rsp_err; /* num prli rsp errors */
  394. u32 prli_rsp_acc; /* num prli rsp accepts */
  395. u32 initiator; /* rport is an initiator */
  396. u32 prli_rsp_parse_err; /* prli rsp parsing errors */
  397. u32 prli_rsp_rjt; /* num prli rsp rejects */
  398. u32 timeout; /* num timeouts detected */
  399. u32 sler; /* num sler notification from BFA */
  400. u32 rsvd; /* padding for 64 bit alignment */
  401. };
  402. /*
  403. * FCS itnim attributes returned in queries
  404. */
  405. struct bfa_itnim_attr_s {
  406. enum bfa_itnim_state state; /* FCS itnim state */
  407. u8 retry; /* data retransmision support */
  408. u8 task_retry_id; /* task retry ident support */
  409. u8 rec_support; /* REC supported */
  410. u8 conf_comp; /* confirmed completion supp */
  411. };
  412. #endif /* __BFA_DEFS_FCS_H__ */