bfa_defs_svc.h 47 KB

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