bfa_defs_fcs.h 13 KB

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