bfa_defs_svc.h 46 KB

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