bfa_defs_svc.h 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329
  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. u32 bbsc_lr; /* LKSM LR tx for credit recovery */
  236. };
  237. struct bfa_fw_port_snsm_stats_s {
  238. u32 hwsm_success; /* Successful hwsm terminations */
  239. u32 hwsm_fails; /* hwsm fail count */
  240. u32 hwsm_wdtov; /* hwsm timed out */
  241. u32 swsm_success; /* swsm success */
  242. u32 swsm_wdtov; /* swsm timed out */
  243. u32 error_resets; /* error resets initiated by upsm */
  244. u32 sync_lost; /* Sync loss count */
  245. u32 sig_lost; /* Signal loss count */
  246. u32 asn8g_attempts; /* SNSM HWSM at 8Gbps attempts */
  247. };
  248. struct bfa_fw_port_physm_stats_s {
  249. u32 module_inserts; /* Module insert count */
  250. u32 module_xtracts; /* Module extracts count */
  251. u32 module_invalids; /* Invalid module inserted count */
  252. u32 module_read_ign; /* Module validation status ignored */
  253. u32 laser_faults; /* Laser fault count */
  254. u32 rsvd;
  255. };
  256. struct bfa_fw_fip_stats_s {
  257. u32 vlan_req; /* vlan discovery requests */
  258. u32 vlan_notify; /* vlan notifications */
  259. u32 vlan_err; /* vlan response error */
  260. u32 vlan_timeouts; /* vlan disvoery timeouts */
  261. u32 vlan_invalids; /* invalid vlan in discovery advert. */
  262. u32 disc_req; /* Discovery solicit requests */
  263. u32 disc_rsp; /* Discovery solicit response */
  264. u32 disc_err; /* Discovery advt. parse errors */
  265. u32 disc_unsol; /* Discovery unsolicited */
  266. u32 disc_timeouts; /* Discovery timeouts */
  267. u32 disc_fcf_unavail; /* Discovery FCF Not Avail. */
  268. u32 linksvc_unsupp; /* Unsupported link service req */
  269. u32 linksvc_err; /* Parse error in link service req */
  270. u32 logo_req; /* FIP logos received */
  271. u32 clrvlink_req; /* Clear virtual link req */
  272. u32 op_unsupp; /* Unsupported FIP operation */
  273. u32 untagged; /* Untagged frames (ignored) */
  274. u32 invalid_version; /* Invalid FIP version */
  275. };
  276. struct bfa_fw_lps_stats_s {
  277. u32 mac_invalids; /* Invalid mac assigned */
  278. u32 rsvd;
  279. };
  280. struct bfa_fw_fcoe_stats_s {
  281. u32 cee_linkups; /* CEE link up count */
  282. u32 cee_linkdns; /* CEE link down count */
  283. u32 fip_linkups; /* FIP link up count */
  284. u32 fip_linkdns; /* FIP link up count */
  285. u32 fip_fails; /* FIP fail count */
  286. u32 mac_invalids; /* Invalid mac assigned */
  287. };
  288. /*
  289. * IOC firmware FCoE port stats
  290. */
  291. struct bfa_fw_fcoe_port_stats_s {
  292. struct bfa_fw_fcoe_stats_s fcoe_stats;
  293. struct bfa_fw_fip_stats_s fip_stats;
  294. };
  295. /*
  296. * IOC firmware FC uport stats
  297. */
  298. struct bfa_fw_fc_uport_stats_s {
  299. struct bfa_fw_port_snsm_stats_s snsm_stats;
  300. struct bfa_fw_port_lksm_stats_s lksm_stats;
  301. };
  302. /*
  303. * IOC firmware FC port stats
  304. */
  305. union bfa_fw_fc_port_stats_s {
  306. struct bfa_fw_fc_uport_stats_s fc_stats;
  307. struct bfa_fw_fcoe_port_stats_s fcoe_stats;
  308. };
  309. /*
  310. * IOC firmware port stats
  311. */
  312. struct bfa_fw_port_stats_s {
  313. struct bfa_fw_port_fpg_stats_s fpg_stats;
  314. struct bfa_fw_port_physm_stats_s physm_stats;
  315. union bfa_fw_fc_port_stats_s fc_port;
  316. };
  317. /*
  318. * fcxchg module statistics
  319. */
  320. struct bfa_fw_fcxchg_stats_s {
  321. u32 ua_tag_inv;
  322. u32 ua_state_inv;
  323. };
  324. struct bfa_fw_lpsm_stats_s {
  325. u32 cls_rx;
  326. u32 cls_tx;
  327. };
  328. /*
  329. * Trunk statistics
  330. */
  331. struct bfa_fw_trunk_stats_s {
  332. u32 emt_recvd; /* Trunk EMT received */
  333. u32 emt_accepted; /* Trunk EMT Accepted */
  334. u32 emt_rejected; /* Trunk EMT rejected */
  335. u32 etp_recvd; /* Trunk ETP received */
  336. u32 etp_accepted; /* Trunk ETP Accepted */
  337. u32 etp_rejected; /* Trunk ETP rejected */
  338. u32 lr_recvd; /* Trunk LR received */
  339. u32 rsvd; /* padding for 64 bit alignment */
  340. };
  341. struct bfa_fw_advsm_stats_s {
  342. u32 flogi_sent; /* Flogi sent */
  343. u32 flogi_acc_recvd; /* Flogi Acc received */
  344. u32 flogi_rjt_recvd; /* Flogi rejects received */
  345. u32 flogi_retries; /* Flogi retries */
  346. u32 elp_recvd; /* ELP received */
  347. u32 elp_accepted; /* ELP Accepted */
  348. u32 elp_rejected; /* ELP rejected */
  349. u32 elp_dropped; /* ELP dropped */
  350. };
  351. /*
  352. * IOCFC firmware stats
  353. */
  354. struct bfa_fw_iocfc_stats_s {
  355. u32 cfg_reqs; /* cfg request */
  356. u32 updq_reqs; /* update queue request */
  357. u32 ic_reqs; /* interrupt coalesce reqs */
  358. u32 unknown_reqs;
  359. u32 set_intr_reqs; /* set interrupt reqs */
  360. };
  361. /*
  362. * IOC attributes returned in queries
  363. */
  364. struct bfa_iocfc_attr_s {
  365. struct bfa_iocfc_cfg_s config; /* IOCFC config */
  366. struct bfa_iocfc_intr_attr_s intr_attr; /* interrupt attr */
  367. };
  368. /*
  369. * Eth_sndrcv mod stats
  370. */
  371. struct bfa_fw_eth_sndrcv_stats_s {
  372. u32 crc_err;
  373. u32 rsvd; /* 64bit align */
  374. };
  375. /*
  376. * CT MAC mod stats
  377. */
  378. struct bfa_fw_mac_mod_stats_s {
  379. u32 mac_on; /* MAC got turned-on */
  380. u32 link_up; /* link-up */
  381. u32 signal_off; /* lost signal */
  382. u32 dfe_on; /* DFE on */
  383. u32 mac_reset; /* # of MAC reset to bring lnk up */
  384. u32 pcs_reset; /* # of PCS reset to bring lnk up */
  385. u32 loopback; /* MAC got into serdes loopback */
  386. u32 lb_mac_reset;
  387. /* # of MAC reset to bring link up in loopback */
  388. u32 lb_pcs_reset;
  389. /* # of PCS reset to bring link up in loopback */
  390. u32 rsvd; /* 64bit align */
  391. };
  392. /*
  393. * CT MOD stats
  394. */
  395. struct bfa_fw_ct_mod_stats_s {
  396. u32 rxa_rds_undrun; /* RxA RDS underrun */
  397. u32 rad_bpc_ovfl; /* RAD BPC overflow */
  398. u32 rad_rlb_bpc_ovfl; /* RAD RLB BPC overflow */
  399. u32 bpc_fcs_err; /* BPC FCS_ERR */
  400. u32 txa_tso_hdr; /* TxA TSO header too long */
  401. u32 rsvd; /* 64bit align */
  402. };
  403. /*
  404. * IOC firmware stats
  405. */
  406. struct bfa_fw_stats_s {
  407. struct bfa_fw_ioc_stats_s ioc_stats;
  408. struct bfa_fw_iocfc_stats_s iocfc_stats;
  409. struct bfa_fw_io_stats_s io_stats;
  410. struct bfa_fw_port_stats_s port_stats;
  411. struct bfa_fw_fcxchg_stats_s fcxchg_stats;
  412. struct bfa_fw_lpsm_stats_s lpsm_stats;
  413. struct bfa_fw_lps_stats_s lps_stats;
  414. struct bfa_fw_trunk_stats_s trunk_stats;
  415. struct bfa_fw_advsm_stats_s advsm_stats;
  416. struct bfa_fw_mac_mod_stats_s macmod_stats;
  417. struct bfa_fw_ct_mod_stats_s ctmod_stats;
  418. struct bfa_fw_eth_sndrcv_stats_s ethsndrcv_stats;
  419. };
  420. #define BFA_IOCFC_PATHTOV_MAX 60
  421. #define BFA_IOCFC_QDEPTH_MAX 2000
  422. /*
  423. * QoS states
  424. */
  425. enum bfa_qos_state {
  426. BFA_QOS_DISABLED = 0, /* QoS is disabled */
  427. BFA_QOS_ONLINE = 1, /* QoS is online */
  428. BFA_QOS_OFFLINE = 2, /* QoS is offline */
  429. };
  430. /*
  431. * QoS Priority levels.
  432. */
  433. enum bfa_qos_priority {
  434. BFA_QOS_UNKNOWN = 0,
  435. BFA_QOS_HIGH = 1, /* QoS Priority Level High */
  436. BFA_QOS_MED = 2, /* QoS Priority Level Medium */
  437. BFA_QOS_LOW = 3, /* QoS Priority Level Low */
  438. };
  439. /*
  440. * QoS bandwidth allocation for each priority level
  441. */
  442. enum bfa_qos_bw_alloc {
  443. BFA_QOS_BW_HIGH = 60, /* bandwidth allocation for High */
  444. BFA_QOS_BW_MED = 30, /* bandwidth allocation for Medium */
  445. BFA_QOS_BW_LOW = 10, /* bandwidth allocation for Low */
  446. };
  447. #pragma pack(1)
  448. /*
  449. * QoS attribute returned in QoS Query
  450. */
  451. struct bfa_qos_attr_s {
  452. u8 state; /* QoS current state */
  453. u8 rsvd[3];
  454. u32 total_bb_cr; /* Total BB Credits */
  455. };
  456. /*
  457. * These fields should be displayed only from the CLI.
  458. * There will be a separate BFAL API (get_qos_vc_attr ?)
  459. * to retrieve this.
  460. *
  461. */
  462. #define BFA_QOS_MAX_VC 16
  463. struct bfa_qos_vc_info_s {
  464. u8 vc_credit;
  465. u8 borrow_credit;
  466. u8 priority;
  467. u8 resvd;
  468. };
  469. struct bfa_qos_vc_attr_s {
  470. u16 total_vc_count; /* Total VC Count */
  471. u16 shared_credit;
  472. u32 elp_opmode_flags;
  473. struct bfa_qos_vc_info_s vc_info[BFA_QOS_MAX_VC]; /* as many as
  474. * total_vc_count */
  475. };
  476. /*
  477. * QoS statistics
  478. */
  479. struct bfa_qos_stats_s {
  480. u32 flogi_sent; /* QoS Flogi sent */
  481. u32 flogi_acc_recvd; /* QoS Flogi Acc received */
  482. u32 flogi_rjt_recvd; /* QoS Flogi rejects received */
  483. u32 flogi_retries; /* QoS Flogi retries */
  484. u32 elp_recvd; /* QoS ELP received */
  485. u32 elp_accepted; /* QoS ELP Accepted */
  486. u32 elp_rejected; /* QoS ELP rejected */
  487. u32 elp_dropped; /* QoS ELP dropped */
  488. u32 qos_rscn_recvd; /* QoS RSCN received */
  489. u32 rsvd; /* padding for 64 bit alignment */
  490. };
  491. /*
  492. * FCoE statistics
  493. */
  494. struct bfa_fcoe_stats_s {
  495. u64 secs_reset; /* Seconds since stats reset */
  496. u64 cee_linkups; /* CEE link up */
  497. u64 cee_linkdns; /* CEE link down */
  498. u64 fip_linkups; /* FIP link up */
  499. u64 fip_linkdns; /* FIP link down */
  500. u64 fip_fails; /* FIP failures */
  501. u64 mac_invalids; /* Invalid mac assignments */
  502. u64 vlan_req; /* Vlan requests */
  503. u64 vlan_notify; /* Vlan notifications */
  504. u64 vlan_err; /* Vlan notification errors */
  505. u64 vlan_timeouts; /* Vlan request timeouts */
  506. u64 vlan_invalids; /* Vlan invalids */
  507. u64 disc_req; /* Discovery requests */
  508. u64 disc_rsp; /* Discovery responses */
  509. u64 disc_err; /* Discovery error frames */
  510. u64 disc_unsol; /* Discovery unsolicited */
  511. u64 disc_timeouts; /* Discovery timeouts */
  512. u64 disc_fcf_unavail; /* Discovery FCF not avail */
  513. u64 linksvc_unsupp; /* FIP link service req unsupp */
  514. u64 linksvc_err; /* FIP link service req errors */
  515. u64 logo_req; /* FIP logos received */
  516. u64 clrvlink_req; /* Clear virtual link requests */
  517. u64 op_unsupp; /* FIP operation unsupp. */
  518. u64 untagged; /* FIP untagged frames */
  519. u64 txf_ucast; /* Tx FCoE unicast frames */
  520. u64 txf_ucast_vlan; /* Tx FCoE unicast vlan frames */
  521. u64 txf_ucast_octets; /* Tx FCoE unicast octets */
  522. u64 txf_mcast; /* Tx FCoE multicast frames */
  523. u64 txf_mcast_vlan; /* Tx FCoE multicast vlan frames */
  524. u64 txf_mcast_octets; /* Tx FCoE multicast octets */
  525. u64 txf_bcast; /* Tx FCoE broadcast frames */
  526. u64 txf_bcast_vlan; /* Tx FCoE broadcast vlan frames */
  527. u64 txf_bcast_octets; /* Tx FCoE broadcast octets */
  528. u64 txf_timeout; /* Tx timeouts */
  529. u64 txf_parity_errors; /* Transmit parity err */
  530. u64 txf_fid_parity_errors; /* Transmit FID parity err */
  531. u64 rxf_ucast_octets; /* Rx FCoE unicast octets */
  532. u64 rxf_ucast; /* Rx FCoE unicast frames */
  533. u64 rxf_ucast_vlan; /* Rx FCoE unicast vlan frames */
  534. u64 rxf_mcast_octets; /* Rx FCoE multicast octets */
  535. u64 rxf_mcast; /* Rx FCoE multicast frames */
  536. u64 rxf_mcast_vlan; /* Rx FCoE multicast vlan frames */
  537. u64 rxf_bcast_octets; /* Rx FCoE broadcast octets */
  538. u64 rxf_bcast; /* Rx FCoE broadcast frames */
  539. u64 rxf_bcast_vlan; /* Rx FCoE broadcast vlan frames */
  540. };
  541. /*
  542. * QoS or FCoE stats (fcport stats excluding physical FC port stats)
  543. */
  544. union bfa_fcport_stats_u {
  545. struct bfa_qos_stats_s fcqos;
  546. struct bfa_fcoe_stats_s fcoe;
  547. };
  548. #pragma pack()
  549. struct bfa_fcpim_del_itn_stats_s {
  550. u32 del_itn_iocomp_aborted; /* Aborted IO requests */
  551. u32 del_itn_iocomp_timedout; /* IO timeouts */
  552. u32 del_itn_iocom_sqer_needed; /* IO retry for SQ error recovery */
  553. u32 del_itn_iocom_res_free; /* Delayed freeing of IO resources */
  554. u32 del_itn_iocom_hostabrts; /* Host IO abort requests */
  555. u32 del_itn_total_ios; /* Total IO count */
  556. u32 del_io_iocdowns; /* IO cleaned-up due to IOC down */
  557. u32 del_tm_iocdowns; /* TM cleaned-up due to IOC down */
  558. };
  559. struct bfa_itnim_iostats_s {
  560. u32 total_ios; /* Total IO Requests */
  561. u32 input_reqs; /* Data in-bound requests */
  562. u32 output_reqs; /* Data out-bound requests */
  563. u32 io_comps; /* Total IO Completions */
  564. u32 wr_throughput; /* Write data transferred in bytes */
  565. u32 rd_throughput; /* Read data transferred in bytes */
  566. u32 iocomp_ok; /* Slowpath IO completions */
  567. u32 iocomp_underrun; /* IO underrun */
  568. u32 iocomp_overrun; /* IO overrun */
  569. u32 qwait; /* IO Request-Q wait */
  570. u32 qresumes; /* IO Request-Q wait done */
  571. u32 no_iotags; /* No free IO tag */
  572. u32 iocomp_timedout; /* IO timeouts */
  573. u32 iocom_nexus_abort; /* IO failure due to target offline */
  574. u32 iocom_proto_err; /* IO protocol errors */
  575. u32 iocom_dif_err; /* IO SBC-3 protection errors */
  576. u32 iocom_sqer_needed; /* fcp-2 error recovery failed */
  577. u32 iocom_res_free; /* Delayed freeing of IO tag */
  578. u32 io_aborts; /* Host IO abort requests */
  579. u32 iocom_hostabrts; /* Host IO abort completions */
  580. u32 io_cleanups; /* IO clean-up requests */
  581. u32 path_tov_expired; /* IO path tov expired */
  582. u32 iocomp_aborted; /* IO abort completions */
  583. u32 io_iocdowns; /* IO cleaned-up due to IOC down */
  584. u32 iocom_utags; /* IO comp with unknown tags */
  585. u32 io_tmaborts; /* Abort request due to TM command */
  586. u32 tm_io_comps; /* Abort completion due to TM command */
  587. u32 creates; /* IT Nexus create requests */
  588. u32 fw_create; /* IT Nexus FW create requests */
  589. u32 create_comps; /* IT Nexus FW create completions */
  590. u32 onlines; /* IT Nexus onlines */
  591. u32 offlines; /* IT Nexus offlines */
  592. u32 fw_delete; /* IT Nexus FW delete requests */
  593. u32 delete_comps; /* IT Nexus FW delete completions */
  594. u32 deletes; /* IT Nexus delete requests */
  595. u32 sler_events; /* SLER events */
  596. u32 ioc_disabled; /* Num IOC disables */
  597. u32 cleanup_comps; /* IT Nexus cleanup completions */
  598. u32 tm_cmnds; /* TM Requests */
  599. u32 tm_fw_rsps; /* TM Completions */
  600. u32 tm_success; /* TM initiated IO cleanup success */
  601. u32 tm_failures; /* TM initiated IO cleanup failure */
  602. u32 no_tskims; /* No free TM tag */
  603. u32 tm_qwait; /* TM Request-Q wait */
  604. u32 tm_qresumes; /* TM Request-Q wait done */
  605. u32 tm_iocdowns; /* TM cleaned-up due to IOC down */
  606. u32 tm_cleanups; /* TM cleanup requests */
  607. u32 tm_cleanup_comps; /* TM cleanup completions */
  608. u32 rsvd[6];
  609. };
  610. /* Modify char* port_stt[] in bfal_port.c if a new state was added */
  611. enum bfa_port_states {
  612. BFA_PORT_ST_UNINIT = 1,
  613. BFA_PORT_ST_ENABLING_QWAIT = 2,
  614. BFA_PORT_ST_ENABLING = 3,
  615. BFA_PORT_ST_LINKDOWN = 4,
  616. BFA_PORT_ST_LINKUP = 5,
  617. BFA_PORT_ST_DISABLING_QWAIT = 6,
  618. BFA_PORT_ST_DISABLING = 7,
  619. BFA_PORT_ST_DISABLED = 8,
  620. BFA_PORT_ST_STOPPED = 9,
  621. BFA_PORT_ST_IOCDOWN = 10,
  622. BFA_PORT_ST_IOCDIS = 11,
  623. BFA_PORT_ST_FWMISMATCH = 12,
  624. BFA_PORT_ST_PREBOOT_DISABLED = 13,
  625. BFA_PORT_ST_TOGGLING_QWAIT = 14,
  626. BFA_PORT_ST_ACQ_ADDR = 15,
  627. BFA_PORT_ST_MAX_STATE,
  628. };
  629. /*
  630. * Port operational type (in sync with SNIA port type).
  631. */
  632. enum bfa_port_type {
  633. BFA_PORT_TYPE_UNKNOWN = 1, /* port type is unknown */
  634. BFA_PORT_TYPE_NPORT = 5, /* P2P with switched fabric */
  635. BFA_PORT_TYPE_NLPORT = 6, /* public loop */
  636. BFA_PORT_TYPE_LPORT = 20, /* private loop */
  637. BFA_PORT_TYPE_P2P = 21, /* P2P with no switched fabric */
  638. BFA_PORT_TYPE_VPORT = 22, /* NPIV - virtual port */
  639. };
  640. /*
  641. * Port topology setting. A port's topology and fabric login status
  642. * determine its operational type.
  643. */
  644. enum bfa_port_topology {
  645. BFA_PORT_TOPOLOGY_NONE = 0, /* No valid topology */
  646. BFA_PORT_TOPOLOGY_P2P = 1, /* P2P only */
  647. BFA_PORT_TOPOLOGY_LOOP = 2, /* LOOP topology */
  648. BFA_PORT_TOPOLOGY_AUTO = 3, /* auto topology selection */
  649. };
  650. /*
  651. * Physical port loopback types.
  652. */
  653. enum bfa_port_opmode {
  654. BFA_PORT_OPMODE_NORMAL = 0x00, /* normal non-loopback mode */
  655. BFA_PORT_OPMODE_LB_INT = 0x01, /* internal loop back */
  656. BFA_PORT_OPMODE_LB_SLW = 0x02, /* serial link wrapback (serdes) */
  657. BFA_PORT_OPMODE_LB_EXT = 0x04, /* external loop back (serdes) */
  658. BFA_PORT_OPMODE_LB_CBL = 0x08, /* cabled loop back */
  659. BFA_PORT_OPMODE_LB_NLINT = 0x20, /* NL_Port internal loopback */
  660. };
  661. #define BFA_PORT_OPMODE_LB_HARD(_mode) \
  662. ((_mode == BFA_PORT_OPMODE_LB_INT) || \
  663. (_mode == BFA_PORT_OPMODE_LB_SLW) || \
  664. (_mode == BFA_PORT_OPMODE_LB_EXT))
  665. /*
  666. * Port link state
  667. */
  668. enum bfa_port_linkstate {
  669. BFA_PORT_LINKUP = 1, /* Physical port/Trunk link up */
  670. BFA_PORT_LINKDOWN = 2, /* Physical port/Trunk link down */
  671. };
  672. /*
  673. * Port link state reason code
  674. */
  675. enum bfa_port_linkstate_rsn {
  676. BFA_PORT_LINKSTATE_RSN_NONE = 0,
  677. BFA_PORT_LINKSTATE_RSN_DISABLED = 1,
  678. BFA_PORT_LINKSTATE_RSN_RX_NOS = 2,
  679. BFA_PORT_LINKSTATE_RSN_RX_OLS = 3,
  680. BFA_PORT_LINKSTATE_RSN_RX_LIP = 4,
  681. BFA_PORT_LINKSTATE_RSN_RX_LIPF7 = 5,
  682. BFA_PORT_LINKSTATE_RSN_SFP_REMOVED = 6,
  683. BFA_PORT_LINKSTATE_RSN_PORT_FAULT = 7,
  684. BFA_PORT_LINKSTATE_RSN_RX_LOS = 8,
  685. BFA_PORT_LINKSTATE_RSN_LOCAL_FAULT = 9,
  686. BFA_PORT_LINKSTATE_RSN_REMOTE_FAULT = 10,
  687. BFA_PORT_LINKSTATE_RSN_TIMEOUT = 11,
  688. /* CEE related reason codes/errors */
  689. CEE_LLDP_INFO_AGED_OUT = 20,
  690. CEE_LLDP_SHUTDOWN_TLV_RCVD = 21,
  691. CEE_PEER_NOT_ADVERTISE_DCBX = 22,
  692. CEE_PEER_NOT_ADVERTISE_PG = 23,
  693. CEE_PEER_NOT_ADVERTISE_PFC = 24,
  694. CEE_PEER_NOT_ADVERTISE_FCOE = 25,
  695. CEE_PG_NOT_COMPATIBLE = 26,
  696. CEE_PFC_NOT_COMPATIBLE = 27,
  697. CEE_FCOE_NOT_COMPATIBLE = 28,
  698. CEE_BAD_PG_RCVD = 29,
  699. CEE_BAD_BW_RCVD = 30,
  700. CEE_BAD_PFC_RCVD = 31,
  701. CEE_BAD_APP_PRI_RCVD = 32,
  702. CEE_FCOE_PRI_PFC_OFF = 33,
  703. CEE_DUP_CONTROL_TLV_RCVD = 34,
  704. CEE_DUP_FEAT_TLV_RCVD = 35,
  705. CEE_APPLY_NEW_CFG = 36, /* reason, not error */
  706. CEE_PROTOCOL_INIT = 37, /* reason, not error */
  707. CEE_PHY_LINK_DOWN = 38,
  708. CEE_LLS_FCOE_ABSENT = 39,
  709. CEE_LLS_FCOE_DOWN = 40,
  710. CEE_ISCSI_NOT_COMPATIBLE = 41,
  711. CEE_ISCSI_PRI_PFC_OFF = 42,
  712. CEE_ISCSI_PRI_OVERLAP_FCOE_PRI = 43
  713. };
  714. #define MAX_LUN_MASK_CFG 16
  715. /*
  716. * Initially flash content may be fff. On making LUN mask enable and disable
  717. * state chnage. when report lun command is being processed it goes from
  718. * BFA_LUN_MASK_ACTIVE to BFA_LUN_MASK_FETCH and comes back to
  719. * BFA_LUN_MASK_ACTIVE.
  720. */
  721. enum bfa_ioim_lun_mask_state_s {
  722. BFA_IOIM_LUN_MASK_INACTIVE = 0,
  723. BFA_IOIM_LUN_MASK_ACTIVE = 1,
  724. BFA_IOIM_LUN_MASK_FETCHED = 2,
  725. };
  726. enum bfa_lunmask_state_s {
  727. BFA_LUNMASK_DISABLED = 0x00,
  728. BFA_LUNMASK_ENABLED = 0x01,
  729. BFA_LUNMASK_MINCFG = 0x02,
  730. BFA_LUNMASK_UNINITIALIZED = 0xff,
  731. };
  732. #pragma pack(1)
  733. /*
  734. * LUN mask configuration
  735. */
  736. struct bfa_lun_mask_s {
  737. wwn_t lp_wwn;
  738. wwn_t rp_wwn;
  739. struct scsi_lun lun;
  740. u8 ua;
  741. u8 rsvd[3];
  742. u16 rp_tag;
  743. u8 lp_tag;
  744. u8 state;
  745. };
  746. #define MAX_LUN_MASK_CFG 16
  747. struct bfa_lunmask_cfg_s {
  748. u32 status;
  749. u32 rsvd;
  750. struct bfa_lun_mask_s lun_list[MAX_LUN_MASK_CFG];
  751. };
  752. /*
  753. * Physical port configuration
  754. */
  755. struct bfa_port_cfg_s {
  756. u8 topology; /* bfa_port_topology */
  757. u8 speed; /* enum bfa_port_speed */
  758. u8 trunked; /* trunked or not */
  759. u8 qos_enabled; /* qos enabled or not */
  760. u8 cfg_hardalpa; /* is hard alpa configured */
  761. u8 hardalpa; /* configured hard alpa */
  762. __be16 maxfrsize; /* maximum frame size */
  763. u8 rx_bbcredit; /* receive buffer credits */
  764. u8 tx_bbcredit; /* transmit buffer credits */
  765. u8 ratelimit; /* ratelimit enabled or not */
  766. u8 trl_def_speed; /* ratelimit default speed */
  767. u8 bb_scn; /* BB_SCN value from FLOGI Exchg */
  768. u8 bb_scn_state; /* Config state of BB_SCN */
  769. u8 faa_state; /* FAA enabled/disabled */
  770. u8 rsvd[1];
  771. u16 path_tov; /* device path timeout */
  772. u16 q_depth; /* SCSI Queue depth */
  773. };
  774. #pragma pack()
  775. /*
  776. * Port attribute values.
  777. */
  778. struct bfa_port_attr_s {
  779. /*
  780. * Static fields
  781. */
  782. wwn_t nwwn; /* node wwn */
  783. wwn_t pwwn; /* port wwn */
  784. wwn_t factorynwwn; /* factory node wwn */
  785. wwn_t factorypwwn; /* factory port wwn */
  786. enum fc_cos cos_supported; /* supported class of
  787. * services */
  788. u32 rsvd;
  789. struct fc_symname_s port_symname; /* port symbolic name */
  790. enum bfa_port_speed speed_supported; /* supported speeds */
  791. bfa_boolean_t pbind_enabled;
  792. /*
  793. * Configured values
  794. */
  795. struct bfa_port_cfg_s pport_cfg; /* pport cfg */
  796. /*
  797. * Dynamic field - info from BFA
  798. */
  799. enum bfa_port_states port_state; /* current port state */
  800. enum bfa_port_speed speed; /* current speed */
  801. enum bfa_port_topology topology; /* current topology */
  802. bfa_boolean_t beacon; /* current beacon status */
  803. bfa_boolean_t link_e2e_beacon; /* link beacon is on */
  804. bfa_boolean_t bbsc_op_status; /* fc credit recovery oper
  805. * state */
  806. /*
  807. * Dynamic field - info from FCS
  808. */
  809. u32 pid; /* port ID */
  810. enum bfa_port_type port_type; /* current topology */
  811. u32 loopback; /* external loopback */
  812. u32 authfail; /* auth fail state */
  813. /* FCoE specific */
  814. u16 fcoe_vlan;
  815. u8 rsvd1[2];
  816. };
  817. /*
  818. * Port FCP mappings.
  819. */
  820. struct bfa_port_fcpmap_s {
  821. char osdevname[256];
  822. u32 bus;
  823. u32 target;
  824. u32 oslun;
  825. u32 fcid;
  826. wwn_t nwwn;
  827. wwn_t pwwn;
  828. u64 fcplun;
  829. char luid[256];
  830. };
  831. /*
  832. * Port RNID info.
  833. */
  834. struct bfa_port_rnid_s {
  835. wwn_t wwn;
  836. u32 unittype;
  837. u32 portid;
  838. u32 attached_nodes_num;
  839. u16 ip_version;
  840. u16 udp_port;
  841. u8 ipaddr[16];
  842. u16 rsvd;
  843. u16 topologydiscoveryflags;
  844. };
  845. #pragma pack(1)
  846. struct bfa_fcport_fcf_s {
  847. wwn_t name; /* FCF name */
  848. wwn_t fabric_name; /* Fabric Name */
  849. u8 fipenabled; /* FIP enabled or not */
  850. u8 fipfailed; /* FIP failed or not */
  851. u8 resv[2];
  852. u8 pri; /* FCF priority */
  853. u8 version; /* FIP version used */
  854. u8 available; /* Available for login */
  855. u8 fka_disabled; /* FKA is disabled */
  856. u8 maxsz_verified; /* FCoE max size verified */
  857. u8 fc_map[3]; /* FC map */
  858. __be16 vlan; /* FCoE vlan tag/priority */
  859. u32 fka_adv_per; /* FIP ka advert. period */
  860. mac_t mac; /* FCF mac */
  861. };
  862. /*
  863. * Trunk states for BCU/BFAL
  864. */
  865. enum bfa_trunk_state {
  866. BFA_TRUNK_DISABLED = 0, /* Trunk is not configured */
  867. BFA_TRUNK_ONLINE = 1, /* Trunk is online */
  868. BFA_TRUNK_OFFLINE = 2, /* Trunk is offline */
  869. };
  870. /*
  871. * VC attributes for trunked link
  872. */
  873. struct bfa_trunk_vc_attr_s {
  874. u32 bb_credit;
  875. u32 elp_opmode_flags;
  876. u32 req_credit;
  877. u16 vc_credits[8];
  878. };
  879. /*
  880. * Link state information
  881. */
  882. struct bfa_port_link_s {
  883. u8 linkstate; /* Link state bfa_port_linkstate */
  884. u8 linkstate_rsn; /* bfa_port_linkstate_rsn_t */
  885. u8 topology; /* P2P/LOOP bfa_port_topology */
  886. u8 speed; /* Link speed (1/2/4/8 G) */
  887. u32 linkstate_opt; /* Linkstate optional data (debug) */
  888. u8 trunked; /* Trunked or not (1 or 0) */
  889. u8 resvd[3];
  890. struct bfa_qos_attr_s qos_attr; /* QoS Attributes */
  891. union {
  892. struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */
  893. struct bfa_trunk_vc_attr_s trunk_vc_attr;
  894. struct bfa_fcport_fcf_s fcf; /* FCF information (for FCoE) */
  895. } vc_fcf;
  896. };
  897. #pragma pack()
  898. enum bfa_trunk_link_fctl {
  899. BFA_TRUNK_LINK_FCTL_NORMAL,
  900. BFA_TRUNK_LINK_FCTL_VC,
  901. BFA_TRUNK_LINK_FCTL_VC_QOS,
  902. };
  903. enum bfa_trunk_link_state {
  904. BFA_TRUNK_LINK_STATE_UP = 1, /* link part of trunk */
  905. BFA_TRUNK_LINK_STATE_DN_LINKDN = 2, /* physical link down */
  906. BFA_TRUNK_LINK_STATE_DN_GRP_MIS = 3, /* trunk group different */
  907. BFA_TRUNK_LINK_STATE_DN_SPD_MIS = 4, /* speed mismatch */
  908. BFA_TRUNK_LINK_STATE_DN_MODE_MIS = 5, /* remote port not trunked */
  909. };
  910. #define BFA_TRUNK_MAX_PORTS 2
  911. struct bfa_trunk_link_attr_s {
  912. wwn_t trunk_wwn;
  913. enum bfa_trunk_link_fctl fctl;
  914. enum bfa_trunk_link_state link_state;
  915. enum bfa_port_speed speed;
  916. u32 deskew;
  917. };
  918. struct bfa_trunk_attr_s {
  919. enum bfa_trunk_state state;
  920. enum bfa_port_speed speed;
  921. u32 port_id;
  922. u32 rsvd;
  923. struct bfa_trunk_link_attr_s link_attr[BFA_TRUNK_MAX_PORTS];
  924. };
  925. struct bfa_rport_hal_stats_s {
  926. u32 sm_un_cr; /* uninit: create events */
  927. u32 sm_un_unexp; /* uninit: exception events */
  928. u32 sm_cr_on; /* created: online events */
  929. u32 sm_cr_del; /* created: delete events */
  930. u32 sm_cr_hwf; /* created: IOC down */
  931. u32 sm_cr_unexp; /* created: exception events */
  932. u32 sm_fwc_rsp; /* fw create: f/w responses */
  933. u32 sm_fwc_del; /* fw create: delete events */
  934. u32 sm_fwc_off; /* fw create: offline events */
  935. u32 sm_fwc_hwf; /* fw create: IOC down */
  936. u32 sm_fwc_unexp; /* fw create: exception events*/
  937. u32 sm_on_off; /* online: offline events */
  938. u32 sm_on_del; /* online: delete events */
  939. u32 sm_on_hwf; /* online: IOC down events */
  940. u32 sm_on_unexp; /* online: exception events */
  941. u32 sm_fwd_rsp; /* fw delete: fw responses */
  942. u32 sm_fwd_del; /* fw delete: delete events */
  943. u32 sm_fwd_hwf; /* fw delete: IOC down events */
  944. u32 sm_fwd_unexp; /* fw delete: exception events*/
  945. u32 sm_off_del; /* offline: delete events */
  946. u32 sm_off_on; /* offline: online events */
  947. u32 sm_off_hwf; /* offline: IOC down events */
  948. u32 sm_off_unexp; /* offline: exception events */
  949. u32 sm_del_fwrsp; /* delete: fw responses */
  950. u32 sm_del_hwf; /* delete: IOC down events */
  951. u32 sm_del_unexp; /* delete: exception events */
  952. u32 sm_delp_fwrsp; /* delete pend: fw responses */
  953. u32 sm_delp_hwf; /* delete pend: IOC downs */
  954. u32 sm_delp_unexp; /* delete pend: exceptions */
  955. u32 sm_offp_fwrsp; /* off-pending: fw responses */
  956. u32 sm_offp_del; /* off-pending: deletes */
  957. u32 sm_offp_hwf; /* off-pending: IOC downs */
  958. u32 sm_offp_unexp; /* off-pending: exceptions */
  959. u32 sm_iocd_off; /* IOC down: offline events */
  960. u32 sm_iocd_del; /* IOC down: delete events */
  961. u32 sm_iocd_on; /* IOC down: online events */
  962. u32 sm_iocd_unexp; /* IOC down: exceptions */
  963. u32 rsvd;
  964. };
  965. #pragma pack(1)
  966. /*
  967. * Rport's QoS attributes
  968. */
  969. struct bfa_rport_qos_attr_s {
  970. u8 qos_priority; /* rport's QoS priority */
  971. u8 rsvd[3];
  972. u32 qos_flow_id; /* QoS flow Id */
  973. };
  974. #pragma pack()
  975. #define BFA_IOBUCKET_MAX 14
  976. struct bfa_itnim_latency_s {
  977. u32 min[BFA_IOBUCKET_MAX];
  978. u32 max[BFA_IOBUCKET_MAX];
  979. u32 count[BFA_IOBUCKET_MAX];
  980. u32 avg[BFA_IOBUCKET_MAX];
  981. };
  982. struct bfa_itnim_ioprofile_s {
  983. u32 clock_res_mul;
  984. u32 clock_res_div;
  985. u32 index;
  986. u32 io_profile_start_time; /* IO profile start time */
  987. u32 iocomps[BFA_IOBUCKET_MAX]; /* IO completed */
  988. struct bfa_itnim_latency_s io_latency;
  989. };
  990. /*
  991. * vHBA port attribute values.
  992. */
  993. struct bfa_vhba_attr_s {
  994. wwn_t nwwn; /* node wwn */
  995. wwn_t pwwn; /* port wwn */
  996. u32 pid; /* port ID */
  997. bfa_boolean_t io_profile; /* get it from fcpim mod */
  998. bfa_boolean_t plog_enabled; /* portlog is enabled */
  999. u16 path_tov;
  1000. u8 rsvd[2];
  1001. };
  1002. /*
  1003. * FC physical port statistics.
  1004. */
  1005. struct bfa_port_fc_stats_s {
  1006. u64 secs_reset; /* Seconds since stats is reset */
  1007. u64 tx_frames; /* Tx frames */
  1008. u64 tx_words; /* Tx words */
  1009. u64 tx_lip; /* Tx LIP */
  1010. u64 tx_nos; /* Tx NOS */
  1011. u64 tx_ols; /* Tx OLS */
  1012. u64 tx_lr; /* Tx LR */
  1013. u64 tx_lrr; /* Tx LRR */
  1014. u64 rx_frames; /* Rx frames */
  1015. u64 rx_words; /* Rx words */
  1016. u64 lip_count; /* Rx LIP */
  1017. u64 nos_count; /* Rx NOS */
  1018. u64 ols_count; /* Rx OLS */
  1019. u64 lr_count; /* Rx LR */
  1020. u64 lrr_count; /* Rx LRR */
  1021. u64 invalid_crcs; /* Rx CRC err frames */
  1022. u64 invalid_crc_gd_eof; /* Rx CRC err good EOF frames */
  1023. u64 undersized_frm; /* Rx undersized frames */
  1024. u64 oversized_frm; /* Rx oversized frames */
  1025. u64 bad_eof_frm; /* Rx frames with bad EOF */
  1026. u64 error_frames; /* Errored frames */
  1027. u64 dropped_frames; /* Dropped frames */
  1028. u64 link_failures; /* Link Failure (LF) count */
  1029. u64 loss_of_syncs; /* Loss of sync count */
  1030. u64 loss_of_signals; /* Loss of signal count */
  1031. u64 primseq_errs; /* Primitive sequence protocol err. */
  1032. u64 bad_os_count; /* Invalid ordered sets */
  1033. u64 err_enc_out; /* Encoding err nonframe_8b10b */
  1034. u64 err_enc; /* Encoding err frame_8b10b */
  1035. u64 bbsc_frames_lost; /* Credit Recovery-Frames Lost */
  1036. u64 bbsc_credits_lost; /* Credit Recovery-Credits Lost */
  1037. u64 bbsc_link_resets; /* Credit Recovery-Link Resets */
  1038. };
  1039. /*
  1040. * Eth Physical Port statistics.
  1041. */
  1042. struct bfa_port_eth_stats_s {
  1043. u64 secs_reset; /* Seconds since stats is reset */
  1044. u64 frame_64; /* Frames 64 bytes */
  1045. u64 frame_65_127; /* Frames 65-127 bytes */
  1046. u64 frame_128_255; /* Frames 128-255 bytes */
  1047. u64 frame_256_511; /* Frames 256-511 bytes */
  1048. u64 frame_512_1023; /* Frames 512-1023 bytes */
  1049. u64 frame_1024_1518; /* Frames 1024-1518 bytes */
  1050. u64 frame_1519_1522; /* Frames 1519-1522 bytes */
  1051. u64 tx_bytes; /* Tx bytes */
  1052. u64 tx_packets; /* Tx packets */
  1053. u64 tx_mcast_packets; /* Tx multicast packets */
  1054. u64 tx_bcast_packets; /* Tx broadcast packets */
  1055. u64 tx_control_frame; /* Tx control frame */
  1056. u64 tx_drop; /* Tx drops */
  1057. u64 tx_jabber; /* Tx jabber */
  1058. u64 tx_fcs_error; /* Tx FCS errors */
  1059. u64 tx_fragments; /* Tx fragments */
  1060. u64 rx_bytes; /* Rx bytes */
  1061. u64 rx_packets; /* Rx packets */
  1062. u64 rx_mcast_packets; /* Rx multicast packets */
  1063. u64 rx_bcast_packets; /* Rx broadcast packets */
  1064. u64 rx_control_frames; /* Rx control frames */
  1065. u64 rx_unknown_opcode; /* Rx unknown opcode */
  1066. u64 rx_drop; /* Rx drops */
  1067. u64 rx_jabber; /* Rx jabber */
  1068. u64 rx_fcs_error; /* Rx FCS errors */
  1069. u64 rx_alignment_error; /* Rx alignment errors */
  1070. u64 rx_frame_length_error; /* Rx frame len errors */
  1071. u64 rx_code_error; /* Rx code errors */
  1072. u64 rx_fragments; /* Rx fragments */
  1073. u64 rx_pause; /* Rx pause */
  1074. u64 rx_zero_pause; /* Rx zero pause */
  1075. u64 tx_pause; /* Tx pause */
  1076. u64 tx_zero_pause; /* Tx zero pause */
  1077. u64 rx_fcoe_pause; /* Rx FCoE pause */
  1078. u64 rx_fcoe_zero_pause; /* Rx FCoE zero pause */
  1079. u64 tx_fcoe_pause; /* Tx FCoE pause */
  1080. u64 tx_fcoe_zero_pause; /* Tx FCoE zero pause */
  1081. u64 rx_iscsi_pause; /* Rx iSCSI pause */
  1082. u64 rx_iscsi_zero_pause; /* Rx iSCSI zero pause */
  1083. u64 tx_iscsi_pause; /* Tx iSCSI pause */
  1084. u64 tx_iscsi_zero_pause; /* Tx iSCSI zero pause */
  1085. };
  1086. /*
  1087. * Port statistics.
  1088. */
  1089. union bfa_port_stats_u {
  1090. struct bfa_port_fc_stats_s fc;
  1091. struct bfa_port_eth_stats_s eth;
  1092. };
  1093. struct bfa_port_cfg_mode_s {
  1094. u16 max_pf;
  1095. u16 max_vf;
  1096. enum bfa_mode_s mode;
  1097. };
  1098. #pragma pack(1)
  1099. #define BFA_CEE_LLDP_MAX_STRING_LEN (128)
  1100. #define BFA_CEE_DCBX_MAX_PRIORITY (8)
  1101. #define BFA_CEE_DCBX_MAX_PGID (8)
  1102. struct bfa_cee_lldp_str_s {
  1103. u8 sub_type;
  1104. u8 len;
  1105. u8 rsvd[2];
  1106. u8 value[BFA_CEE_LLDP_MAX_STRING_LEN];
  1107. };
  1108. struct bfa_cee_lldp_cfg_s {
  1109. struct bfa_cee_lldp_str_s chassis_id;
  1110. struct bfa_cee_lldp_str_s port_id;
  1111. struct bfa_cee_lldp_str_s port_desc;
  1112. struct bfa_cee_lldp_str_s sys_name;
  1113. struct bfa_cee_lldp_str_s sys_desc;
  1114. struct bfa_cee_lldp_str_s mgmt_addr;
  1115. u16 time_to_live;
  1116. u16 enabled_system_cap;
  1117. };
  1118. /* CEE/DCBX parameters */
  1119. struct bfa_cee_dcbx_cfg_s {
  1120. u8 pgid[BFA_CEE_DCBX_MAX_PRIORITY];
  1121. u8 pg_percentage[BFA_CEE_DCBX_MAX_PGID];
  1122. u8 pfc_primap; /* bitmap of priorties with PFC enabled */
  1123. u8 fcoe_primap; /* bitmap of priorities used for FcoE traffic */
  1124. u8 iscsi_primap; /* bitmap of priorities used for iSCSI traffic */
  1125. u8 dcbx_version; /* operating version:CEE or preCEE */
  1126. u8 lls_fcoe; /* FCoE Logical Link Status */
  1127. u8 lls_lan; /* LAN Logical Link Status */
  1128. u8 rsvd[2];
  1129. };
  1130. /* CEE Query */
  1131. struct bfa_cee_attr_s {
  1132. u8 cee_status;
  1133. u8 error_reason;
  1134. struct bfa_cee_lldp_cfg_s lldp_remote;
  1135. struct bfa_cee_dcbx_cfg_s dcbx_remote;
  1136. mac_t src_mac;
  1137. u8 link_speed;
  1138. u8 nw_priority;
  1139. u8 filler[2];
  1140. };
  1141. /* LLDP/DCBX/CEE Statistics */
  1142. struct bfa_cee_stats_s {
  1143. u32 lldp_tx_frames; /* LLDP Tx Frames */
  1144. u32 lldp_rx_frames; /* LLDP Rx Frames */
  1145. u32 lldp_rx_frames_invalid; /* LLDP Rx Frames invalid */
  1146. u32 lldp_rx_frames_new; /* LLDP Rx Frames new */
  1147. u32 lldp_tlvs_unrecognized; /* LLDP Rx unrecog. TLVs */
  1148. u32 lldp_rx_shutdown_tlvs; /* LLDP Rx shutdown TLVs */
  1149. u32 lldp_info_aged_out; /* LLDP remote info aged */
  1150. u32 dcbx_phylink_ups; /* DCBX phy link ups */
  1151. u32 dcbx_phylink_downs; /* DCBX phy link downs */
  1152. u32 dcbx_rx_tlvs; /* DCBX Rx TLVs */
  1153. u32 dcbx_rx_tlvs_invalid; /* DCBX Rx TLVs invalid */
  1154. u32 dcbx_control_tlv_error; /* DCBX control TLV errors */
  1155. u32 dcbx_feature_tlv_error; /* DCBX feature TLV errors */
  1156. u32 dcbx_cee_cfg_new; /* DCBX new CEE cfg rcvd */
  1157. u32 cee_status_down; /* DCB status down */
  1158. u32 cee_status_up; /* DCB status up */
  1159. u32 cee_hw_cfg_changed; /* DCB hw cfg changed */
  1160. u32 cee_rx_invalid_cfg; /* DCB invalid cfg */
  1161. };
  1162. #pragma pack()
  1163. /*
  1164. * AEN related definitions
  1165. */
  1166. #define BFAD_NL_VENDOR_ID (((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) \
  1167. | BFA_PCI_VENDOR_ID_BROCADE)
  1168. /* BFA remote port events */
  1169. enum bfa_rport_aen_event {
  1170. BFA_RPORT_AEN_ONLINE = 1, /* RPort online event */
  1171. BFA_RPORT_AEN_OFFLINE = 2, /* RPort offline event */
  1172. BFA_RPORT_AEN_DISCONNECT = 3, /* RPort disconnect event */
  1173. BFA_RPORT_AEN_QOS_PRIO = 4, /* QOS priority change event */
  1174. BFA_RPORT_AEN_QOS_FLOWID = 5, /* QOS flow Id change event */
  1175. };
  1176. struct bfa_rport_aen_data_s {
  1177. u16 vf_id; /* vf_id of this logical port */
  1178. u16 rsvd[3];
  1179. wwn_t ppwwn; /* WWN of its physical port */
  1180. wwn_t lpwwn; /* WWN of this logical port */
  1181. wwn_t rpwwn; /* WWN of this remote port */
  1182. union {
  1183. struct bfa_rport_qos_attr_s qos;
  1184. } priv;
  1185. };
  1186. union bfa_aen_data_u {
  1187. struct bfa_adapter_aen_data_s adapter;
  1188. struct bfa_port_aen_data_s port;
  1189. struct bfa_lport_aen_data_s lport;
  1190. struct bfa_rport_aen_data_s rport;
  1191. struct bfa_itnim_aen_data_s itnim;
  1192. struct bfa_audit_aen_data_s audit;
  1193. struct bfa_ioc_aen_data_s ioc;
  1194. };
  1195. #define BFA_AEN_MAX_ENTRY 512
  1196. struct bfa_aen_entry_s {
  1197. struct list_head qe;
  1198. enum bfa_aen_category aen_category;
  1199. u32 aen_type;
  1200. union bfa_aen_data_u aen_data;
  1201. struct timeval aen_tv;
  1202. u32 seq_num;
  1203. u32 bfad_num;
  1204. };
  1205. #endif /* __BFA_DEFS_SVC_H__ */