648c84176722ce108d556ffc4efd4c883ee16b34
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / scsi / bfa / bfa_defs_svc.h
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
18 #ifndef __BFA_DEFS_SVC_H__
19 #define __BFA_DEFS_SVC_H__
20
21 #include "bfa_defs.h"
22 #include "bfa_fc.h"
23 #include "bfi.h"
24
25 #define BFA_IOCFC_INTR_DELAY 1125
26 #define BFA_IOCFC_INTR_LATENCY 225
27 #define BFA_IOCFCOE_INTR_DELAY 25
28 #define BFA_IOCFCOE_INTR_LATENCY 5
29
30 /*
31 * Interrupt coalescing configuration.
32 */
33 #pragma pack(1)
34 struct bfa_iocfc_intr_attr_s {
35 u8 coalesce; /* enable/disable coalescing */
36 u8 rsvd[3];
37 __be16 latency; /* latency in microseconds */
38 __be16 delay; /* delay in microseconds */
39 };
40
41 /*
42 * IOC firmware configuraton
43 */
44 struct bfa_iocfc_fwcfg_s {
45 u16 num_fabrics; /* number of fabrics */
46 u16 num_lports; /* number of local lports */
47 u16 num_rports; /* number of remote ports */
48 u16 num_ioim_reqs; /* number of IO reqs */
49 u16 num_tskim_reqs; /* task management requests */
50 u16 num_iotm_reqs; /* number of TM IO reqs */
51 u16 num_tsktm_reqs; /* TM task management requests*/
52 u16 num_fcxp_reqs; /* unassisted FC exchanges */
53 u16 num_uf_bufs; /* unsolicited recv buffers */
54 u8 num_cqs;
55 u8 fw_tick_res; /* FW clock resolution in ms */
56 u8 rsvd[4];
57 };
58 #pragma pack()
59
60 struct bfa_iocfc_drvcfg_s {
61 u16 num_reqq_elems; /* number of req queue elements */
62 u16 num_rspq_elems; /* number of rsp queue elements */
63 u16 num_sgpgs; /* number of total SG pages */
64 u16 num_sboot_tgts; /* number of SAN boot targets */
65 u16 num_sboot_luns; /* number of SAN boot luns */
66 u16 ioc_recover; /* IOC recovery mode */
67 u16 min_cfg; /* minimum configuration */
68 u16 path_tov; /* device path timeout */
69 bfa_boolean_t delay_comp; /* delay completion of
70 failed inflight IOs */
71 u32 rsvd;
72 };
73
74 /*
75 * IOC configuration
76 */
77 struct bfa_iocfc_cfg_s {
78 struct bfa_iocfc_fwcfg_s fwcfg; /* firmware side config */
79 struct bfa_iocfc_drvcfg_s drvcfg; /* driver side config */
80 };
81
82 /*
83 * IOC firmware IO stats
84 */
85 struct bfa_fw_io_stats_s {
86 u32 host_abort; /* IO aborted by host driver*/
87 u32 host_cleanup; /* IO clean up by host driver */
88
89 u32 fw_io_timeout; /* IOs timedout */
90 u32 fw_frm_parse; /* frame parsed by f/w */
91 u32 fw_frm_data; /* fcp_data frame parsed by f/w */
92 u32 fw_frm_rsp; /* fcp_rsp frame parsed by f/w */
93 u32 fw_frm_xfer_rdy; /* xfer_rdy frame parsed by f/w */
94 u32 fw_frm_bls_acc; /* BLS ACC frame parsed by f/w */
95 u32 fw_frm_tgt_abort; /* target ABTS parsed by f/w */
96 u32 fw_frm_unknown; /* unknown parsed by f/w */
97 u32 fw_data_dma; /* f/w DMA'ed the data frame */
98 u32 fw_frm_drop; /* f/w drop the frame */
99
100 u32 rec_timeout; /* FW rec timed out */
101 u32 error_rec; /* FW sending rec on
102 * an error condition*/
103 u32 wait_for_si; /* FW wait for SI */
104 u32 rec_rsp_inval; /* REC rsp invalid */
105 u32 seqr_io_abort; /* target does not know cmd so abort */
106 u32 seqr_io_retry; /* SEQR failed so retry IO */
107
108 u32 itn_cisc_upd_rsp; /* ITN cisc updated on fcp_rsp */
109 u32 itn_cisc_upd_data; /* ITN cisc updated on fcp_data */
110 u32 itn_cisc_upd_xfer_rdy; /* ITN cisc updated on fcp_data */
111
112 u32 fcp_data_lost; /* fcp data lost */
113
114 u32 ro_set_in_xfer_rdy; /* Target set RO in Xfer_rdy frame */
115 u32 xfer_rdy_ooo_err; /* Out of order Xfer_rdy received */
116 u32 xfer_rdy_unknown_err; /* unknown error in xfer_rdy frame */
117
118 u32 io_abort_timeout; /* ABTS timedout */
119 u32 sler_initiated; /* SLER initiated */
120
121 u32 unexp_fcp_rsp; /* fcp response in wrong state */
122
123 u32 fcp_rsp_under_run; /* fcp rsp IO underrun */
124 u32 fcp_rsp_under_run_wr; /* fcp rsp IO underrun for write */
125 u32 fcp_rsp_under_run_err; /* fcp rsp IO underrun error */
126 u32 fcp_rsp_resid_inval; /* invalid residue */
127 u32 fcp_rsp_over_run; /* fcp rsp IO overrun */
128 u32 fcp_rsp_over_run_err; /* fcp rsp IO overrun error */
129 u32 fcp_rsp_proto_err; /* protocol error in fcp rsp */
130 u32 fcp_rsp_sense_err; /* error in sense info in fcp rsp */
131 u32 fcp_conf_req; /* FCP conf requested */
132
133 u32 tgt_aborted_io; /* target initiated abort */
134
135 u32 ioh_edtov_timeout_event;/* IOH edtov timer popped */
136 u32 ioh_fcp_rsp_excp_event; /* IOH FCP_RSP exception */
137 u32 ioh_fcp_conf_event; /* IOH FCP_CONF */
138 u32 ioh_mult_frm_rsp_event; /* IOH multi_frame FCP_RSP */
139 u32 ioh_hit_class2_event; /* IOH hit class2 */
140 u32 ioh_miss_other_event; /* IOH miss other */
141 u32 ioh_seq_cnt_err_event; /* IOH seq cnt error */
142 u32 ioh_len_err_event; /* IOH len error - fcp_dl !=
143 * bytes xfered */
144 u32 ioh_seq_len_err_event; /* IOH seq len error */
145 u32 ioh_data_oor_event; /* Data out of range */
146 u32 ioh_ro_ooo_event; /* Relative offset out of range */
147 u32 ioh_cpu_owned_event; /* IOH hit -iost owned by f/w */
148 u32 ioh_unexp_frame_event; /* unexpected frame recieved
149 * count */
150 u32 ioh_err_int; /* IOH error int during data-phase
151 * for scsi write
152 */
153 };
154
155 /*
156 * IOC port firmware stats
157 */
158
159 struct bfa_fw_port_fpg_stats_s {
160 u32 intr_evt;
161 u32 intr;
162 u32 intr_excess;
163 u32 intr_cause0;
164 u32 intr_other;
165 u32 intr_other_ign;
166 u32 sig_lost;
167 u32 sig_regained;
168 u32 sync_lost;
169 u32 sync_to;
170 u32 sync_regained;
171 u32 div2_overflow;
172 u32 div2_underflow;
173 u32 efifo_overflow;
174 u32 efifo_underflow;
175 u32 idle_rx;
176 u32 lrr_rx;
177 u32 lr_rx;
178 u32 ols_rx;
179 u32 nos_rx;
180 u32 lip_rx;
181 u32 arbf0_rx;
182 u32 arb_rx;
183 u32 mrk_rx;
184 u32 const_mrk_rx;
185 u32 prim_unknown;
186 };
187
188
189 struct bfa_fw_port_lksm_stats_s {
190 u32 hwsm_success; /* hwsm state machine success */
191 u32 hwsm_fails; /* hwsm fails */
192 u32 hwsm_wdtov; /* hwsm timed out */
193 u32 swsm_success; /* swsm success */
194 u32 swsm_fails; /* swsm fails */
195 u32 swsm_wdtov; /* swsm timed out */
196 u32 busybufs; /* link init failed due to busybuf */
197 u32 buf_waits; /* bufwait state entries */
198 u32 link_fails; /* link failures */
199 u32 psp_errors; /* primitive sequence protocol errors */
200 u32 lr_unexp; /* No. of times LR rx-ed unexpectedly */
201 u32 lrr_unexp; /* No. of times LRR rx-ed unexpectedly */
202 u32 lr_tx; /* No. of times LR tx started */
203 u32 lrr_tx; /* No. of times LRR tx started */
204 u32 ols_tx; /* No. of times OLS tx started */
205 u32 nos_tx; /* No. of times NOS tx started */
206 u32 hwsm_lrr_rx; /* No. of times LRR rx-ed by HWSM */
207 u32 hwsm_lr_rx; /* No. of times LR rx-ed by HWSM */
208 };
209
210 struct bfa_fw_port_snsm_stats_s {
211 u32 hwsm_success; /* Successful hwsm terminations */
212 u32 hwsm_fails; /* hwsm fail count */
213 u32 hwsm_wdtov; /* hwsm timed out */
214 u32 swsm_success; /* swsm success */
215 u32 swsm_wdtov; /* swsm timed out */
216 u32 error_resets; /* error resets initiated by upsm */
217 u32 sync_lost; /* Sync loss count */
218 u32 sig_lost; /* Signal loss count */
219 };
220
221 struct bfa_fw_port_physm_stats_s {
222 u32 module_inserts; /* Module insert count */
223 u32 module_xtracts; /* Module extracts count */
224 u32 module_invalids; /* Invalid module inserted count */
225 u32 module_read_ign; /* Module validation status ignored */
226 u32 laser_faults; /* Laser fault count */
227 u32 rsvd;
228 };
229
230 struct bfa_fw_fip_stats_s {
231 u32 vlan_req; /* vlan discovery requests */
232 u32 vlan_notify; /* vlan notifications */
233 u32 vlan_err; /* vlan response error */
234 u32 vlan_timeouts; /* vlan disvoery timeouts */
235 u32 vlan_invalids; /* invalid vlan in discovery advert. */
236 u32 disc_req; /* Discovery solicit requests */
237 u32 disc_rsp; /* Discovery solicit response */
238 u32 disc_err; /* Discovery advt. parse errors */
239 u32 disc_unsol; /* Discovery unsolicited */
240 u32 disc_timeouts; /* Discovery timeouts */
241 u32 disc_fcf_unavail; /* Discovery FCF Not Avail. */
242 u32 linksvc_unsupp; /* Unsupported link service req */
243 u32 linksvc_err; /* Parse error in link service req */
244 u32 logo_req; /* FIP logos received */
245 u32 clrvlink_req; /* Clear virtual link req */
246 u32 op_unsupp; /* Unsupported FIP operation */
247 u32 untagged; /* Untagged frames (ignored) */
248 u32 invalid_version; /* Invalid FIP version */
249 };
250
251 struct bfa_fw_lps_stats_s {
252 u32 mac_invalids; /* Invalid mac assigned */
253 u32 rsvd;
254 };
255
256 struct bfa_fw_fcoe_stats_s {
257 u32 cee_linkups; /* CEE link up count */
258 u32 cee_linkdns; /* CEE link down count */
259 u32 fip_linkups; /* FIP link up count */
260 u32 fip_linkdns; /* FIP link up count */
261 u32 fip_fails; /* FIP fail count */
262 u32 mac_invalids; /* Invalid mac assigned */
263 };
264
265 /*
266 * IOC firmware FCoE port stats
267 */
268 struct bfa_fw_fcoe_port_stats_s {
269 struct bfa_fw_fcoe_stats_s fcoe_stats;
270 struct bfa_fw_fip_stats_s fip_stats;
271 };
272
273 /*
274 * IOC firmware FC uport stats
275 */
276 struct bfa_fw_fc_uport_stats_s {
277 struct bfa_fw_port_snsm_stats_s snsm_stats;
278 struct bfa_fw_port_lksm_stats_s lksm_stats;
279 };
280
281 /*
282 * IOC firmware FC port stats
283 */
284 union bfa_fw_fc_port_stats_s {
285 struct bfa_fw_fc_uport_stats_s fc_stats;
286 struct bfa_fw_fcoe_port_stats_s fcoe_stats;
287 };
288
289 /*
290 * IOC firmware port stats
291 */
292 struct bfa_fw_port_stats_s {
293 struct bfa_fw_port_fpg_stats_s fpg_stats;
294 struct bfa_fw_port_physm_stats_s physm_stats;
295 union bfa_fw_fc_port_stats_s fc_port;
296 };
297
298 /*
299 * fcxchg module statistics
300 */
301 struct bfa_fw_fcxchg_stats_s {
302 u32 ua_tag_inv;
303 u32 ua_state_inv;
304 };
305
306 struct bfa_fw_lpsm_stats_s {
307 u32 cls_rx;
308 u32 cls_tx;
309 };
310
311 /*
312 * Trunk statistics
313 */
314 struct bfa_fw_trunk_stats_s {
315 u32 emt_recvd; /* Trunk EMT received */
316 u32 emt_accepted; /* Trunk EMT Accepted */
317 u32 emt_rejected; /* Trunk EMT rejected */
318 u32 etp_recvd; /* Trunk ETP received */
319 u32 etp_accepted; /* Trunk ETP Accepted */
320 u32 etp_rejected; /* Trunk ETP rejected */
321 u32 lr_recvd; /* Trunk LR received */
322 u32 rsvd; /* padding for 64 bit alignment */
323 };
324
325 struct bfa_fw_advsm_stats_s {
326 u32 flogi_sent; /* Flogi sent */
327 u32 flogi_acc_recvd; /* Flogi Acc received */
328 u32 flogi_rjt_recvd; /* Flogi rejects received */
329 u32 flogi_retries; /* Flogi retries */
330
331 u32 elp_recvd; /* ELP received */
332 u32 elp_accepted; /* ELP Accepted */
333 u32 elp_rejected; /* ELP rejected */
334 u32 elp_dropped; /* ELP dropped */
335 };
336
337 /*
338 * IOCFC firmware stats
339 */
340 struct bfa_fw_iocfc_stats_s {
341 u32 cfg_reqs; /* cfg request */
342 u32 updq_reqs; /* update queue request */
343 u32 ic_reqs; /* interrupt coalesce reqs */
344 u32 unknown_reqs;
345 u32 set_intr_reqs; /* set interrupt reqs */
346 };
347
348 /*
349 * IOC attributes returned in queries
350 */
351 struct bfa_iocfc_attr_s {
352 struct bfa_iocfc_cfg_s config; /* IOCFC config */
353 struct bfa_iocfc_intr_attr_s intr_attr; /* interrupt attr */
354 };
355
356 /*
357 * Eth_sndrcv mod stats
358 */
359 struct bfa_fw_eth_sndrcv_stats_s {
360 u32 crc_err;
361 u32 rsvd; /* 64bit align */
362 };
363
364 /*
365 * CT MAC mod stats
366 */
367 struct bfa_fw_mac_mod_stats_s {
368 u32 mac_on; /* MAC got turned-on */
369 u32 link_up; /* link-up */
370 u32 signal_off; /* lost signal */
371 u32 dfe_on; /* DFE on */
372 u32 mac_reset; /* # of MAC reset to bring lnk up */
373 u32 pcs_reset; /* # of PCS reset to bring lnk up */
374 u32 loopback; /* MAC got into serdes loopback */
375 u32 lb_mac_reset;
376 /* # of MAC reset to bring link up in loopback */
377 u32 lb_pcs_reset;
378 /* # of PCS reset to bring link up in loopback */
379 u32 rsvd; /* 64bit align */
380 };
381
382 /*
383 * CT MOD stats
384 */
385 struct bfa_fw_ct_mod_stats_s {
386 u32 rxa_rds_undrun; /* RxA RDS underrun */
387 u32 rad_bpc_ovfl; /* RAD BPC overflow */
388 u32 rad_rlb_bpc_ovfl; /* RAD RLB BPC overflow */
389 u32 bpc_fcs_err; /* BPC FCS_ERR */
390 u32 txa_tso_hdr; /* TxA TSO header too long */
391 u32 rsvd; /* 64bit align */
392 };
393
394 /*
395 * IOC firmware stats
396 */
397 struct bfa_fw_stats_s {
398 struct bfa_fw_ioc_stats_s ioc_stats;
399 struct bfa_fw_iocfc_stats_s iocfc_stats;
400 struct bfa_fw_io_stats_s io_stats;
401 struct bfa_fw_port_stats_s port_stats;
402 struct bfa_fw_fcxchg_stats_s fcxchg_stats;
403 struct bfa_fw_lpsm_stats_s lpsm_stats;
404 struct bfa_fw_lps_stats_s lps_stats;
405 struct bfa_fw_trunk_stats_s trunk_stats;
406 struct bfa_fw_advsm_stats_s advsm_stats;
407 struct bfa_fw_mac_mod_stats_s macmod_stats;
408 struct bfa_fw_ct_mod_stats_s ctmod_stats;
409 struct bfa_fw_eth_sndrcv_stats_s ethsndrcv_stats;
410 };
411
412 #define BFA_IOCFC_PATHTOV_MAX 60
413 #define BFA_IOCFC_QDEPTH_MAX 2000
414
415 /*
416 * QoS states
417 */
418 enum bfa_qos_state {
419 BFA_QOS_ONLINE = 1, /* QoS is online */
420 BFA_QOS_OFFLINE = 2, /* QoS is offline */
421 };
422
423 /*
424 * QoS Priority levels.
425 */
426 enum bfa_qos_priority {
427 BFA_QOS_UNKNOWN = 0,
428 BFA_QOS_HIGH = 1, /* QoS Priority Level High */
429 BFA_QOS_MED = 2, /* QoS Priority Level Medium */
430 BFA_QOS_LOW = 3, /* QoS Priority Level Low */
431 };
432
433 /*
434 * QoS bandwidth allocation for each priority level
435 */
436 enum bfa_qos_bw_alloc {
437 BFA_QOS_BW_HIGH = 60, /* bandwidth allocation for High */
438 BFA_QOS_BW_MED = 30, /* bandwidth allocation for Medium */
439 BFA_QOS_BW_LOW = 10, /* bandwidth allocation for Low */
440 };
441 #pragma pack(1)
442 /*
443 * QoS attribute returned in QoS Query
444 */
445 struct bfa_qos_attr_s {
446 u8 state; /* QoS current state */
447 u8 rsvd[3];
448 u32 total_bb_cr; /* Total BB Credits */
449 };
450
451 /*
452 * These fields should be displayed only from the CLI.
453 * There will be a separate BFAL API (get_qos_vc_attr ?)
454 * to retrieve this.
455 *
456 */
457 #define BFA_QOS_MAX_VC 16
458
459 struct bfa_qos_vc_info_s {
460 u8 vc_credit;
461 u8 borrow_credit;
462 u8 priority;
463 u8 resvd;
464 };
465
466 struct bfa_qos_vc_attr_s {
467 u16 total_vc_count; /* Total VC Count */
468 u16 shared_credit;
469 u32 elp_opmode_flags;
470 struct bfa_qos_vc_info_s vc_info[BFA_QOS_MAX_VC]; /* as many as
471 * total_vc_count */
472 };
473
474 /*
475 * QoS statistics
476 */
477 struct bfa_qos_stats_s {
478 u32 flogi_sent; /* QoS Flogi sent */
479 u32 flogi_acc_recvd; /* QoS Flogi Acc received */
480 u32 flogi_rjt_recvd; /* QoS Flogi rejects received */
481 u32 flogi_retries; /* QoS Flogi retries */
482
483 u32 elp_recvd; /* QoS ELP received */
484 u32 elp_accepted; /* QoS ELP Accepted */
485 u32 elp_rejected; /* QoS ELP rejected */
486 u32 elp_dropped; /* QoS ELP dropped */
487
488 u32 qos_rscn_recvd; /* QoS RSCN received */
489 u32 rsvd; /* padding for 64 bit alignment */
490 };
491
492 /*
493 * FCoE statistics
494 */
495 struct bfa_fcoe_stats_s {
496 u64 secs_reset; /* Seconds since stats reset */
497 u64 cee_linkups; /* CEE link up */
498 u64 cee_linkdns; /* CEE link down */
499 u64 fip_linkups; /* FIP link up */
500 u64 fip_linkdns; /* FIP link down */
501 u64 fip_fails; /* FIP failures */
502 u64 mac_invalids; /* Invalid mac assignments */
503 u64 vlan_req; /* Vlan requests */
504 u64 vlan_notify; /* Vlan notifications */
505 u64 vlan_err; /* Vlan notification errors */
506 u64 vlan_timeouts; /* Vlan request timeouts */
507 u64 vlan_invalids; /* Vlan invalids */
508 u64 disc_req; /* Discovery requests */
509 u64 disc_rsp; /* Discovery responses */
510 u64 disc_err; /* Discovery error frames */
511 u64 disc_unsol; /* Discovery unsolicited */
512 u64 disc_timeouts; /* Discovery timeouts */
513 u64 disc_fcf_unavail; /* Discovery FCF not avail */
514 u64 linksvc_unsupp; /* FIP link service req unsupp. */
515 u64 linksvc_err; /* FIP link service req errors */
516 u64 logo_req; /* FIP logos received */
517 u64 clrvlink_req; /* Clear virtual link requests */
518 u64 op_unsupp; /* FIP operation unsupp. */
519 u64 untagged; /* FIP untagged frames */
520 u64 txf_ucast; /* Tx FCoE unicast frames */
521 u64 txf_ucast_vlan; /* Tx FCoE unicast vlan frames */
522 u64 txf_ucast_octets; /* Tx FCoE unicast octets */
523 u64 txf_mcast; /* Tx FCoE multicast frames */
524 u64 txf_mcast_vlan; /* Tx FCoE multicast vlan frames */
525 u64 txf_mcast_octets; /* Tx FCoE multicast octets */
526 u64 txf_bcast; /* Tx FCoE broadcast frames */
527 u64 txf_bcast_vlan; /* Tx FCoE broadcast vlan frames */
528 u64 txf_bcast_octets; /* Tx FCoE broadcast octets */
529 u64 txf_timeout; /* Tx timeouts */
530 u64 txf_parity_errors; /* Transmit parity err */
531 u64 txf_fid_parity_errors; /* Transmit FID parity err */
532 u64 rxf_ucast_octets; /* Rx FCoE unicast octets */
533 u64 rxf_ucast; /* Rx FCoE unicast frames */
534 u64 rxf_ucast_vlan; /* Rx FCoE unicast vlan frames */
535 u64 rxf_mcast_octets; /* Rx FCoE multicast octets */
536 u64 rxf_mcast; /* Rx FCoE multicast frames */
537 u64 rxf_mcast_vlan; /* Rx FCoE multicast vlan frames */
538 u64 rxf_bcast_octets; /* Rx FCoE broadcast octets */
539 u64 rxf_bcast; /* Rx FCoE broadcast frames */
540 u64 rxf_bcast_vlan; /* Rx FCoE broadcast vlan frames */
541 };
542
543 /*
544 * QoS or FCoE stats (fcport stats excluding physical FC port stats)
545 */
546 union bfa_fcport_stats_u {
547 struct bfa_qos_stats_s fcqos;
548 struct bfa_fcoe_stats_s fcoe;
549 };
550 #pragma pack()
551
552 struct bfa_fcpim_del_itn_stats_s {
553 u32 del_itn_iocomp_aborted; /* Aborted IO requests */
554 u32 del_itn_iocomp_timedout; /* IO timeouts */
555 u32 del_itn_iocom_sqer_needed; /* IO retry for SQ error recovery */
556 u32 del_itn_iocom_res_free; /* Delayed freeing of IO resources */
557 u32 del_itn_iocom_hostabrts; /* Host IO abort requests */
558 u32 del_itn_total_ios; /* Total IO count */
559 u32 del_io_iocdowns; /* IO cleaned-up due to IOC down */
560 u32 del_tm_iocdowns; /* TM cleaned-up due to IOC down */
561 };
562
563 struct bfa_itnim_iostats_s {
564
565 u32 total_ios; /* Total IO Requests */
566 u32 input_reqs; /* Data in-bound requests */
567 u32 output_reqs; /* Data out-bound requests */
568 u32 io_comps; /* Total IO Completions */
569 u32 wr_throughput; /* Write data transfered in bytes */
570 u32 rd_throughput; /* Read data transfered in bytes */
571
572 u32 iocomp_ok; /* Slowpath IO completions */
573 u32 iocomp_underrun; /* IO underrun */
574 u32 iocomp_overrun; /* IO overrun */
575 u32 qwait; /* IO Request-Q wait */
576 u32 qresumes; /* IO Request-Q wait done */
577 u32 no_iotags; /* No free IO tag */
578 u32 iocomp_timedout; /* IO timeouts */
579 u32 iocom_nexus_abort; /* IO failure due to target offline */
580 u32 iocom_proto_err; /* IO protocol errors */
581 u32 iocom_dif_err; /* IO SBC-3 protection errors */
582
583 u32 iocom_sqer_needed; /* fcp-2 error recovery failed */
584 u32 iocom_res_free; /* Delayed freeing of IO tag */
585
586
587 u32 io_aborts; /* Host IO abort requests */
588 u32 iocom_hostabrts; /* Host IO abort completions */
589 u32 io_cleanups; /* IO clean-up requests */
590 u32 path_tov_expired; /* IO path tov expired */
591 u32 iocomp_aborted; /* IO abort completions */
592 u32 io_iocdowns; /* IO cleaned-up due to IOC down */
593 u32 iocom_utags; /* IO comp with unknown tags */
594
595 u32 io_tmaborts; /* Abort request due to TM command */
596 u32 tm_io_comps; /* Abort completion due to TM command */
597
598 u32 creates; /* IT Nexus create requests */
599 u32 fw_create; /* IT Nexus FW create requests */
600 u32 create_comps; /* IT Nexus FW create completions */
601 u32 onlines; /* IT Nexus onlines */
602 u32 offlines; /* IT Nexus offlines */
603 u32 fw_delete; /* IT Nexus FW delete requests */
604 u32 delete_comps; /* IT Nexus FW delete completions */
605 u32 deletes; /* IT Nexus delete requests */
606 u32 sler_events; /* SLER events */
607 u32 ioc_disabled; /* Num IOC disables */
608 u32 cleanup_comps; /* IT Nexus cleanup completions */
609
610 u32 tm_cmnds; /* TM Requests */
611 u32 tm_fw_rsps; /* TM Completions */
612 u32 tm_success; /* TM initiated IO cleanup success */
613 u32 tm_failures; /* TM initiated IO cleanup failure */
614 u32 no_tskims; /* No free TM tag */
615 u32 tm_qwait; /* TM Request-Q wait */
616 u32 tm_qresumes; /* TM Request-Q wait done */
617
618 u32 tm_iocdowns; /* TM cleaned-up due to IOC down */
619 u32 tm_cleanups; /* TM cleanup requests */
620 u32 tm_cleanup_comps; /* TM cleanup completions */
621 };
622
623 /* Modify char* port_stt[] in bfal_port.c if a new state was added */
624 enum bfa_port_states {
625 BFA_PORT_ST_UNINIT = 1,
626 BFA_PORT_ST_ENABLING_QWAIT = 2,
627 BFA_PORT_ST_ENABLING = 3,
628 BFA_PORT_ST_LINKDOWN = 4,
629 BFA_PORT_ST_LINKUP = 5,
630 BFA_PORT_ST_DISABLING_QWAIT = 6,
631 BFA_PORT_ST_DISABLING = 7,
632 BFA_PORT_ST_DISABLED = 8,
633 BFA_PORT_ST_STOPPED = 9,
634 BFA_PORT_ST_IOCDOWN = 10,
635 BFA_PORT_ST_IOCDIS = 11,
636 BFA_PORT_ST_FWMISMATCH = 12,
637 BFA_PORT_ST_PREBOOT_DISABLED = 13,
638 BFA_PORT_ST_TOGGLING_QWAIT = 14,
639 BFA_PORT_ST_MAX_STATE,
640 };
641
642 /*
643 * Port operational type (in sync with SNIA port type).
644 */
645 enum bfa_port_type {
646 BFA_PORT_TYPE_UNKNOWN = 1, /* port type is unknown */
647 BFA_PORT_TYPE_NPORT = 5, /* P2P with switched fabric */
648 BFA_PORT_TYPE_NLPORT = 6, /* public loop */
649 BFA_PORT_TYPE_LPORT = 20, /* private loop */
650 BFA_PORT_TYPE_P2P = 21, /* P2P with no switched fabric */
651 BFA_PORT_TYPE_VPORT = 22, /* NPIV - virtual port */
652 };
653
654 /*
655 * Port topology setting. A port's topology and fabric login status
656 * determine its operational type.
657 */
658 enum bfa_port_topology {
659 BFA_PORT_TOPOLOGY_NONE = 0, /* No valid topology */
660 BFA_PORT_TOPOLOGY_P2P = 1, /* P2P only */
661 BFA_PORT_TOPOLOGY_LOOP = 2, /* LOOP topology */
662 BFA_PORT_TOPOLOGY_AUTO = 3, /* auto topology selection */
663 };
664
665 /*
666 * Physical port loopback types.
667 */
668 enum bfa_port_opmode {
669 BFA_PORT_OPMODE_NORMAL = 0x00, /* normal non-loopback mode */
670 BFA_PORT_OPMODE_LB_INT = 0x01, /* internal loop back */
671 BFA_PORT_OPMODE_LB_SLW = 0x02, /* serial link wrapback (serdes) */
672 BFA_PORT_OPMODE_LB_EXT = 0x04, /* external loop back (serdes) */
673 BFA_PORT_OPMODE_LB_CBL = 0x08, /* cabled loop back */
674 BFA_PORT_OPMODE_LB_NLINT = 0x20, /* NL_Port internal loopback */
675 };
676
677 #define BFA_PORT_OPMODE_LB_HARD(_mode) \
678 ((_mode == BFA_PORT_OPMODE_LB_INT) || \
679 (_mode == BFA_PORT_OPMODE_LB_SLW) || \
680 (_mode == BFA_PORT_OPMODE_LB_EXT))
681
682 /*
683 * Port link state
684 */
685 enum bfa_port_linkstate {
686 BFA_PORT_LINKUP = 1, /* Physical port/Trunk link up */
687 BFA_PORT_LINKDOWN = 2, /* Physical port/Trunk link down */
688 };
689
690 /*
691 * Port link state reason code
692 */
693 enum bfa_port_linkstate_rsn {
694 BFA_PORT_LINKSTATE_RSN_NONE = 0,
695 BFA_PORT_LINKSTATE_RSN_DISABLED = 1,
696 BFA_PORT_LINKSTATE_RSN_RX_NOS = 2,
697 BFA_PORT_LINKSTATE_RSN_RX_OLS = 3,
698 BFA_PORT_LINKSTATE_RSN_RX_LIP = 4,
699 BFA_PORT_LINKSTATE_RSN_RX_LIPF7 = 5,
700 BFA_PORT_LINKSTATE_RSN_SFP_REMOVED = 6,
701 BFA_PORT_LINKSTATE_RSN_PORT_FAULT = 7,
702 BFA_PORT_LINKSTATE_RSN_RX_LOS = 8,
703 BFA_PORT_LINKSTATE_RSN_LOCAL_FAULT = 9,
704 BFA_PORT_LINKSTATE_RSN_REMOTE_FAULT = 10,
705 BFA_PORT_LINKSTATE_RSN_TIMEOUT = 11,
706
707
708
709 /* CEE related reason codes/errors */
710 CEE_LLDP_INFO_AGED_OUT = 20,
711 CEE_LLDP_SHUTDOWN_TLV_RCVD = 21,
712 CEE_PEER_NOT_ADVERTISE_DCBX = 22,
713 CEE_PEER_NOT_ADVERTISE_PG = 23,
714 CEE_PEER_NOT_ADVERTISE_PFC = 24,
715 CEE_PEER_NOT_ADVERTISE_FCOE = 25,
716 CEE_PG_NOT_COMPATIBLE = 26,
717 CEE_PFC_NOT_COMPATIBLE = 27,
718 CEE_FCOE_NOT_COMPATIBLE = 28,
719 CEE_BAD_PG_RCVD = 29,
720 CEE_BAD_BW_RCVD = 30,
721 CEE_BAD_PFC_RCVD = 31,
722 CEE_BAD_APP_PRI_RCVD = 32,
723 CEE_FCOE_PRI_PFC_OFF = 33,
724 CEE_DUP_CONTROL_TLV_RCVD = 34,
725 CEE_DUP_FEAT_TLV_RCVD = 35,
726 CEE_APPLY_NEW_CFG = 36, /* reason, not error */
727 CEE_PROTOCOL_INIT = 37, /* reason, not error */
728 CEE_PHY_LINK_DOWN = 38,
729 CEE_LLS_FCOE_ABSENT = 39,
730 CEE_LLS_FCOE_DOWN = 40,
731 CEE_ISCSI_NOT_COMPATIBLE = 41,
732 CEE_ISCSI_PRI_PFC_OFF = 42,
733 CEE_ISCSI_PRI_OVERLAP_FCOE_PRI = 43
734 };
735 #pragma pack(1)
736 /*
737 * Physical port configuration
738 */
739 struct bfa_port_cfg_s {
740 u8 topology; /* bfa_port_topology */
741 u8 speed; /* enum bfa_port_speed */
742 u8 trunked; /* trunked or not */
743 u8 qos_enabled; /* qos enabled or not */
744 u8 cfg_hardalpa; /* is hard alpa configured */
745 u8 hardalpa; /* configured hard alpa */
746 __be16 maxfrsize; /* maximum frame size */
747 u8 rx_bbcredit; /* receive buffer credits */
748 u8 tx_bbcredit; /* transmit buffer credits */
749 u8 ratelimit; /* ratelimit enabled or not */
750 u8 trl_def_speed; /* ratelimit default speed */
751 u16 path_tov; /* device path timeout */
752 u16 q_depth; /* SCSI Queue depth */
753 };
754 #pragma pack()
755
756 /*
757 * Port attribute values.
758 */
759 struct bfa_port_attr_s {
760 /*
761 * Static fields
762 */
763 wwn_t nwwn; /* node wwn */
764 wwn_t pwwn; /* port wwn */
765 wwn_t factorynwwn; /* factory node wwn */
766 wwn_t factorypwwn; /* factory port wwn */
767 enum fc_cos cos_supported; /* supported class of services */
768 u32 rsvd;
769 struct fc_symname_s port_symname; /* port symbolic name */
770 enum bfa_port_speed speed_supported; /* supported speeds */
771 bfa_boolean_t pbind_enabled;
772
773 /*
774 * Configured values
775 */
776 struct bfa_port_cfg_s pport_cfg; /* pport cfg */
777
778 /*
779 * Dynamic field - info from BFA
780 */
781 enum bfa_port_states port_state; /* current port state */
782 enum bfa_port_speed speed; /* current speed */
783 enum bfa_port_topology topology; /* current topology */
784 bfa_boolean_t beacon; /* current beacon status */
785 bfa_boolean_t link_e2e_beacon; /* link beacon is on */
786 bfa_boolean_t plog_enabled; /* portlog is enabled */
787
788 /*
789 * Dynamic field - info from FCS
790 */
791 u32 pid; /* port ID */
792 enum bfa_port_type port_type; /* current topology */
793 u32 loopback; /* external loopback */
794 u32 authfail; /* auth fail state */
795 bfa_boolean_t io_profile; /* get it from fcpim mod */
796 u8 pad[4]; /* for 64-bit alignement */
797
798 /* FCoE specific */
799 u16 fcoe_vlan;
800 u8 rsvd1[6];
801 };
802
803 /*
804 * Port FCP mappings.
805 */
806 struct bfa_port_fcpmap_s {
807 char osdevname[256];
808 u32 bus;
809 u32 target;
810 u32 oslun;
811 u32 fcid;
812 wwn_t nwwn;
813 wwn_t pwwn;
814 u64 fcplun;
815 char luid[256];
816 };
817
818 /*
819 * Port RNID info.
820 */
821 struct bfa_port_rnid_s {
822 wwn_t wwn;
823 u32 unittype;
824 u32 portid;
825 u32 attached_nodes_num;
826 u16 ip_version;
827 u16 udp_port;
828 u8 ipaddr[16];
829 u16 rsvd;
830 u16 topologydiscoveryflags;
831 };
832
833 #pragma pack(1)
834 struct bfa_fcport_fcf_s {
835 wwn_t name; /* FCF name */
836 wwn_t fabric_name; /* Fabric Name */
837 u8 fipenabled; /* FIP enabled or not */
838 u8 fipfailed; /* FIP failed or not */
839 u8 resv[2];
840 u8 pri; /* FCF priority */
841 u8 version; /* FIP version used */
842 u8 available; /* Available for login */
843 u8 fka_disabled; /* FKA is disabled */
844 u8 maxsz_verified; /* FCoE max size verified */
845 u8 fc_map[3]; /* FC map */
846 __be16 vlan; /* FCoE vlan tag/priority */
847 u32 fka_adv_per; /* FIP ka advert. period */
848 mac_t mac; /* FCF mac */
849 };
850
851 /*
852 * Trunk states for BCU/BFAL
853 */
854 enum bfa_trunk_state {
855 BFA_TRUNK_DISABLED = 0, /* Trunk is not configured */
856 BFA_TRUNK_ONLINE = 1, /* Trunk is online */
857 BFA_TRUNK_OFFLINE = 2, /* Trunk is offline */
858 };
859
860 /*
861 * VC attributes for trunked link
862 */
863 struct bfa_trunk_vc_attr_s {
864 u32 bb_credit;
865 u32 elp_opmode_flags;
866 u32 req_credit;
867 u16 vc_credits[8];
868 };
869
870 /*
871 * Link state information
872 */
873 struct bfa_port_link_s {
874 u8 linkstate; /* Link state bfa_port_linkstate */
875 u8 linkstate_rsn; /* bfa_port_linkstate_rsn_t */
876 u8 topology; /* P2P/LOOP bfa_port_topology */
877 u8 speed; /* Link speed (1/2/4/8 G) */
878 u32 linkstate_opt; /* Linkstate optional data (debug) */
879 u8 trunked; /* Trunked or not (1 or 0) */
880 u8 resvd[3];
881 struct bfa_qos_attr_s qos_attr; /* QoS Attributes */
882 union {
883 struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */
884 struct bfa_trunk_vc_attr_s trunk_vc_attr;
885 struct bfa_fcport_fcf_s fcf; /* FCF information (for FCoE) */
886 } vc_fcf;
887 };
888 #pragma pack()
889
890 enum bfa_trunk_link_fctl {
891 BFA_TRUNK_LINK_FCTL_NORMAL,
892 BFA_TRUNK_LINK_FCTL_VC,
893 BFA_TRUNK_LINK_FCTL_VC_QOS,
894 };
895
896 enum bfa_trunk_link_state {
897 BFA_TRUNK_LINK_STATE_UP = 1, /* link part of trunk */
898 BFA_TRUNK_LINK_STATE_DN_LINKDN = 2, /* physical link down */
899 BFA_TRUNK_LINK_STATE_DN_GRP_MIS = 3, /* trunk group different */
900 BFA_TRUNK_LINK_STATE_DN_SPD_MIS = 4, /* speed mismatch */
901 BFA_TRUNK_LINK_STATE_DN_MODE_MIS = 5, /* remote port not trunked */
902 };
903
904 #define BFA_TRUNK_MAX_PORTS 2
905 struct bfa_trunk_link_attr_s {
906 wwn_t trunk_wwn;
907 enum bfa_trunk_link_fctl fctl;
908 enum bfa_trunk_link_state link_state;
909 enum bfa_port_speed speed;
910 u32 deskew;
911 };
912
913 struct bfa_trunk_attr_s {
914 enum bfa_trunk_state state;
915 enum bfa_port_speed speed;
916 u32 port_id;
917 u32 rsvd;
918 struct bfa_trunk_link_attr_s link_attr[BFA_TRUNK_MAX_PORTS];
919 };
920
921 struct bfa_rport_hal_stats_s {
922 u32 sm_un_cr; /* uninit: create events */
923 u32 sm_un_unexp; /* uninit: exception events */
924 u32 sm_cr_on; /* created: online events */
925 u32 sm_cr_del; /* created: delete events */
926 u32 sm_cr_hwf; /* created: IOC down */
927 u32 sm_cr_unexp; /* created: exception events */
928 u32 sm_fwc_rsp; /* fw create: f/w responses */
929 u32 sm_fwc_del; /* fw create: delete events */
930 u32 sm_fwc_off; /* fw create: offline events */
931 u32 sm_fwc_hwf; /* fw create: IOC down */
932 u32 sm_fwc_unexp; /* fw create: exception events*/
933 u32 sm_on_off; /* online: offline events */
934 u32 sm_on_del; /* online: delete events */
935 u32 sm_on_hwf; /* online: IOC down events */
936 u32 sm_on_unexp; /* online: exception events */
937 u32 sm_fwd_rsp; /* fw delete: fw responses */
938 u32 sm_fwd_del; /* fw delete: delete events */
939 u32 sm_fwd_hwf; /* fw delete: IOC down events */
940 u32 sm_fwd_unexp; /* fw delete: exception events*/
941 u32 sm_off_del; /* offline: delete events */
942 u32 sm_off_on; /* offline: online events */
943 u32 sm_off_hwf; /* offline: IOC down events */
944 u32 sm_off_unexp; /* offline: exception events */
945 u32 sm_del_fwrsp; /* delete: fw responses */
946 u32 sm_del_hwf; /* delete: IOC down events */
947 u32 sm_del_unexp; /* delete: exception events */
948 u32 sm_delp_fwrsp; /* delete pend: fw responses */
949 u32 sm_delp_hwf; /* delete pend: IOC downs */
950 u32 sm_delp_unexp; /* delete pend: exceptions */
951 u32 sm_offp_fwrsp; /* off-pending: fw responses */
952 u32 sm_offp_del; /* off-pending: deletes */
953 u32 sm_offp_hwf; /* off-pending: IOC downs */
954 u32 sm_offp_unexp; /* off-pending: exceptions */
955 u32 sm_iocd_off; /* IOC down: offline events */
956 u32 sm_iocd_del; /* IOC down: delete events */
957 u32 sm_iocd_on; /* IOC down: online events */
958 u32 sm_iocd_unexp; /* IOC down: exceptions */
959 u32 rsvd;
960 };
961 #pragma pack(1)
962 /*
963 * Rport's QoS attributes
964 */
965 struct bfa_rport_qos_attr_s {
966 u8 qos_priority; /* rport's QoS priority */
967 u8 rsvd[3];
968 u32 qos_flow_id; /* QoS flow Id */
969 };
970 #pragma pack()
971
972 #define BFA_IOBUCKET_MAX 14
973
974 struct bfa_itnim_latency_s {
975 u32 min[BFA_IOBUCKET_MAX];
976 u32 max[BFA_IOBUCKET_MAX];
977 u32 count[BFA_IOBUCKET_MAX];
978 u32 avg[BFA_IOBUCKET_MAX];
979 };
980
981 struct bfa_itnim_ioprofile_s {
982 u32 clock_res_mul;
983 u32 clock_res_div;
984 u32 index;
985 u32 io_profile_start_time; /* IO profile start time */
986 u32 iocomps[BFA_IOBUCKET_MAX]; /* IO completed */
987 struct bfa_itnim_latency_s io_latency;
988 };
989
990 /*
991 * FC physical port statistics.
992 */
993 struct bfa_port_fc_stats_s {
994 u64 secs_reset; /* Seconds since stats is reset */
995 u64 tx_frames; /* Tx frames */
996 u64 tx_words; /* Tx words */
997 u64 tx_lip; /* Tx LIP */
998 u64 tx_nos; /* Tx NOS */
999 u64 tx_ols; /* Tx OLS */
1000 u64 tx_lr; /* Tx LR */
1001 u64 tx_lrr; /* Tx LRR */
1002 u64 rx_frames; /* Rx frames */
1003 u64 rx_words; /* Rx words */
1004 u64 lip_count; /* Rx LIP */
1005 u64 nos_count; /* Rx NOS */
1006 u64 ols_count; /* Rx OLS */
1007 u64 lr_count; /* Rx LR */
1008 u64 lrr_count; /* Rx LRR */
1009 u64 invalid_crcs; /* Rx CRC err frames */
1010 u64 invalid_crc_gd_eof; /* Rx CRC err good EOF frames */
1011 u64 undersized_frm; /* Rx undersized frames */
1012 u64 oversized_frm; /* Rx oversized frames */
1013 u64 bad_eof_frm; /* Rx frames with bad EOF */
1014 u64 error_frames; /* Errored frames */
1015 u64 dropped_frames; /* Dropped frames */
1016 u64 link_failures; /* Link Failure (LF) count */
1017 u64 loss_of_syncs; /* Loss of sync count */
1018 u64 loss_of_signals; /* Loss of signal count */
1019 u64 primseq_errs; /* Primitive sequence protocol err. */
1020 u64 bad_os_count; /* Invalid ordered sets */
1021 u64 err_enc_out; /* Encoding err nonframe_8b10b */
1022 u64 err_enc; /* Encoding err frame_8b10b */
1023 };
1024
1025 /*
1026 * Eth Physical Port statistics.
1027 */
1028 struct bfa_port_eth_stats_s {
1029 u64 secs_reset; /* Seconds since stats is reset */
1030 u64 frame_64; /* Frames 64 bytes */
1031 u64 frame_65_127; /* Frames 65-127 bytes */
1032 u64 frame_128_255; /* Frames 128-255 bytes */
1033 u64 frame_256_511; /* Frames 256-511 bytes */
1034 u64 frame_512_1023; /* Frames 512-1023 bytes */
1035 u64 frame_1024_1518; /* Frames 1024-1518 bytes */
1036 u64 frame_1519_1522; /* Frames 1519-1522 bytes */
1037 u64 tx_bytes; /* Tx bytes */
1038 u64 tx_packets; /* Tx packets */
1039 u64 tx_mcast_packets; /* Tx multicast packets */
1040 u64 tx_bcast_packets; /* Tx broadcast packets */
1041 u64 tx_control_frame; /* Tx control frame */
1042 u64 tx_drop; /* Tx drops */
1043 u64 tx_jabber; /* Tx jabber */
1044 u64 tx_fcs_error; /* Tx FCS errors */
1045 u64 tx_fragments; /* Tx fragments */
1046 u64 rx_bytes; /* Rx bytes */
1047 u64 rx_packets; /* Rx packets */
1048 u64 rx_mcast_packets; /* Rx multicast packets */
1049 u64 rx_bcast_packets; /* Rx broadcast packets */
1050 u64 rx_control_frames; /* Rx control frames */
1051 u64 rx_unknown_opcode; /* Rx unknown opcode */
1052 u64 rx_drop; /* Rx drops */
1053 u64 rx_jabber; /* Rx jabber */
1054 u64 rx_fcs_error; /* Rx FCS errors */
1055 u64 rx_alignment_error; /* Rx alignment errors */
1056 u64 rx_frame_length_error; /* Rx frame len errors */
1057 u64 rx_code_error; /* Rx code errors */
1058 u64 rx_fragments; /* Rx fragments */
1059 u64 rx_pause; /* Rx pause */
1060 u64 rx_zero_pause; /* Rx zero pause */
1061 u64 tx_pause; /* Tx pause */
1062 u64 tx_zero_pause; /* Tx zero pause */
1063 u64 rx_fcoe_pause; /* Rx FCoE pause */
1064 u64 rx_fcoe_zero_pause; /* Rx FCoE zero pause */
1065 u64 tx_fcoe_pause; /* Tx FCoE pause */
1066 u64 tx_fcoe_zero_pause; /* Tx FCoE zero pause */
1067 u64 rx_iscsi_pause; /* Rx iSCSI pause */
1068 u64 rx_iscsi_zero_pause; /* Rx iSCSI zero pause */
1069 u64 tx_iscsi_pause; /* Tx iSCSI pause */
1070 u64 tx_iscsi_zero_pause; /* Tx iSCSI zero pause */
1071 };
1072
1073 /*
1074 * Port statistics.
1075 */
1076 union bfa_port_stats_u {
1077 struct bfa_port_fc_stats_s fc;
1078 struct bfa_port_eth_stats_s eth;
1079 };
1080
1081 #endif /* __BFA_DEFS_SVC_H__ */