bfa_defs_fcs.h 14 KB

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