bfa_defs_svc.h 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456
  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_SVC_H__
  11. #define __BFA_DEFS_SVC_H__
  12. #include "bfa_defs.h"
  13. #include "bfa_fc.h"
  14. #include "bfi.h"
  15. #define BFA_IOCFC_INTR_DELAY 1125
  16. #define BFA_IOCFC_INTR_LATENCY 225
  17. #define BFA_IOCFCOE_INTR_DELAY 25
  18. #define BFA_IOCFCOE_INTR_LATENCY 5
  19. /*
  20. * Interrupt coalescing configuration.
  21. */
  22. #pragma pack(1)
  23. struct bfa_iocfc_intr_attr_s {
  24. u8 coalesce; /* enable/disable coalescing */
  25. u8 rsvd[3];
  26. __be16 latency; /* latency in microseconds */
  27. __be16 delay; /* delay in microseconds */
  28. };
  29. /*
  30. * IOC firmware configuraton
  31. */
  32. struct bfa_iocfc_fwcfg_s {
  33. u16 num_fabrics; /* number of fabrics */
  34. u16 num_lports; /* number of local lports */
  35. u16 num_rports; /* number of remote ports */
  36. u16 num_ioim_reqs; /* number of IO reqs */
  37. u16 num_tskim_reqs; /* task management requests */
  38. u16 num_fwtio_reqs; /* number of TM IO reqs in FW */
  39. u16 num_fcxp_reqs; /* unassisted FC exchanges */
  40. u16 num_uf_bufs; /* unsolicited recv buffers */
  41. u8 num_cqs;
  42. u8 fw_tick_res; /* FW clock resolution in ms */
  43. u8 rsvd[6];
  44. };
  45. #pragma pack()
  46. struct bfa_iocfc_drvcfg_s {
  47. u16 num_reqq_elems; /* number of req queue elements */
  48. u16 num_rspq_elems; /* number of rsp queue elements */
  49. u16 num_sgpgs; /* number of total SG pages */
  50. u16 num_sboot_tgts; /* number of SAN boot targets */
  51. u16 num_sboot_luns; /* number of SAN boot luns */
  52. u16 ioc_recover; /* IOC recovery mode */
  53. u16 min_cfg; /* minimum configuration */
  54. u16 path_tov; /* device path timeout */
  55. u16 num_tio_reqs; /* number of TM IO reqs */
  56. u8 port_mode;
  57. u8 rsvd_a;
  58. bfa_boolean_t delay_comp; /* delay completion of failed
  59. * inflight IOs */
  60. u16 num_ttsk_reqs; /* TM task management requests */
  61. u32 rsvd;
  62. };
  63. /*
  64. * IOC configuration
  65. */
  66. struct bfa_iocfc_cfg_s {
  67. struct bfa_iocfc_fwcfg_s fwcfg; /* firmware side config */
  68. struct bfa_iocfc_drvcfg_s drvcfg; /* driver side config */
  69. };
  70. /*
  71. * IOC firmware IO stats
  72. */
  73. struct bfa_fw_ioim_stats_s {
  74. u32 host_abort; /* IO aborted by host driver*/
  75. u32 host_cleanup; /* IO clean up by host driver */
  76. u32 fw_io_timeout; /* IOs timedout */
  77. u32 fw_frm_parse; /* frame parsed by f/w */
  78. u32 fw_frm_data; /* fcp_data frame parsed by f/w */
  79. u32 fw_frm_rsp; /* fcp_rsp frame parsed by f/w */
  80. u32 fw_frm_xfer_rdy; /* xfer_rdy frame parsed by f/w */
  81. u32 fw_frm_bls_acc; /* BLS ACC frame parsed by f/w */
  82. u32 fw_frm_tgt_abort; /* target ABTS parsed by f/w */
  83. u32 fw_frm_unknown; /* unknown parsed by f/w */
  84. u32 fw_data_dma; /* f/w DMA'ed the data frame */
  85. u32 fw_frm_drop; /* f/w drop the frame */
  86. u32 rec_timeout; /* FW rec timed out */
  87. u32 error_rec; /* FW sending rec on
  88. * an error condition*/
  89. u32 wait_for_si; /* FW wait for SI */
  90. u32 rec_rsp_inval; /* REC rsp invalid */
  91. u32 rec_rsp_xchg_comp; /* REC rsp xchg complete */
  92. u32 rec_rsp_rd_si_ownd; /* REC rsp read si owned */
  93. u32 seqr_io_abort; /* target does not know cmd so abort */
  94. u32 seqr_io_retry; /* SEQR failed so retry IO */
  95. u32 itn_cisc_upd_rsp; /* ITN cisc updated on fcp_rsp */
  96. u32 itn_cisc_upd_data; /* ITN cisc updated on fcp_data */
  97. u32 itn_cisc_upd_xfer_rdy; /* ITN cisc updated on fcp_data */
  98. u32 fcp_data_lost; /* fcp data lost */
  99. u32 ro_set_in_xfer_rdy; /* Target set RO in Xfer_rdy frame */
  100. u32 xfer_rdy_ooo_err; /* Out of order Xfer_rdy received */
  101. u32 xfer_rdy_unknown_err; /* unknown error in xfer_rdy frame */
  102. u32 io_abort_timeout; /* ABTS timedout */
  103. u32 sler_initiated; /* SLER initiated */
  104. u32 unexp_fcp_rsp; /* fcp response in wrong state */
  105. u32 fcp_rsp_under_run; /* fcp rsp IO underrun */
  106. u32 fcp_rsp_under_run_wr; /* fcp rsp IO underrun for write */
  107. u32 fcp_rsp_under_run_err; /* fcp rsp IO underrun error */
  108. u32 fcp_rsp_resid_inval; /* invalid residue */
  109. u32 fcp_rsp_over_run; /* fcp rsp IO overrun */
  110. u32 fcp_rsp_over_run_err; /* fcp rsp IO overrun error */
  111. u32 fcp_rsp_proto_err; /* protocol error in fcp rsp */
  112. u32 fcp_rsp_sense_err; /* error in sense info in fcp rsp */
  113. u32 fcp_conf_req; /* FCP conf requested */
  114. u32 tgt_aborted_io; /* target initiated abort */
  115. u32 ioh_edtov_timeout_event;/* IOH edtov timer popped */
  116. u32 ioh_fcp_rsp_excp_event; /* IOH FCP_RSP exception */
  117. u32 ioh_fcp_conf_event; /* IOH FCP_CONF */
  118. u32 ioh_mult_frm_rsp_event; /* IOH multi_frame FCP_RSP */
  119. u32 ioh_hit_class2_event; /* IOH hit class2 */
  120. u32 ioh_miss_other_event; /* IOH miss other */
  121. u32 ioh_seq_cnt_err_event; /* IOH seq cnt error */
  122. u32 ioh_len_err_event; /* IOH len error - fcp_dl !=
  123. * bytes xfered */
  124. u32 ioh_seq_len_err_event; /* IOH seq len error */
  125. u32 ioh_data_oor_event; /* Data out of range */
  126. u32 ioh_ro_ooo_event; /* Relative offset out of range */
  127. u32 ioh_cpu_owned_event; /* IOH hit -iost owned by f/w */
  128. u32 ioh_unexp_frame_event; /* unexpected frame received
  129. * count */
  130. u32 ioh_err_int; /* IOH error int during data-phase
  131. * for scsi write */
  132. };
  133. struct bfa_fw_tio_stats_s {
  134. u32 tio_conf_proc; /* TIO CONF processed */
  135. u32 tio_conf_drop; /* TIO CONF dropped */
  136. u32 tio_cleanup_req; /* TIO cleanup requested */
  137. u32 tio_cleanup_comp; /* TIO cleanup completed */
  138. u32 tio_abort_rsp; /* TIO abort response */
  139. u32 tio_abort_rsp_comp; /* TIO abort rsp completed */
  140. u32 tio_abts_req; /* TIO ABTS requested */
  141. u32 tio_abts_ack; /* TIO ABTS ack-ed */
  142. u32 tio_abts_ack_nocomp;/* TIO ABTS ack-ed but not completed */
  143. u32 tio_abts_tmo; /* TIO ABTS timeout */
  144. u32 tio_snsdata_dma; /* TIO sense data DMA */
  145. u32 tio_rxwchan_wait; /* TIO waiting for RX wait channel */
  146. u32 tio_rxwchan_avail; /* TIO RX wait channel available */
  147. u32 tio_hit_bls; /* TIO IOH BLS event */
  148. u32 tio_uf_recv; /* TIO received UF */
  149. u32 tio_rd_invalid_sm; /* TIO read reqst in wrong state machine */
  150. u32 tio_wr_invalid_sm; /* TIO write reqst in wrong state machine */
  151. u32 ds_rxwchan_wait; /* DS waiting for RX wait channel */
  152. u32 ds_rxwchan_avail; /* DS RX wait channel available */
  153. u32 ds_unaligned_rd; /* DS unaligned read */
  154. u32 ds_rdcomp_invalid_sm; /* DS read completed in wrong state
  155. * machine */
  156. u32 ds_wrcomp_invalid_sm; /* DS write completed in wrong state
  157. * machine */
  158. u32 ds_flush_req; /* DS flush requested */
  159. u32 ds_flush_comp; /* DS flush completed */
  160. u32 ds_xfrdy_exp; /* DS XFER_RDY expired */
  161. u32 ds_seq_cnt_err; /* DS seq cnt error */
  162. u32 ds_seq_len_err; /* DS seq len error */
  163. u32 ds_data_oor; /* DS data out of order */
  164. u32 ds_hit_bls; /* DS hit BLS */
  165. u32 ds_edtov_timer_exp; /* DS edtov expired */
  166. u32 ds_cpu_owned; /* DS cpu owned */
  167. u32 ds_hit_class2; /* DS hit class2 */
  168. u32 ds_length_err; /* DS length error */
  169. u32 ds_ro_ooo_err; /* DS relative offset out-of-order error */
  170. u32 ds_rectov_timer_exp;/* DS rectov expired */
  171. u32 ds_unexp_fr_err; /* DS unexp frame error */
  172. };
  173. /*
  174. * IOC firmware IO stats
  175. */
  176. struct bfa_fw_io_stats_s {
  177. struct bfa_fw_ioim_stats_s ioim_stats;
  178. struct bfa_fw_tio_stats_s tio_stats;
  179. };
  180. /*
  181. * IOC port firmware stats
  182. */
  183. struct bfa_fw_port_fpg_stats_s {
  184. u32 intr_evt;
  185. u32 intr;
  186. u32 intr_excess;
  187. u32 intr_cause0;
  188. u32 intr_other;
  189. u32 intr_other_ign;
  190. u32 sig_lost;
  191. u32 sig_regained;
  192. u32 sync_lost;
  193. u32 sync_to;
  194. u32 sync_regained;
  195. u32 div2_overflow;
  196. u32 div2_underflow;
  197. u32 efifo_overflow;
  198. u32 efifo_underflow;
  199. u32 idle_rx;
  200. u32 lrr_rx;
  201. u32 lr_rx;
  202. u32 ols_rx;
  203. u32 nos_rx;
  204. u32 lip_rx;
  205. u32 arbf0_rx;
  206. u32 arb_rx;
  207. u32 mrk_rx;
  208. u32 const_mrk_rx;
  209. u32 prim_unknown;
  210. };
  211. struct bfa_fw_port_lksm_stats_s {
  212. u32 hwsm_success; /* hwsm state machine success */
  213. u32 hwsm_fails; /* hwsm fails */
  214. u32 hwsm_wdtov; /* hwsm timed out */
  215. u32 swsm_success; /* swsm success */
  216. u32 swsm_fails; /* swsm fails */
  217. u32 swsm_wdtov; /* swsm timed out */
  218. u32 busybufs; /* link init failed due to busybuf */
  219. u32 buf_waits; /* bufwait state entries */
  220. u32 link_fails; /* link failures */
  221. u32 psp_errors; /* primitive sequence protocol errors */
  222. u32 lr_unexp; /* No. of times LR rx-ed unexpectedly */
  223. u32 lrr_unexp; /* No. of times LRR rx-ed unexpectedly */
  224. u32 lr_tx; /* No. of times LR tx started */
  225. u32 lrr_tx; /* No. of times LRR tx started */
  226. u32 ols_tx; /* No. of times OLS tx started */
  227. u32 nos_tx; /* No. of times NOS tx started */
  228. u32 hwsm_lrr_rx; /* No. of times LRR rx-ed by HWSM */
  229. u32 hwsm_lr_rx; /* No. of times LR rx-ed by HWSM */
  230. };
  231. struct bfa_fw_port_snsm_stats_s {
  232. u32 hwsm_success; /* Successful hwsm terminations */
  233. u32 hwsm_fails; /* hwsm fail count */
  234. u32 hwsm_wdtov; /* hwsm timed out */
  235. u32 swsm_success; /* swsm success */
  236. u32 swsm_wdtov; /* swsm timed out */
  237. u32 error_resets; /* error resets initiated by upsm */
  238. u32 sync_lost; /* Sync loss count */
  239. u32 sig_lost; /* Signal loss count */
  240. u32 asn8g_attempts; /* SNSM HWSM at 8Gbps attempts */
  241. u32 adapt_success; /* SNSM adaptation success */
  242. u32 adapt_fails; /* SNSM adaptation failures */
  243. u32 adapt_ign_fails; /* SNSM adaptation failures ignored */
  244. };
  245. struct bfa_fw_port_physm_stats_s {
  246. u32 module_inserts; /* Module insert count */
  247. u32 module_xtracts; /* Module extracts count */
  248. u32 module_invalids; /* Invalid module inserted count */
  249. u32 module_read_ign; /* Module validation status ignored */
  250. u32 laser_faults; /* Laser fault count */
  251. u32 rsvd;
  252. };
  253. struct bfa_fw_fip_stats_s {
  254. u32 vlan_req; /* vlan discovery requests */
  255. u32 vlan_notify; /* vlan notifications */
  256. u32 vlan_err; /* vlan response error */
  257. u32 vlan_timeouts; /* vlan disvoery timeouts */
  258. u32 vlan_invalids; /* invalid vlan in discovery advert. */
  259. u32 disc_req; /* Discovery solicit requests */
  260. u32 disc_rsp; /* Discovery solicit response */
  261. u32 disc_err; /* Discovery advt. parse errors */
  262. u32 disc_unsol; /* Discovery unsolicited */
  263. u32 disc_timeouts; /* Discovery timeouts */
  264. u32 disc_fcf_unavail; /* Discovery FCF Not Avail. */
  265. u32 linksvc_unsupp; /* Unsupported link service req */
  266. u32 linksvc_err; /* Parse error in link service req */
  267. u32 logo_req; /* FIP logos received */
  268. u32 clrvlink_req; /* Clear virtual link req */
  269. u32 op_unsupp; /* Unsupported FIP operation */
  270. u32 untagged; /* Untagged frames (ignored) */
  271. u32 invalid_version; /* Invalid FIP version */
  272. };
  273. struct bfa_fw_lps_stats_s {
  274. u32 mac_invalids; /* Invalid mac assigned */
  275. u32 rsvd;
  276. };
  277. struct bfa_fw_fcoe_stats_s {
  278. u32 cee_linkups; /* CEE link up count */
  279. u32 cee_linkdns; /* CEE link down count */
  280. u32 fip_linkups; /* FIP link up count */
  281. u32 fip_linkdns; /* FIP link up count */
  282. u32 fip_fails; /* FIP fail count */
  283. u32 mac_invalids; /* Invalid mac assigned */
  284. };
  285. /*
  286. * IOC firmware FCoE port stats
  287. */
  288. struct bfa_fw_fcoe_port_stats_s {
  289. struct bfa_fw_fcoe_stats_s fcoe_stats;
  290. struct bfa_fw_fip_stats_s fip_stats;
  291. };
  292. /**
  293. * @brief LPSM statistics
  294. */
  295. struct bfa_fw_lpsm_stats_s {
  296. u32 cls_rx; /* LPSM cls_rx */
  297. u32 cls_tx; /* LPSM cls_tx */
  298. u32 arbf0_rx; /* LPSM abrf0 rcvd */
  299. u32 arbf0_tx; /* LPSM abrf0 xmit */
  300. u32 init_rx; /* LPSM loop init start */
  301. u32 unexp_hwst; /* LPSM unknown hw state */
  302. u32 unexp_frame; /* LPSM unknown_frame */
  303. u32 unexp_prim; /* LPSM unexpected primitive */
  304. u32 prev_alpa_unavail; /* LPSM prev alpa unavailable */
  305. u32 alpa_unavail; /* LPSM alpa not available */
  306. u32 lip_rx; /* LPSM lip rcvd */
  307. u32 lip_f7f7_rx; /* LPSM lip f7f7 rcvd */
  308. u32 lip_f8_rx; /* LPSM lip f8 rcvd */
  309. u32 lip_f8f7_rx; /* LPSM lip f8f7 rcvd */
  310. u32 lip_other_rx; /* LPSM lip other rcvd */
  311. u32 lip_tx; /* LPSM lip xmit */
  312. u32 retry_tov; /* LPSM retry TOV */
  313. u32 lip_tov; /* LPSM LIP wait TOV */
  314. u32 idle_tov; /* LPSM idle wait TOV */
  315. u32 arbf0_tov; /* LPSM arbfo wait TOV */
  316. u32 stop_loop_tov; /* LPSM stop loop wait TOV */
  317. u32 lixa_tov; /* LPSM lisa wait TOV */
  318. u32 lixx_tov; /* LPSM lilp/lirp wait TOV */
  319. u32 cls_tov; /* LPSM cls wait TOV */
  320. u32 sler; /* LPSM SLER recvd */
  321. u32 failed; /* LPSM failed */
  322. u32 success; /* LPSM online */
  323. };
  324. /*
  325. * IOC firmware FC uport stats
  326. */
  327. struct bfa_fw_fc_uport_stats_s {
  328. struct bfa_fw_port_snsm_stats_s snsm_stats;
  329. struct bfa_fw_port_lksm_stats_s lksm_stats;
  330. struct bfa_fw_lpsm_stats_s lpsm_stats;
  331. };
  332. /*
  333. * IOC firmware FC port stats
  334. */
  335. union bfa_fw_fc_port_stats_s {
  336. struct bfa_fw_fc_uport_stats_s fc_stats;
  337. struct bfa_fw_fcoe_port_stats_s fcoe_stats;
  338. };
  339. /*
  340. * IOC firmware port stats
  341. */
  342. struct bfa_fw_port_stats_s {
  343. struct bfa_fw_port_fpg_stats_s fpg_stats;
  344. struct bfa_fw_port_physm_stats_s physm_stats;
  345. union bfa_fw_fc_port_stats_s fc_port;
  346. };
  347. /*
  348. * fcxchg module statistics
  349. */
  350. struct bfa_fw_fcxchg_stats_s {
  351. u32 ua_tag_inv;
  352. u32 ua_state_inv;
  353. };
  354. /*
  355. * Trunk statistics
  356. */
  357. struct bfa_fw_trunk_stats_s {
  358. u32 emt_recvd; /* Trunk EMT received */
  359. u32 emt_accepted; /* Trunk EMT Accepted */
  360. u32 emt_rejected; /* Trunk EMT rejected */
  361. u32 etp_recvd; /* Trunk ETP received */
  362. u32 etp_accepted; /* Trunk ETP Accepted */
  363. u32 etp_rejected; /* Trunk ETP rejected */
  364. u32 lr_recvd; /* Trunk LR received */
  365. u32 rsvd; /* padding for 64 bit alignment */
  366. };
  367. struct bfa_fw_aport_stats_s {
  368. u32 flogi_sent; /* Flogi sent */
  369. u32 flogi_acc_recvd; /* Flogi Acc received */
  370. u32 flogi_rjt_recvd; /* Flogi rejects received */
  371. u32 flogi_retries; /* Flogi retries */
  372. u32 elp_recvd; /* ELP received */
  373. u32 elp_accepted; /* ELP Accepted */
  374. u32 elp_rejected; /* ELP rejected */
  375. u32 elp_dropped; /* ELP dropped */
  376. u32 bbcr_lr_count; /*!< BBCR Link Resets */
  377. u32 frame_lost_intrs; /*!< BBCR Frame loss intrs */
  378. u32 rrdy_lost_intrs; /*!< BBCR Rrdy loss intrs */
  379. u32 rsvd;
  380. };
  381. /*
  382. * IOCFC firmware stats
  383. */
  384. struct bfa_fw_iocfc_stats_s {
  385. u32 cfg_reqs; /* cfg request */
  386. u32 updq_reqs; /* update queue request */
  387. u32 ic_reqs; /* interrupt coalesce reqs */
  388. u32 unknown_reqs;
  389. u32 set_intr_reqs; /* set interrupt reqs */
  390. };
  391. /*
  392. * IOC attributes returned in queries
  393. */
  394. struct bfa_iocfc_attr_s {
  395. struct bfa_iocfc_cfg_s config; /* IOCFC config */
  396. struct bfa_iocfc_intr_attr_s intr_attr; /* interrupt attr */
  397. };
  398. /*
  399. * Eth_sndrcv mod stats
  400. */
  401. struct bfa_fw_eth_sndrcv_stats_s {
  402. u32 crc_err;
  403. u32 rsvd; /* 64bit align */
  404. };
  405. /*
  406. * CT MAC mod stats
  407. */
  408. struct bfa_fw_mac_mod_stats_s {
  409. u32 mac_on; /* MAC got turned-on */
  410. u32 link_up; /* link-up */
  411. u32 signal_off; /* lost signal */
  412. u32 dfe_on; /* DFE on */
  413. u32 mac_reset; /* # of MAC reset to bring lnk up */
  414. u32 pcs_reset; /* # of PCS reset to bring lnk up */
  415. u32 loopback; /* MAC got into serdes loopback */
  416. u32 lb_mac_reset;
  417. /* # of MAC reset to bring link up in loopback */
  418. u32 lb_pcs_reset;
  419. /* # of PCS reset to bring link up in loopback */
  420. u32 rsvd; /* 64bit align */
  421. };
  422. /*
  423. * CT MOD stats
  424. */
  425. struct bfa_fw_ct_mod_stats_s {
  426. u32 rxa_rds_undrun; /* RxA RDS underrun */
  427. u32 rad_bpc_ovfl; /* RAD BPC overflow */
  428. u32 rad_rlb_bpc_ovfl; /* RAD RLB BPC overflow */
  429. u32 bpc_fcs_err; /* BPC FCS_ERR */
  430. u32 txa_tso_hdr; /* TxA TSO header too long */
  431. u32 rsvd; /* 64bit align */
  432. };
  433. /*
  434. * RDS mod stats
  435. */
  436. struct bfa_fw_rds_stats_s {
  437. u32 no_fid_drop_err; /* RDS no fid drop error */
  438. u32 rsvd; /* 64bit align */
  439. };
  440. /*
  441. * IOC firmware stats
  442. */
  443. struct bfa_fw_stats_s {
  444. struct bfa_fw_ioc_stats_s ioc_stats;
  445. struct bfa_fw_iocfc_stats_s iocfc_stats;
  446. struct bfa_fw_io_stats_s io_stats;
  447. struct bfa_fw_port_stats_s port_stats;
  448. struct bfa_fw_fcxchg_stats_s fcxchg_stats;
  449. struct bfa_fw_lps_stats_s lps_stats;
  450. struct bfa_fw_trunk_stats_s trunk_stats;
  451. struct bfa_fw_aport_stats_s aport_stats;
  452. struct bfa_fw_mac_mod_stats_s macmod_stats;
  453. struct bfa_fw_ct_mod_stats_s ctmod_stats;
  454. struct bfa_fw_eth_sndrcv_stats_s ethsndrcv_stats;
  455. struct bfa_fw_rds_stats_s rds_stats;
  456. };
  457. #define BFA_IOCFC_PATHTOV_MAX 60
  458. #define BFA_IOCFC_QDEPTH_MAX 2000
  459. /*
  460. * QoS states
  461. */
  462. enum bfa_qos_state {
  463. BFA_QOS_DISABLED = 0, /* QoS is disabled */
  464. BFA_QOS_ONLINE = 1, /* QoS is online */
  465. BFA_QOS_OFFLINE = 2, /* QoS is offline */
  466. };
  467. /*
  468. * QoS Priority levels.
  469. */
  470. enum bfa_qos_priority {
  471. BFA_QOS_UNKNOWN = 0,
  472. BFA_QOS_HIGH = 1, /* QoS Priority Level High */
  473. BFA_QOS_MED = 2, /* QoS Priority Level Medium */
  474. BFA_QOS_LOW = 3, /* QoS Priority Level Low */
  475. };
  476. /*
  477. * QoS bandwidth allocation for each priority level
  478. */
  479. enum bfa_qos_bw_alloc {
  480. BFA_QOS_BW_HIGH = 60, /* bandwidth allocation for High */
  481. BFA_QOS_BW_MED = 30, /* bandwidth allocation for Medium */
  482. BFA_QOS_BW_LOW = 10, /* bandwidth allocation for Low */
  483. };
  484. #pragma pack(1)
  485. struct bfa_qos_bw_s {
  486. u8 qos_bw_set;
  487. u8 high;
  488. u8 med;
  489. u8 low;
  490. };
  491. /*
  492. * QoS attribute returned in QoS Query
  493. */
  494. struct bfa_qos_attr_s {
  495. u8 state; /* QoS current state */
  496. u8 rsvd1[3];
  497. u32 total_bb_cr; /* Total BB Credits */
  498. struct bfa_qos_bw_s qos_bw; /* QOS bw cfg */
  499. struct bfa_qos_bw_s qos_bw_op; /* QOS bw operational */
  500. };
  501. enum bfa_bbcr_state {
  502. BFA_BBCR_DISABLED, /*!< BBCR is disable */
  503. BFA_BBCR_ONLINE, /*!< BBCR is online */
  504. BFA_BBCR_OFFLINE, /*!< BBCR is offline */
  505. };
  506. enum bfa_bbcr_err_reason {
  507. BFA_BBCR_ERR_REASON_NONE, /*!< Unknown */
  508. BFA_BBCR_ERR_REASON_SPEED_UNSUP, /*!< Port speed < max sup_speed */
  509. BFA_BBCR_ERR_REASON_PEER_UNSUP, /*!< BBCR is disable on peer port */
  510. BFA_BBCR_ERR_REASON_NON_BRCD_SW, /*!< Connected to non BRCD switch */
  511. BFA_BBCR_ERR_REASON_FLOGI_RJT, /*!< Login rejected by the switch */
  512. };
  513. struct bfa_bbcr_attr_s {
  514. u8 state;
  515. u8 peer_bb_scn;
  516. u8 reason;
  517. u8 rsvd;
  518. };
  519. /*
  520. * These fields should be displayed only from the CLI.
  521. * There will be a separate BFAL API (get_qos_vc_attr ?)
  522. * to retrieve this.
  523. *
  524. */
  525. #define BFA_QOS_MAX_VC 16
  526. struct bfa_qos_vc_info_s {
  527. u8 vc_credit;
  528. u8 borrow_credit;
  529. u8 priority;
  530. u8 resvd;
  531. };
  532. struct bfa_qos_vc_attr_s {
  533. u16 total_vc_count; /* Total VC Count */
  534. u16 shared_credit;
  535. u32 elp_opmode_flags;
  536. struct bfa_qos_vc_info_s vc_info[BFA_QOS_MAX_VC]; /* as many as
  537. * total_vc_count */
  538. };
  539. /*
  540. * QoS statistics
  541. */
  542. struct bfa_qos_stats_s {
  543. u32 flogi_sent; /* QoS Flogi sent */
  544. u32 flogi_acc_recvd; /* QoS Flogi Acc received */
  545. u32 flogi_rjt_recvd; /* QoS Flogi rejects received */
  546. u32 flogi_retries; /* QoS Flogi retries */
  547. u32 elp_recvd; /* QoS ELP received */
  548. u32 elp_accepted; /* QoS ELP Accepted */
  549. u32 elp_rejected; /* QoS ELP rejected */
  550. u32 elp_dropped; /* QoS ELP dropped */
  551. u32 qos_rscn_recvd; /* QoS RSCN received */
  552. u32 rsvd; /* padding for 64 bit alignment */
  553. };
  554. /*
  555. * FCoE statistics
  556. */
  557. struct bfa_fcoe_stats_s {
  558. u64 secs_reset; /* Seconds since stats reset */
  559. u64 cee_linkups; /* CEE link up */
  560. u64 cee_linkdns; /* CEE link down */
  561. u64 fip_linkups; /* FIP link up */
  562. u64 fip_linkdns; /* FIP link down */
  563. u64 fip_fails; /* FIP failures */
  564. u64 mac_invalids; /* Invalid mac assignments */
  565. u64 vlan_req; /* Vlan requests */
  566. u64 vlan_notify; /* Vlan notifications */
  567. u64 vlan_err; /* Vlan notification errors */
  568. u64 vlan_timeouts; /* Vlan request timeouts */
  569. u64 vlan_invalids; /* Vlan invalids */
  570. u64 disc_req; /* Discovery requests */
  571. u64 disc_rsp; /* Discovery responses */
  572. u64 disc_err; /* Discovery error frames */
  573. u64 disc_unsol; /* Discovery unsolicited */
  574. u64 disc_timeouts; /* Discovery timeouts */
  575. u64 disc_fcf_unavail; /* Discovery FCF not avail */
  576. u64 linksvc_unsupp; /* FIP link service req unsupp */
  577. u64 linksvc_err; /* FIP link service req errors */
  578. u64 logo_req; /* FIP logos received */
  579. u64 clrvlink_req; /* Clear virtual link requests */
  580. u64 op_unsupp; /* FIP operation unsupp. */
  581. u64 untagged; /* FIP untagged frames */
  582. u64 txf_ucast; /* Tx FCoE unicast frames */
  583. u64 txf_ucast_vlan; /* Tx FCoE unicast vlan frames */
  584. u64 txf_ucast_octets; /* Tx FCoE unicast octets */
  585. u64 txf_mcast; /* Tx FCoE multicast frames */
  586. u64 txf_mcast_vlan; /* Tx FCoE multicast vlan frames */
  587. u64 txf_mcast_octets; /* Tx FCoE multicast octets */
  588. u64 txf_bcast; /* Tx FCoE broadcast frames */
  589. u64 txf_bcast_vlan; /* Tx FCoE broadcast vlan frames */
  590. u64 txf_bcast_octets; /* Tx FCoE broadcast octets */
  591. u64 txf_timeout; /* Tx timeouts */
  592. u64 txf_parity_errors; /* Transmit parity err */
  593. u64 txf_fid_parity_errors; /* Transmit FID parity err */
  594. u64 rxf_ucast_octets; /* Rx FCoE unicast octets */
  595. u64 rxf_ucast; /* Rx FCoE unicast frames */
  596. u64 rxf_ucast_vlan; /* Rx FCoE unicast vlan frames */
  597. u64 rxf_mcast_octets; /* Rx FCoE multicast octets */
  598. u64 rxf_mcast; /* Rx FCoE multicast frames */
  599. u64 rxf_mcast_vlan; /* Rx FCoE multicast vlan frames */
  600. u64 rxf_bcast_octets; /* Rx FCoE broadcast octets */
  601. u64 rxf_bcast; /* Rx FCoE broadcast frames */
  602. u64 rxf_bcast_vlan; /* Rx FCoE broadcast vlan frames */
  603. };
  604. /*
  605. * QoS or FCoE stats (fcport stats excluding physical FC port stats)
  606. */
  607. union bfa_fcport_stats_u {
  608. struct bfa_qos_stats_s fcqos;
  609. struct bfa_fcoe_stats_s fcoe;
  610. };
  611. #pragma pack()
  612. struct bfa_fcpim_del_itn_stats_s {
  613. u32 del_itn_iocomp_aborted; /* Aborted IO requests */
  614. u32 del_itn_iocomp_timedout; /* IO timeouts */
  615. u32 del_itn_iocom_sqer_needed; /* IO retry for SQ error recovery */
  616. u32 del_itn_iocom_res_free; /* Delayed freeing of IO resources */
  617. u32 del_itn_iocom_hostabrts; /* Host IO abort requests */
  618. u32 del_itn_total_ios; /* Total IO count */
  619. u32 del_io_iocdowns; /* IO cleaned-up due to IOC down */
  620. u32 del_tm_iocdowns; /* TM cleaned-up due to IOC down */
  621. };
  622. struct bfa_itnim_iostats_s {
  623. u32 total_ios; /* Total IO Requests */
  624. u32 input_reqs; /* Data in-bound requests */
  625. u32 output_reqs; /* Data out-bound requests */
  626. u32 io_comps; /* Total IO Completions */
  627. u32 wr_throughput; /* Write data transferred in bytes */
  628. u32 rd_throughput; /* Read data transferred in bytes */
  629. u32 iocomp_ok; /* Slowpath IO completions */
  630. u32 iocomp_underrun; /* IO underrun */
  631. u32 iocomp_overrun; /* IO overrun */
  632. u32 qwait; /* IO Request-Q wait */
  633. u32 qresumes; /* IO Request-Q wait done */
  634. u32 no_iotags; /* No free IO tag */
  635. u32 iocomp_timedout; /* IO timeouts */
  636. u32 iocom_nexus_abort; /* IO failure due to target offline */
  637. u32 iocom_proto_err; /* IO protocol errors */
  638. u32 iocom_dif_err; /* IO SBC-3 protection errors */
  639. u32 iocom_sqer_needed; /* fcp-2 error recovery failed */
  640. u32 iocom_res_free; /* Delayed freeing of IO tag */
  641. u32 io_aborts; /* Host IO abort requests */
  642. u32 iocom_hostabrts; /* Host IO abort completions */
  643. u32 io_cleanups; /* IO clean-up requests */
  644. u32 path_tov_expired; /* IO path tov expired */
  645. u32 iocomp_aborted; /* IO abort completions */
  646. u32 io_iocdowns; /* IO cleaned-up due to IOC down */
  647. u32 iocom_utags; /* IO comp with unknown tags */
  648. u32 io_tmaborts; /* Abort request due to TM command */
  649. u32 tm_io_comps; /* Abort completion due to TM command */
  650. u32 creates; /* IT Nexus create requests */
  651. u32 fw_create; /* IT Nexus FW create requests */
  652. u32 create_comps; /* IT Nexus FW create completions */
  653. u32 onlines; /* IT Nexus onlines */
  654. u32 offlines; /* IT Nexus offlines */
  655. u32 fw_delete; /* IT Nexus FW delete requests */
  656. u32 delete_comps; /* IT Nexus FW delete completions */
  657. u32 deletes; /* IT Nexus delete requests */
  658. u32 sler_events; /* SLER events */
  659. u32 ioc_disabled; /* Num IOC disables */
  660. u32 cleanup_comps; /* IT Nexus cleanup completions */
  661. u32 tm_cmnds; /* TM Requests */
  662. u32 tm_fw_rsps; /* TM Completions */
  663. u32 tm_success; /* TM initiated IO cleanup success */
  664. u32 tm_failures; /* TM initiated IO cleanup failure */
  665. u32 no_tskims; /* No free TM tag */
  666. u32 tm_qwait; /* TM Request-Q wait */
  667. u32 tm_qresumes; /* TM Request-Q wait done */
  668. u32 tm_iocdowns; /* TM cleaned-up due to IOC down */
  669. u32 tm_cleanups; /* TM cleanup requests */
  670. u32 tm_cleanup_comps; /* TM cleanup completions */
  671. u32 rsvd[6];
  672. };
  673. /* Modify char* port_stt[] in bfal_port.c if a new state was added */
  674. enum bfa_port_states {
  675. BFA_PORT_ST_UNINIT = 1,
  676. BFA_PORT_ST_ENABLING_QWAIT = 2,
  677. BFA_PORT_ST_ENABLING = 3,
  678. BFA_PORT_ST_LINKDOWN = 4,
  679. BFA_PORT_ST_LINKUP = 5,
  680. BFA_PORT_ST_DISABLING_QWAIT = 6,
  681. BFA_PORT_ST_DISABLING = 7,
  682. BFA_PORT_ST_DISABLED = 8,
  683. BFA_PORT_ST_STOPPED = 9,
  684. BFA_PORT_ST_IOCDOWN = 10,
  685. BFA_PORT_ST_IOCDIS = 11,
  686. BFA_PORT_ST_FWMISMATCH = 12,
  687. BFA_PORT_ST_PREBOOT_DISABLED = 13,
  688. BFA_PORT_ST_TOGGLING_QWAIT = 14,
  689. BFA_PORT_ST_FAA_MISCONFIG = 15,
  690. BFA_PORT_ST_DPORT = 16,
  691. BFA_PORT_ST_DDPORT = 17,
  692. BFA_PORT_ST_MAX_STATE,
  693. };
  694. /*
  695. * Port operational type (in sync with SNIA port type).
  696. */
  697. enum bfa_port_type {
  698. BFA_PORT_TYPE_UNKNOWN = 1, /* port type is unknown */
  699. BFA_PORT_TYPE_NPORT = 5, /* P2P with switched fabric */
  700. BFA_PORT_TYPE_NLPORT = 6, /* public loop */
  701. BFA_PORT_TYPE_LPORT = 20, /* private loop */
  702. BFA_PORT_TYPE_P2P = 21, /* P2P with no switched fabric */
  703. BFA_PORT_TYPE_VPORT = 22, /* NPIV - virtual port */
  704. };
  705. /*
  706. * Port topology setting. A port's topology and fabric login status
  707. * determine its operational type.
  708. */
  709. enum bfa_port_topology {
  710. BFA_PORT_TOPOLOGY_NONE = 0, /* No valid topology */
  711. BFA_PORT_TOPOLOGY_P2P_OLD_VER = 1, /* P2P def for older ver */
  712. BFA_PORT_TOPOLOGY_LOOP = 2, /* LOOP topology */
  713. BFA_PORT_TOPOLOGY_AUTO_OLD_VER = 3, /* auto def for older ver */
  714. BFA_PORT_TOPOLOGY_AUTO = 4, /* auto topology selection */
  715. BFA_PORT_TOPOLOGY_P2P = 5, /* P2P only */
  716. };
  717. /*
  718. * Physical port loopback types.
  719. */
  720. enum bfa_port_opmode {
  721. BFA_PORT_OPMODE_NORMAL = 0x00, /* normal non-loopback mode */
  722. BFA_PORT_OPMODE_LB_INT = 0x01, /* internal loop back */
  723. BFA_PORT_OPMODE_LB_SLW = 0x02, /* serial link wrapback (serdes) */
  724. BFA_PORT_OPMODE_LB_EXT = 0x04, /* external loop back (serdes) */
  725. BFA_PORT_OPMODE_LB_CBL = 0x08, /* cabled loop back */
  726. BFA_PORT_OPMODE_LB_NLINT = 0x20, /* NL_Port internal loopback */
  727. };
  728. #define BFA_PORT_OPMODE_LB_HARD(_mode) \
  729. ((_mode == BFA_PORT_OPMODE_LB_INT) || \
  730. (_mode == BFA_PORT_OPMODE_LB_SLW) || \
  731. (_mode == BFA_PORT_OPMODE_LB_EXT))
  732. /*
  733. * Port link state
  734. */
  735. enum bfa_port_linkstate {
  736. BFA_PORT_LINKUP = 1, /* Physical port/Trunk link up */
  737. BFA_PORT_LINKDOWN = 2, /* Physical port/Trunk link down */
  738. };
  739. /*
  740. * Port link state reason code
  741. */
  742. enum bfa_port_linkstate_rsn {
  743. BFA_PORT_LINKSTATE_RSN_NONE = 0,
  744. BFA_PORT_LINKSTATE_RSN_DISABLED = 1,
  745. BFA_PORT_LINKSTATE_RSN_RX_NOS = 2,
  746. BFA_PORT_LINKSTATE_RSN_RX_OLS = 3,
  747. BFA_PORT_LINKSTATE_RSN_RX_LIP = 4,
  748. BFA_PORT_LINKSTATE_RSN_RX_LIPF7 = 5,
  749. BFA_PORT_LINKSTATE_RSN_SFP_REMOVED = 6,
  750. BFA_PORT_LINKSTATE_RSN_PORT_FAULT = 7,
  751. BFA_PORT_LINKSTATE_RSN_RX_LOS = 8,
  752. BFA_PORT_LINKSTATE_RSN_LOCAL_FAULT = 9,
  753. BFA_PORT_LINKSTATE_RSN_REMOTE_FAULT = 10,
  754. BFA_PORT_LINKSTATE_RSN_TIMEOUT = 11,
  755. BFA_PORT_LINKSTATE_RSN_FAA_MISCONFIG = 12,
  756. /* CEE related reason codes/errors */
  757. CEE_LLDP_INFO_AGED_OUT = 20,
  758. CEE_LLDP_SHUTDOWN_TLV_RCVD = 21,
  759. CEE_PEER_NOT_ADVERTISE_DCBX = 22,
  760. CEE_PEER_NOT_ADVERTISE_PG = 23,
  761. CEE_PEER_NOT_ADVERTISE_PFC = 24,
  762. CEE_PEER_NOT_ADVERTISE_FCOE = 25,
  763. CEE_PG_NOT_COMPATIBLE = 26,
  764. CEE_PFC_NOT_COMPATIBLE = 27,
  765. CEE_FCOE_NOT_COMPATIBLE = 28,
  766. CEE_BAD_PG_RCVD = 29,
  767. CEE_BAD_BW_RCVD = 30,
  768. CEE_BAD_PFC_RCVD = 31,
  769. CEE_BAD_APP_PRI_RCVD = 32,
  770. CEE_FCOE_PRI_PFC_OFF = 33,
  771. CEE_DUP_CONTROL_TLV_RCVD = 34,
  772. CEE_DUP_FEAT_TLV_RCVD = 35,
  773. CEE_APPLY_NEW_CFG = 36, /* reason, not error */
  774. CEE_PROTOCOL_INIT = 37, /* reason, not error */
  775. CEE_PHY_LINK_DOWN = 38,
  776. CEE_LLS_FCOE_ABSENT = 39,
  777. CEE_LLS_FCOE_DOWN = 40,
  778. CEE_ISCSI_NOT_COMPATIBLE = 41,
  779. CEE_ISCSI_PRI_PFC_OFF = 42,
  780. CEE_ISCSI_PRI_OVERLAP_FCOE_PRI = 43
  781. };
  782. #define MAX_LUN_MASK_CFG 16
  783. /*
  784. * Initially flash content may be fff. On making LUN mask enable and disable
  785. * state change. when report lun command is being processed it goes from
  786. * BFA_LUN_MASK_ACTIVE to BFA_LUN_MASK_FETCH and comes back to
  787. * BFA_LUN_MASK_ACTIVE.
  788. */
  789. enum bfa_ioim_lun_mask_state_s {
  790. BFA_IOIM_LUN_MASK_INACTIVE = 0,
  791. BFA_IOIM_LUN_MASK_ACTIVE = 1,
  792. BFA_IOIM_LUN_MASK_FETCHED = 2,
  793. };
  794. enum bfa_lunmask_state_s {
  795. BFA_LUNMASK_DISABLED = 0x00,
  796. BFA_LUNMASK_ENABLED = 0x01,
  797. BFA_LUNMASK_MINCFG = 0x02,
  798. BFA_LUNMASK_UNINITIALIZED = 0xff,
  799. };
  800. /**
  801. * FEC states
  802. */
  803. enum bfa_fec_state_s {
  804. BFA_FEC_ONLINE = 1, /*!< FEC is online */
  805. BFA_FEC_OFFLINE = 2, /*!< FEC is offline */
  806. BFA_FEC_OFFLINE_NOT_16G = 3, /*!< FEC is offline (speed not 16Gig) */
  807. };
  808. #pragma pack(1)
  809. /*
  810. * LUN mask configuration
  811. */
  812. struct bfa_lun_mask_s {
  813. wwn_t lp_wwn;
  814. wwn_t rp_wwn;
  815. struct scsi_lun lun;
  816. u8 ua;
  817. u8 rsvd[3];
  818. u16 rp_tag;
  819. u8 lp_tag;
  820. u8 state;
  821. };
  822. #define MAX_LUN_MASK_CFG 16
  823. struct bfa_lunmask_cfg_s {
  824. u32 status;
  825. u32 rsvd;
  826. struct bfa_lun_mask_s lun_list[MAX_LUN_MASK_CFG];
  827. };
  828. struct bfa_throttle_cfg_s {
  829. u16 is_valid;
  830. u16 value;
  831. u32 rsvd;
  832. };
  833. struct bfa_defs_fcpim_throttle_s {
  834. u16 max_value;
  835. u16 cur_value;
  836. u16 cfg_value;
  837. u16 rsvd;
  838. };
  839. #define BFA_BB_SCN_DEF 3
  840. #define BFA_BB_SCN_MAX 0x0F
  841. /*
  842. * Physical port configuration
  843. */
  844. struct bfa_port_cfg_s {
  845. u8 topology; /* bfa_port_topology */
  846. u8 speed; /* enum bfa_port_speed */
  847. u8 trunked; /* trunked or not */
  848. u8 qos_enabled; /* qos enabled or not */
  849. u8 cfg_hardalpa; /* is hard alpa configured */
  850. u8 hardalpa; /* configured hard alpa */
  851. __be16 maxfrsize; /* maximum frame size */
  852. u8 rx_bbcredit; /* receive buffer credits */
  853. u8 tx_bbcredit; /* transmit buffer credits */
  854. u8 ratelimit; /* ratelimit enabled or not */
  855. u8 trl_def_speed; /* ratelimit default speed */
  856. u8 bb_cr_enabled; /*!< Config state of BB_SCN */
  857. u8 bb_scn; /*!< BB_SCN value for FLOGI Exchg */
  858. u8 faa_state; /* FAA enabled/disabled */
  859. u8 rsvd1;
  860. u16 path_tov; /* device path timeout */
  861. u16 q_depth; /* SCSI Queue depth */
  862. struct bfa_qos_bw_s qos_bw; /* QOS bandwidth */
  863. };
  864. #pragma pack()
  865. /*
  866. * Port attribute values.
  867. */
  868. struct bfa_port_attr_s {
  869. /*
  870. * Static fields
  871. */
  872. wwn_t nwwn; /* node wwn */
  873. wwn_t pwwn; /* port wwn */
  874. wwn_t factorynwwn; /* factory node wwn */
  875. wwn_t factorypwwn; /* factory port wwn */
  876. enum fc_cos cos_supported; /* supported class of
  877. * services */
  878. u32 rsvd;
  879. struct fc_symname_s port_symname; /* port symbolic name */
  880. enum bfa_port_speed speed_supported; /* supported speeds */
  881. bfa_boolean_t pbind_enabled;
  882. /*
  883. * Configured values
  884. */
  885. struct bfa_port_cfg_s pport_cfg; /* pport cfg */
  886. /*
  887. * Dynamic field - info from BFA
  888. */
  889. enum bfa_port_states port_state; /* current port state */
  890. enum bfa_port_speed speed; /* current speed */
  891. enum bfa_port_topology topology; /* current topology */
  892. bfa_boolean_t beacon; /* current beacon status */
  893. bfa_boolean_t link_e2e_beacon; /* link beacon is on */
  894. bfa_boolean_t bbsc_op_status; /* fc credit recovery oper
  895. * state */
  896. enum bfa_fec_state_s fec_state; /*!< current FEC state */
  897. /*
  898. * Dynamic field - info from FCS
  899. */
  900. u32 pid; /* port ID */
  901. enum bfa_port_type port_type; /* current topology */
  902. u32 loopback; /* external loopback */
  903. u32 authfail; /* auth fail state */
  904. /* FCoE specific */
  905. u16 fcoe_vlan;
  906. u8 rsvd1[2];
  907. };
  908. /*
  909. * Port FCP mappings.
  910. */
  911. struct bfa_port_fcpmap_s {
  912. char osdevname[256];
  913. u32 bus;
  914. u32 target;
  915. u32 oslun;
  916. u32 fcid;
  917. wwn_t nwwn;
  918. wwn_t pwwn;
  919. u64 fcplun;
  920. char luid[256];
  921. };
  922. /*
  923. * Port RNID info.
  924. */
  925. struct bfa_port_rnid_s {
  926. wwn_t wwn;
  927. u32 unittype;
  928. u32 portid;
  929. u32 attached_nodes_num;
  930. u16 ip_version;
  931. u16 udp_port;
  932. u8 ipaddr[16];
  933. u16 rsvd;
  934. u16 topologydiscoveryflags;
  935. };
  936. #pragma pack(1)
  937. struct bfa_fcport_fcf_s {
  938. wwn_t name; /* FCF name */
  939. wwn_t fabric_name; /* Fabric Name */
  940. u8 fipenabled; /* FIP enabled or not */
  941. u8 fipfailed; /* FIP failed or not */
  942. u8 resv[2];
  943. u8 pri; /* FCF priority */
  944. u8 version; /* FIP version used */
  945. u8 available; /* Available for login */
  946. u8 fka_disabled; /* FKA is disabled */
  947. u8 maxsz_verified; /* FCoE max size verified */
  948. u8 fc_map[3]; /* FC map */
  949. __be16 vlan; /* FCoE vlan tag/priority */
  950. u32 fka_adv_per; /* FIP ka advert. period */
  951. mac_t mac; /* FCF mac */
  952. };
  953. /*
  954. * Trunk states for BCU/BFAL
  955. */
  956. enum bfa_trunk_state {
  957. BFA_TRUNK_DISABLED = 0, /* Trunk is not configured */
  958. BFA_TRUNK_ONLINE = 1, /* Trunk is online */
  959. BFA_TRUNK_OFFLINE = 2, /* Trunk is offline */
  960. };
  961. /*
  962. * VC attributes for trunked link
  963. */
  964. struct bfa_trunk_vc_attr_s {
  965. u32 bb_credit;
  966. u32 elp_opmode_flags;
  967. u32 req_credit;
  968. u16 vc_credits[8];
  969. };
  970. struct bfa_fcport_loop_info_s {
  971. u8 myalpa; /* alpa claimed */
  972. u8 alpabm_val; /* alpa bitmap valid or not (1 or 0) */
  973. u8 resvd[6];
  974. struct fc_alpabm_s alpabm; /* alpa bitmap */
  975. };
  976. /*
  977. * Link state information
  978. */
  979. struct bfa_port_link_s {
  980. u8 linkstate; /* Link state bfa_port_linkstate */
  981. u8 linkstate_rsn; /* bfa_port_linkstate_rsn_t */
  982. u8 topology; /* P2P/LOOP bfa_port_topology */
  983. u8 speed; /* Link speed (1/2/4/8 G) */
  984. u32 linkstate_opt; /* Linkstate optional data (debug) */
  985. u8 trunked; /* Trunked or not (1 or 0) */
  986. u8 fec_state; /*!< State of FEC */
  987. u8 resvd[6];
  988. struct bfa_qos_attr_s qos_attr; /* QoS Attributes */
  989. union {
  990. struct bfa_fcport_loop_info_s loop_info;
  991. struct bfa_bbcr_attr_s bbcr_attr;
  992. union {
  993. struct bfa_qos_vc_attr_s qos_vc_attr;
  994. /* VC info from ELP */
  995. struct bfa_trunk_vc_attr_s trunk_vc_attr;
  996. struct bfa_fcport_fcf_s fcf;
  997. /* FCF information (for FCoE) */
  998. } vc_fcf;
  999. } attr;
  1000. };
  1001. #pragma pack()
  1002. enum bfa_trunk_link_fctl {
  1003. BFA_TRUNK_LINK_FCTL_NORMAL,
  1004. BFA_TRUNK_LINK_FCTL_VC,
  1005. BFA_TRUNK_LINK_FCTL_VC_QOS,
  1006. };
  1007. enum bfa_trunk_link_state {
  1008. BFA_TRUNK_LINK_STATE_UP = 1, /* link part of trunk */
  1009. BFA_TRUNK_LINK_STATE_DN_LINKDN = 2, /* physical link down */
  1010. BFA_TRUNK_LINK_STATE_DN_GRP_MIS = 3, /* trunk group different */
  1011. BFA_TRUNK_LINK_STATE_DN_SPD_MIS = 4, /* speed mismatch */
  1012. BFA_TRUNK_LINK_STATE_DN_MODE_MIS = 5, /* remote port not trunked */
  1013. };
  1014. #define BFA_TRUNK_MAX_PORTS 2
  1015. struct bfa_trunk_link_attr_s {
  1016. wwn_t trunk_wwn;
  1017. enum bfa_trunk_link_fctl fctl;
  1018. enum bfa_trunk_link_state link_state;
  1019. enum bfa_port_speed speed;
  1020. u32 deskew;
  1021. };
  1022. struct bfa_trunk_attr_s {
  1023. enum bfa_trunk_state state;
  1024. enum bfa_port_speed speed;
  1025. u32 port_id;
  1026. u32 rsvd;
  1027. struct bfa_trunk_link_attr_s link_attr[BFA_TRUNK_MAX_PORTS];
  1028. };
  1029. struct bfa_rport_hal_stats_s {
  1030. u32 sm_un_cr; /* uninit: create events */
  1031. u32 sm_un_unexp; /* uninit: exception events */
  1032. u32 sm_cr_on; /* created: online events */
  1033. u32 sm_cr_del; /* created: delete events */
  1034. u32 sm_cr_hwf; /* created: IOC down */
  1035. u32 sm_cr_unexp; /* created: exception events */
  1036. u32 sm_fwc_rsp; /* fw create: f/w responses */
  1037. u32 sm_fwc_del; /* fw create: delete events */
  1038. u32 sm_fwc_off; /* fw create: offline events */
  1039. u32 sm_fwc_hwf; /* fw create: IOC down */
  1040. u32 sm_fwc_unexp; /* fw create: exception events*/
  1041. u32 sm_on_off; /* online: offline events */
  1042. u32 sm_on_del; /* online: delete events */
  1043. u32 sm_on_hwf; /* online: IOC down events */
  1044. u32 sm_on_unexp; /* online: exception events */
  1045. u32 sm_fwd_rsp; /* fw delete: fw responses */
  1046. u32 sm_fwd_del; /* fw delete: delete events */
  1047. u32 sm_fwd_hwf; /* fw delete: IOC down events */
  1048. u32 sm_fwd_unexp; /* fw delete: exception events*/
  1049. u32 sm_off_del; /* offline: delete events */
  1050. u32 sm_off_on; /* offline: online events */
  1051. u32 sm_off_hwf; /* offline: IOC down events */
  1052. u32 sm_off_unexp; /* offline: exception events */
  1053. u32 sm_del_fwrsp; /* delete: fw responses */
  1054. u32 sm_del_hwf; /* delete: IOC down events */
  1055. u32 sm_del_unexp; /* delete: exception events */
  1056. u32 sm_delp_fwrsp; /* delete pend: fw responses */
  1057. u32 sm_delp_hwf; /* delete pend: IOC downs */
  1058. u32 sm_delp_unexp; /* delete pend: exceptions */
  1059. u32 sm_offp_fwrsp; /* off-pending: fw responses */
  1060. u32 sm_offp_del; /* off-pending: deletes */
  1061. u32 sm_offp_hwf; /* off-pending: IOC downs */
  1062. u32 sm_offp_unexp; /* off-pending: exceptions */
  1063. u32 sm_iocd_off; /* IOC down: offline events */
  1064. u32 sm_iocd_del; /* IOC down: delete events */
  1065. u32 sm_iocd_on; /* IOC down: online events */
  1066. u32 sm_iocd_unexp; /* IOC down: exceptions */
  1067. u32 rsvd;
  1068. };
  1069. #pragma pack(1)
  1070. /*
  1071. * Rport's QoS attributes
  1072. */
  1073. struct bfa_rport_qos_attr_s {
  1074. u8 qos_priority; /* rport's QoS priority */
  1075. u8 rsvd[3];
  1076. u32 qos_flow_id; /* QoS flow Id */
  1077. };
  1078. #pragma pack()
  1079. #define BFA_IOBUCKET_MAX 14
  1080. struct bfa_itnim_latency_s {
  1081. u32 min[BFA_IOBUCKET_MAX];
  1082. u32 max[BFA_IOBUCKET_MAX];
  1083. u32 count[BFA_IOBUCKET_MAX];
  1084. u32 avg[BFA_IOBUCKET_MAX];
  1085. };
  1086. struct bfa_itnim_ioprofile_s {
  1087. u32 clock_res_mul;
  1088. u32 clock_res_div;
  1089. u32 index;
  1090. u32 io_profile_start_time; /* IO profile start time */
  1091. u32 iocomps[BFA_IOBUCKET_MAX]; /* IO completed */
  1092. struct bfa_itnim_latency_s io_latency;
  1093. };
  1094. /*
  1095. * vHBA port attribute values.
  1096. */
  1097. struct bfa_vhba_attr_s {
  1098. wwn_t nwwn; /* node wwn */
  1099. wwn_t pwwn; /* port wwn */
  1100. u32 pid; /* port ID */
  1101. bfa_boolean_t io_profile; /* get it from fcpim mod */
  1102. bfa_boolean_t plog_enabled; /* portlog is enabled */
  1103. u16 path_tov;
  1104. u8 rsvd[2];
  1105. };
  1106. /*
  1107. * FC physical port statistics.
  1108. */
  1109. struct bfa_port_fc_stats_s {
  1110. u64 secs_reset; /* Seconds since stats is reset */
  1111. u64 tx_frames; /* Tx frames */
  1112. u64 tx_words; /* Tx words */
  1113. u64 tx_lip; /* Tx LIP */
  1114. u64 tx_lip_f7f7; /* Tx LIP_F7F7 */
  1115. u64 tx_lip_f8f7; /* Tx LIP_F8F7 */
  1116. u64 tx_arbf0; /* Tx ARB F0 */
  1117. u64 tx_nos; /* Tx NOS */
  1118. u64 tx_ols; /* Tx OLS */
  1119. u64 tx_lr; /* Tx LR */
  1120. u64 tx_lrr; /* Tx LRR */
  1121. u64 rx_frames; /* Rx frames */
  1122. u64 rx_words; /* Rx words */
  1123. u64 lip_count; /* Rx LIP */
  1124. u64 rx_lip_f7f7; /* Rx LIP_F7F7 */
  1125. u64 rx_lip_f8f7; /* Rx LIP_F8F7 */
  1126. u64 rx_arbf0; /* Rx ARB F0 */
  1127. u64 nos_count; /* Rx NOS */
  1128. u64 ols_count; /* Rx OLS */
  1129. u64 lr_count; /* Rx LR */
  1130. u64 lrr_count; /* Rx LRR */
  1131. u64 invalid_crcs; /* Rx CRC err frames */
  1132. u64 invalid_crc_gd_eof; /* Rx CRC err good EOF frames */
  1133. u64 undersized_frm; /* Rx undersized frames */
  1134. u64 oversized_frm; /* Rx oversized frames */
  1135. u64 bad_eof_frm; /* Rx frames with bad EOF */
  1136. u64 error_frames; /* Errored frames */
  1137. u64 dropped_frames; /* Dropped frames */
  1138. u64 link_failures; /* Link Failure (LF) count */
  1139. u64 loss_of_syncs; /* Loss of sync count */
  1140. u64 loss_of_signals; /* Loss of signal count */
  1141. u64 primseq_errs; /* Primitive sequence protocol err. */
  1142. u64 bad_os_count; /* Invalid ordered sets */
  1143. u64 err_enc_out; /* Encoding err nonframe_8b10b */
  1144. u64 err_enc; /* Encoding err frame_8b10b */
  1145. u64 bbcr_frames_lost; /*!< BBCR Frames Lost */
  1146. u64 bbcr_rrdys_lost; /*!< BBCR RRDYs Lost */
  1147. u64 bbcr_link_resets; /*!< BBCR Link Resets */
  1148. u64 bbcr_frame_lost_intrs; /*!< BBCR Frame loss intrs */
  1149. u64 bbcr_rrdy_lost_intrs; /*!< BBCR Rrdy loss intrs */
  1150. u64 loop_timeouts; /* Loop timeouts */
  1151. };
  1152. /*
  1153. * Eth Physical Port statistics.
  1154. */
  1155. struct bfa_port_eth_stats_s {
  1156. u64 secs_reset; /* Seconds since stats is reset */
  1157. u64 frame_64; /* Frames 64 bytes */
  1158. u64 frame_65_127; /* Frames 65-127 bytes */
  1159. u64 frame_128_255; /* Frames 128-255 bytes */
  1160. u64 frame_256_511; /* Frames 256-511 bytes */
  1161. u64 frame_512_1023; /* Frames 512-1023 bytes */
  1162. u64 frame_1024_1518; /* Frames 1024-1518 bytes */
  1163. u64 frame_1519_1522; /* Frames 1519-1522 bytes */
  1164. u64 tx_bytes; /* Tx bytes */
  1165. u64 tx_packets; /* Tx packets */
  1166. u64 tx_mcast_packets; /* Tx multicast packets */
  1167. u64 tx_bcast_packets; /* Tx broadcast packets */
  1168. u64 tx_control_frame; /* Tx control frame */
  1169. u64 tx_drop; /* Tx drops */
  1170. u64 tx_jabber; /* Tx jabber */
  1171. u64 tx_fcs_error; /* Tx FCS errors */
  1172. u64 tx_fragments; /* Tx fragments */
  1173. u64 rx_bytes; /* Rx bytes */
  1174. u64 rx_packets; /* Rx packets */
  1175. u64 rx_mcast_packets; /* Rx multicast packets */
  1176. u64 rx_bcast_packets; /* Rx broadcast packets */
  1177. u64 rx_control_frames; /* Rx control frames */
  1178. u64 rx_unknown_opcode; /* Rx unknown opcode */
  1179. u64 rx_drop; /* Rx drops */
  1180. u64 rx_jabber; /* Rx jabber */
  1181. u64 rx_fcs_error; /* Rx FCS errors */
  1182. u64 rx_alignment_error; /* Rx alignment errors */
  1183. u64 rx_frame_length_error; /* Rx frame len errors */
  1184. u64 rx_code_error; /* Rx code errors */
  1185. u64 rx_fragments; /* Rx fragments */
  1186. u64 rx_pause; /* Rx pause */
  1187. u64 rx_zero_pause; /* Rx zero pause */
  1188. u64 tx_pause; /* Tx pause */
  1189. u64 tx_zero_pause; /* Tx zero pause */
  1190. u64 rx_fcoe_pause; /* Rx FCoE pause */
  1191. u64 rx_fcoe_zero_pause; /* Rx FCoE zero pause */
  1192. u64 tx_fcoe_pause; /* Tx FCoE pause */
  1193. u64 tx_fcoe_zero_pause; /* Tx FCoE zero pause */
  1194. u64 rx_iscsi_pause; /* Rx iSCSI pause */
  1195. u64 rx_iscsi_zero_pause; /* Rx iSCSI zero pause */
  1196. u64 tx_iscsi_pause; /* Tx iSCSI pause */
  1197. u64 tx_iscsi_zero_pause; /* Tx iSCSI zero pause */
  1198. };
  1199. /*
  1200. * Port statistics.
  1201. */
  1202. union bfa_port_stats_u {
  1203. struct bfa_port_fc_stats_s fc;
  1204. struct bfa_port_eth_stats_s eth;
  1205. };
  1206. struct bfa_port_cfg_mode_s {
  1207. u16 max_pf;
  1208. u16 max_vf;
  1209. enum bfa_mode_s mode;
  1210. };
  1211. #pragma pack(1)
  1212. #define BFA_CEE_LLDP_MAX_STRING_LEN (128)
  1213. #define BFA_CEE_DCBX_MAX_PRIORITY (8)
  1214. #define BFA_CEE_DCBX_MAX_PGID (8)
  1215. struct bfa_cee_lldp_str_s {
  1216. u8 sub_type;
  1217. u8 len;
  1218. u8 rsvd[2];
  1219. u8 value[BFA_CEE_LLDP_MAX_STRING_LEN];
  1220. };
  1221. struct bfa_cee_lldp_cfg_s {
  1222. struct bfa_cee_lldp_str_s chassis_id;
  1223. struct bfa_cee_lldp_str_s port_id;
  1224. struct bfa_cee_lldp_str_s port_desc;
  1225. struct bfa_cee_lldp_str_s sys_name;
  1226. struct bfa_cee_lldp_str_s sys_desc;
  1227. struct bfa_cee_lldp_str_s mgmt_addr;
  1228. u16 time_to_live;
  1229. u16 enabled_system_cap;
  1230. };
  1231. /* CEE/DCBX parameters */
  1232. struct bfa_cee_dcbx_cfg_s {
  1233. u8 pgid[BFA_CEE_DCBX_MAX_PRIORITY];
  1234. u8 pg_percentage[BFA_CEE_DCBX_MAX_PGID];
  1235. u8 pfc_primap; /* bitmap of priorties with PFC enabled */
  1236. u8 fcoe_primap; /* bitmap of priorities used for FcoE traffic */
  1237. u8 iscsi_primap; /* bitmap of priorities used for iSCSI traffic */
  1238. u8 dcbx_version; /* operating version:CEE or preCEE */
  1239. u8 lls_fcoe; /* FCoE Logical Link Status */
  1240. u8 lls_lan; /* LAN Logical Link Status */
  1241. u8 rsvd[2];
  1242. };
  1243. /* CEE Query */
  1244. struct bfa_cee_attr_s {
  1245. u8 cee_status;
  1246. u8 error_reason;
  1247. struct bfa_cee_lldp_cfg_s lldp_remote;
  1248. struct bfa_cee_dcbx_cfg_s dcbx_remote;
  1249. mac_t src_mac;
  1250. u8 link_speed;
  1251. u8 nw_priority;
  1252. u8 filler[2];
  1253. };
  1254. /* LLDP/DCBX/CEE Statistics */
  1255. struct bfa_cee_stats_s {
  1256. u32 lldp_tx_frames; /* LLDP Tx Frames */
  1257. u32 lldp_rx_frames; /* LLDP Rx Frames */
  1258. u32 lldp_rx_frames_invalid; /* LLDP Rx Frames invalid */
  1259. u32 lldp_rx_frames_new; /* LLDP Rx Frames new */
  1260. u32 lldp_tlvs_unrecognized; /* LLDP Rx unrecog. TLVs */
  1261. u32 lldp_rx_shutdown_tlvs; /* LLDP Rx shutdown TLVs */
  1262. u32 lldp_info_aged_out; /* LLDP remote info aged */
  1263. u32 dcbx_phylink_ups; /* DCBX phy link ups */
  1264. u32 dcbx_phylink_downs; /* DCBX phy link downs */
  1265. u32 dcbx_rx_tlvs; /* DCBX Rx TLVs */
  1266. u32 dcbx_rx_tlvs_invalid; /* DCBX Rx TLVs invalid */
  1267. u32 dcbx_control_tlv_error; /* DCBX control TLV errors */
  1268. u32 dcbx_feature_tlv_error; /* DCBX feature TLV errors */
  1269. u32 dcbx_cee_cfg_new; /* DCBX new CEE cfg rcvd */
  1270. u32 cee_status_down; /* DCB status down */
  1271. u32 cee_status_up; /* DCB status up */
  1272. u32 cee_hw_cfg_changed; /* DCB hw cfg changed */
  1273. u32 cee_rx_invalid_cfg; /* DCB invalid cfg */
  1274. };
  1275. #pragma pack()
  1276. /*
  1277. * AEN related definitions
  1278. */
  1279. #define BFAD_NL_VENDOR_ID (((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) \
  1280. | BFA_PCI_VENDOR_ID_BROCADE)
  1281. /* BFA remote port events */
  1282. enum bfa_rport_aen_event {
  1283. BFA_RPORT_AEN_ONLINE = 1, /* RPort online event */
  1284. BFA_RPORT_AEN_OFFLINE = 2, /* RPort offline event */
  1285. BFA_RPORT_AEN_DISCONNECT = 3, /* RPort disconnect event */
  1286. BFA_RPORT_AEN_QOS_PRIO = 4, /* QOS priority change event */
  1287. BFA_RPORT_AEN_QOS_FLOWID = 5, /* QOS flow Id change event */
  1288. };
  1289. struct bfa_rport_aen_data_s {
  1290. u16 vf_id; /* vf_id of this logical port */
  1291. u16 rsvd[3];
  1292. wwn_t ppwwn; /* WWN of its physical port */
  1293. wwn_t lpwwn; /* WWN of this logical port */
  1294. wwn_t rpwwn; /* WWN of this remote port */
  1295. union {
  1296. struct bfa_rport_qos_attr_s qos;
  1297. } priv;
  1298. };
  1299. union bfa_aen_data_u {
  1300. struct bfa_adapter_aen_data_s adapter;
  1301. struct bfa_port_aen_data_s port;
  1302. struct bfa_lport_aen_data_s lport;
  1303. struct bfa_rport_aen_data_s rport;
  1304. struct bfa_itnim_aen_data_s itnim;
  1305. struct bfa_audit_aen_data_s audit;
  1306. struct bfa_ioc_aen_data_s ioc;
  1307. };
  1308. #define BFA_AEN_MAX_ENTRY 512
  1309. struct bfa_aen_entry_s {
  1310. struct list_head qe;
  1311. enum bfa_aen_category aen_category;
  1312. int aen_type;
  1313. union bfa_aen_data_u aen_data;
  1314. u64 aen_tv_sec;
  1315. u64 aen_tv_usec;
  1316. u32 seq_num;
  1317. u32 bfad_num;
  1318. };
  1319. #endif /* __BFA_DEFS_SVC_H__ */