bfa_defs_fcs.h 14 KB

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