Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
0004  * Copyright (c) 2014- QLogic Corporation.
0005  * All rights reserved
0006  * www.qlogic.com
0007  *
0008  * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
0009  */
0010 
0011 #ifndef __BFA_DEFS_SVC_H__
0012 #define __BFA_DEFS_SVC_H__
0013 
0014 #include "bfa_defs.h"
0015 #include "bfa_fc.h"
0016 #include "bfi.h"
0017 
0018 #define BFA_IOCFC_INTR_DELAY    1125
0019 #define BFA_IOCFC_INTR_LATENCY  225
0020 #define BFA_IOCFCOE_INTR_DELAY  25
0021 #define BFA_IOCFCOE_INTR_LATENCY 5
0022 
0023 /*
0024  * Interrupt coalescing configuration.
0025  */
0026 #pragma pack(1)
0027 struct bfa_iocfc_intr_attr_s {
0028     u8      coalesce;   /*  enable/disable coalescing */
0029     u8      rsvd[3];
0030     __be16      latency;    /*  latency in microseconds   */
0031     __be16      delay;      /*  delay in microseconds     */
0032 };
0033 
0034 /*
0035  * IOC firmware configuraton
0036  */
0037 struct bfa_iocfc_fwcfg_s {
0038     u16     num_fabrics;    /*  number of fabrics       */
0039     u16     num_lports; /*  number of local lports  */
0040     u16     num_rports; /*  number of remote ports  */
0041     u16     num_ioim_reqs;  /*  number of IO reqs       */
0042     u16     num_tskim_reqs; /*  task management requests    */
0043     u16     num_fwtio_reqs; /* number of TM IO reqs in FW   */
0044     u16     num_fcxp_reqs;  /*  unassisted FC exchanges */
0045     u16     num_uf_bufs;    /*  unsolicited recv buffers    */
0046     u8      num_cqs;
0047     u8      fw_tick_res;    /*  FW clock resolution in ms */
0048     u8      rsvd[6];
0049 };
0050 #pragma pack()
0051 
0052 struct bfa_iocfc_drvcfg_s {
0053     u16     num_reqq_elems; /*  number of req queue elements */
0054     u16     num_rspq_elems; /*  number of rsp queue elements */
0055     u16     num_sgpgs;  /*  number of total SG pages     */
0056     u16     num_sboot_tgts; /*  number of SAN boot targets   */
0057     u16     num_sboot_luns; /*  number of SAN boot luns  */
0058     u16     ioc_recover;    /*  IOC recovery mode        */
0059     u16     min_cfg;    /*  minimum configuration    */
0060     u16     path_tov;   /*  device path timeout     */
0061     u16     num_tio_reqs;   /* number of TM IO reqs */
0062     u8      port_mode;
0063     u8      rsvd_a;
0064     bfa_boolean_t   delay_comp; /* delay completion of failed
0065                      * inflight IOs */
0066     u16     num_ttsk_reqs;   /* TM task management requests */
0067     u32     rsvd;
0068 };
0069 
0070 /*
0071  * IOC configuration
0072  */
0073 struct bfa_iocfc_cfg_s {
0074     struct bfa_iocfc_fwcfg_s    fwcfg;  /*  firmware side config */
0075     struct bfa_iocfc_drvcfg_s   drvcfg; /*  driver side config    */
0076 };
0077 
0078 /*
0079  * IOC firmware IO stats
0080  */
0081 struct bfa_fw_ioim_stats_s {
0082     u32 host_abort;     /*  IO aborted by host driver*/
0083     u32 host_cleanup;       /*  IO clean up by host driver */
0084 
0085     u32 fw_io_timeout;      /*  IOs timedout */
0086     u32 fw_frm_parse;       /*  frame parsed by f/w */
0087     u32 fw_frm_data;        /*  fcp_data frame parsed by f/w */
0088     u32 fw_frm_rsp;     /*  fcp_rsp frame parsed by f/w */
0089     u32 fw_frm_xfer_rdy;    /*  xfer_rdy frame parsed by f/w */
0090     u32 fw_frm_bls_acc;     /*  BLS ACC  frame parsed by f/w */
0091     u32 fw_frm_tgt_abort;   /*  target ABTS parsed by f/w */
0092     u32 fw_frm_unknown;     /*  unknown parsed by f/w */
0093     u32 fw_data_dma;        /*  f/w DMA'ed the data frame */
0094     u32 fw_frm_drop;        /*  f/w drop the frame */
0095 
0096     u32 rec_timeout;        /*  FW rec timed out */
0097     u32 error_rec;      /*  FW sending rec on
0098                      *  an error condition*/
0099     u32 wait_for_si;        /*  FW wait for SI */
0100     u32 rec_rsp_inval;      /*  REC rsp invalid */
0101     u32     rec_rsp_xchg_comp;  /*  REC rsp xchg complete */
0102     u32     rec_rsp_rd_si_ownd; /*  REC rsp read si owned */
0103 
0104     u32 seqr_io_abort;      /*  target does not know cmd so abort */
0105     u32 seqr_io_retry;      /*  SEQR failed so retry IO */
0106 
0107     u32 itn_cisc_upd_rsp;   /*  ITN cisc updated on fcp_rsp */
0108     u32 itn_cisc_upd_data;  /*  ITN cisc updated on fcp_data */
0109     u32 itn_cisc_upd_xfer_rdy;  /*  ITN cisc updated on fcp_data */
0110 
0111     u32 fcp_data_lost;      /*  fcp data lost */
0112 
0113     u32 ro_set_in_xfer_rdy; /*  Target set RO in Xfer_rdy frame */
0114     u32 xfer_rdy_ooo_err;   /*  Out of order Xfer_rdy received */
0115     u32 xfer_rdy_unknown_err;   /*  unknown error in xfer_rdy frame */
0116 
0117     u32 io_abort_timeout;   /*  ABTS timedout  */
0118     u32 sler_initiated;     /*  SLER initiated */
0119 
0120     u32 unexp_fcp_rsp;      /*  fcp response in wrong state */
0121 
0122     u32 fcp_rsp_under_run;  /*  fcp rsp IO underrun */
0123     u32     fcp_rsp_under_run_wr;   /*  fcp rsp IO underrun for write */
0124     u32 fcp_rsp_under_run_err;  /*  fcp rsp IO underrun error */
0125     u32     fcp_rsp_resid_inval;    /*  invalid residue */
0126     u32 fcp_rsp_over_run;   /*  fcp rsp IO overrun */
0127     u32 fcp_rsp_over_run_err;   /*  fcp rsp IO overrun error */
0128     u32 fcp_rsp_proto_err;  /*  protocol error in fcp rsp */
0129     u32 fcp_rsp_sense_err;  /*  error in sense info in fcp rsp */
0130     u32 fcp_conf_req;       /*  FCP conf requested */
0131 
0132     u32 tgt_aborted_io;     /*  target initiated abort */
0133 
0134     u32 ioh_edtov_timeout_event;/*  IOH edtov timer popped */
0135     u32 ioh_fcp_rsp_excp_event; /*  IOH FCP_RSP exception */
0136     u32 ioh_fcp_conf_event; /*  IOH FCP_CONF */
0137     u32 ioh_mult_frm_rsp_event; /*  IOH multi_frame FCP_RSP */
0138     u32 ioh_hit_class2_event;   /*  IOH hit class2 */
0139     u32 ioh_miss_other_event;   /*  IOH miss other */
0140     u32 ioh_seq_cnt_err_event;  /*  IOH seq cnt error */
0141     u32 ioh_len_err_event;  /*  IOH len error - fcp_dl !=
0142                      *  bytes xfered */
0143     u32 ioh_seq_len_err_event;  /*  IOH seq len error */
0144     u32 ioh_data_oor_event; /*  Data out of range */
0145     u32 ioh_ro_ooo_event;   /*  Relative offset out of range */
0146     u32 ioh_cpu_owned_event;    /*  IOH hit -iost owned by f/w */
0147     u32 ioh_unexp_frame_event;  /*  unexpected frame received
0148                      *  count */
0149     u32 ioh_err_int;        /*  IOH error int during data-phase
0150                      *  for scsi write */
0151 };
0152 
0153 struct bfa_fw_tio_stats_s {
0154     u32 tio_conf_proc;      /* TIO CONF processed */
0155     u32 tio_conf_drop;      /* TIO CONF dropped */
0156     u32 tio_cleanup_req;    /* TIO cleanup requested */
0157     u32 tio_cleanup_comp;   /* TIO cleanup completed */
0158     u32 tio_abort_rsp;      /* TIO abort response */
0159     u32 tio_abort_rsp_comp; /* TIO abort rsp completed */
0160     u32 tio_abts_req;       /* TIO ABTS requested */
0161     u32 tio_abts_ack;       /* TIO ABTS ack-ed */
0162     u32 tio_abts_ack_nocomp;/* TIO ABTS ack-ed but not completed */
0163     u32 tio_abts_tmo;       /* TIO ABTS timeout */
0164     u32 tio_snsdata_dma;    /* TIO sense data DMA */
0165     u32 tio_rxwchan_wait;   /* TIO waiting for RX wait channel */
0166     u32 tio_rxwchan_avail;  /* TIO RX wait channel available */
0167     u32 tio_hit_bls;        /* TIO IOH BLS event */
0168     u32 tio_uf_recv;        /* TIO received UF */
0169     u32 tio_rd_invalid_sm;  /* TIO read reqst in wrong state machine */
0170     u32 tio_wr_invalid_sm;  /* TIO write reqst in wrong state machine */
0171 
0172     u32 ds_rxwchan_wait;    /* DS waiting for RX wait channel */
0173     u32 ds_rxwchan_avail;   /* DS RX wait channel available */
0174     u32 ds_unaligned_rd;    /* DS unaligned read */
0175     u32 ds_rdcomp_invalid_sm; /* DS read completed in wrong state
0176                        * machine */
0177     u32 ds_wrcomp_invalid_sm; /* DS write completed in wrong state
0178                        * machine */
0179     u32 ds_flush_req;       /* DS flush requested */
0180     u32 ds_flush_comp;      /* DS flush completed */
0181     u32 ds_xfrdy_exp;       /* DS XFER_RDY expired */
0182     u32 ds_seq_cnt_err;     /* DS seq cnt error */
0183     u32 ds_seq_len_err;     /* DS seq len error */
0184     u32 ds_data_oor;        /* DS data out of order */
0185     u32 ds_hit_bls;     /* DS hit BLS */
0186     u32 ds_edtov_timer_exp; /* DS edtov expired */
0187     u32 ds_cpu_owned;       /* DS cpu owned */
0188     u32 ds_hit_class2;      /* DS hit class2 */
0189     u32 ds_length_err;      /* DS length error */
0190     u32 ds_ro_ooo_err;      /* DS relative offset out-of-order error */
0191     u32 ds_rectov_timer_exp;/* DS rectov expired */
0192     u32 ds_unexp_fr_err;    /* DS unexp frame error */
0193 };
0194 
0195 /*
0196  * IOC firmware IO stats
0197  */
0198 struct bfa_fw_io_stats_s {
0199     struct bfa_fw_ioim_stats_s  ioim_stats;
0200     struct bfa_fw_tio_stats_s   tio_stats;
0201 };
0202 
0203 /*
0204  * IOC port firmware stats
0205  */
0206 
0207 struct bfa_fw_port_fpg_stats_s {
0208     u32    intr_evt;
0209     u32    intr;
0210     u32    intr_excess;
0211     u32    intr_cause0;
0212     u32    intr_other;
0213     u32    intr_other_ign;
0214     u32    sig_lost;
0215     u32    sig_regained;
0216     u32    sync_lost;
0217     u32    sync_to;
0218     u32    sync_regained;
0219     u32    div2_overflow;
0220     u32    div2_underflow;
0221     u32    efifo_overflow;
0222     u32    efifo_underflow;
0223     u32    idle_rx;
0224     u32    lrr_rx;
0225     u32    lr_rx;
0226     u32    ols_rx;
0227     u32    nos_rx;
0228     u32    lip_rx;
0229     u32    arbf0_rx;
0230     u32    arb_rx;
0231     u32    mrk_rx;
0232     u32    const_mrk_rx;
0233     u32    prim_unknown;
0234 };
0235 
0236 
0237 struct bfa_fw_port_lksm_stats_s {
0238     u32    hwsm_success;       /*  hwsm state machine success          */
0239     u32    hwsm_fails;         /*  hwsm fails                          */
0240     u32    hwsm_wdtov;         /*  hwsm timed out                      */
0241     u32    swsm_success;       /*  swsm success                        */
0242     u32    swsm_fails;         /*  swsm fails                          */
0243     u32    swsm_wdtov;         /*  swsm timed out                      */
0244     u32    busybufs;           /*  link init failed due to busybuf     */
0245     u32    buf_waits;          /*  bufwait state entries               */
0246     u32    link_fails;         /*  link failures                       */
0247     u32    psp_errors;         /*  primitive sequence protocol errors  */
0248     u32    lr_unexp;           /*  No. of times LR rx-ed unexpectedly  */
0249     u32    lrr_unexp;          /*  No. of times LRR rx-ed unexpectedly */
0250     u32    lr_tx;              /*  No. of times LR tx started          */
0251     u32    lrr_tx;             /*  No. of times LRR tx started         */
0252     u32    ols_tx;             /*  No. of times OLS tx started         */
0253     u32    nos_tx;             /*  No. of times NOS tx started         */
0254     u32    hwsm_lrr_rx;        /*  No. of times LRR rx-ed by HWSM      */
0255     u32    hwsm_lr_rx;         /*  No. of times LR rx-ed by HWSM       */
0256 };
0257 
0258 struct bfa_fw_port_snsm_stats_s {
0259     u32    hwsm_success;       /*  Successful hwsm terminations        */
0260     u32    hwsm_fails;         /*  hwsm fail count                     */
0261     u32    hwsm_wdtov;         /*  hwsm timed out                      */
0262     u32    swsm_success;       /*  swsm success                        */
0263     u32    swsm_wdtov;         /*  swsm timed out                      */
0264     u32    error_resets;       /*  error resets initiated by upsm      */
0265     u32    sync_lost;          /*  Sync loss count                     */
0266     u32    sig_lost;           /*  Signal loss count                   */
0267     u32    asn8g_attempts;     /* SNSM HWSM at 8Gbps attempts      */
0268     u32    adapt_success;      /* SNSM adaptation success   */
0269     u32    adapt_fails;    /* SNSM adaptation failures */
0270     u32    adapt_ign_fails;    /* SNSM adaptation failures ignored */
0271 };
0272 
0273 struct bfa_fw_port_physm_stats_s {
0274     u32    module_inserts;     /*  Module insert count                 */
0275     u32    module_xtracts;     /*  Module extracts count               */
0276     u32    module_invalids;    /*  Invalid module inserted count       */
0277     u32    module_read_ign;    /*  Module validation status ignored    */
0278     u32    laser_faults;       /*  Laser fault count                   */
0279     u32    rsvd;
0280 };
0281 
0282 struct bfa_fw_fip_stats_s {
0283     u32    vlan_req;           /*  vlan discovery requests             */
0284     u32    vlan_notify;        /*  vlan notifications                  */
0285     u32    vlan_err;           /*  vlan response error                 */
0286     u32    vlan_timeouts;      /*  vlan disvoery timeouts              */
0287     u32    vlan_invalids;      /*  invalid vlan in discovery advert.   */
0288     u32    disc_req;           /*  Discovery solicit requests          */
0289     u32    disc_rsp;           /*  Discovery solicit response          */
0290     u32    disc_err;           /*  Discovery advt. parse errors        */
0291     u32    disc_unsol;         /*  Discovery unsolicited               */
0292     u32    disc_timeouts;      /*  Discovery timeouts                  */
0293     u32    disc_fcf_unavail;   /*  Discovery FCF Not Avail.            */
0294     u32    linksvc_unsupp;     /*  Unsupported link service req        */
0295     u32    linksvc_err;        /*  Parse error in link service req     */
0296     u32    logo_req;           /*  FIP logos received                  */
0297     u32    clrvlink_req;       /*  Clear virtual link req              */
0298     u32    op_unsupp;          /*  Unsupported FIP operation           */
0299     u32    untagged;           /*  Untagged frames (ignored)           */
0300     u32    invalid_version;    /*  Invalid FIP version                 */
0301 };
0302 
0303 struct bfa_fw_lps_stats_s {
0304     u32    mac_invalids;       /*  Invalid mac assigned                */
0305     u32    rsvd;
0306 };
0307 
0308 struct bfa_fw_fcoe_stats_s {
0309     u32    cee_linkups;        /*  CEE link up count                   */
0310     u32    cee_linkdns;        /*  CEE link down count                 */
0311     u32    fip_linkups;        /*  FIP link up count                   */
0312     u32    fip_linkdns;        /*  FIP link up count                   */
0313     u32    fip_fails;          /*  FIP fail count                      */
0314     u32    mac_invalids;       /*  Invalid mac assigned                */
0315 };
0316 
0317 /*
0318  * IOC firmware FCoE port stats
0319  */
0320 struct bfa_fw_fcoe_port_stats_s {
0321     struct bfa_fw_fcoe_stats_s      fcoe_stats;
0322     struct bfa_fw_fip_stats_s       fip_stats;
0323 };
0324 
0325 /**
0326  * @brief LPSM statistics
0327  */
0328 struct bfa_fw_lpsm_stats_s {
0329     u32 cls_rx;     /* LPSM cls_rx          */
0330     u32 cls_tx;     /* LPSM cls_tx          */
0331     u32 arbf0_rx;   /* LPSM abrf0 rcvd      */
0332     u32 arbf0_tx;   /* LPSM abrf0 xmit      */
0333     u32 init_rx;    /* LPSM loop init start     */
0334     u32 unexp_hwst; /* LPSM unknown hw state    */
0335     u32 unexp_frame;    /* LPSM unknown_frame       */
0336     u32 unexp_prim; /* LPSM unexpected primitive    */
0337     u32 prev_alpa_unavail; /* LPSM prev alpa unavailable */
0338     u32 alpa_unavail;   /* LPSM alpa not available  */
0339     u32 lip_rx;     /* LPSM lip rcvd        */
0340     u32 lip_f7f7_rx;    /* LPSM lip f7f7 rcvd       */
0341     u32 lip_f8_rx;  /* LPSM lip f8 rcvd     */
0342     u32 lip_f8f7_rx;    /* LPSM lip f8f7 rcvd       */
0343     u32 lip_other_rx;   /* LPSM lip other rcvd      */
0344     u32 lip_tx;     /* LPSM lip xmit        */
0345     u32 retry_tov;  /* LPSM retry TOV       */
0346     u32 lip_tov;    /* LPSM LIP wait TOV        */
0347     u32 idle_tov;   /* LPSM idle wait TOV       */
0348     u32 arbf0_tov;  /* LPSM arbfo wait TOV      */
0349     u32 stop_loop_tov;  /* LPSM stop loop wait TOV  */
0350     u32 lixa_tov;   /* LPSM lisa wait TOV       */
0351     u32 lixx_tov;   /* LPSM lilp/lirp wait TOV  */
0352     u32 cls_tov;    /* LPSM cls wait TOV        */
0353     u32 sler;       /* LPSM SLER recvd      */
0354     u32 failed;     /* LPSM failed          */
0355     u32 success;    /* LPSM online          */
0356 };
0357 
0358 /*
0359  * IOC firmware FC uport stats
0360  */
0361 struct bfa_fw_fc_uport_stats_s {
0362     struct bfa_fw_port_snsm_stats_s     snsm_stats;
0363     struct bfa_fw_port_lksm_stats_s     lksm_stats;
0364     struct bfa_fw_lpsm_stats_s      lpsm_stats;
0365 };
0366 
0367 /*
0368  * IOC firmware FC port stats
0369  */
0370 union bfa_fw_fc_port_stats_s {
0371     struct bfa_fw_fc_uport_stats_s      fc_stats;
0372     struct bfa_fw_fcoe_port_stats_s     fcoe_stats;
0373 };
0374 
0375 /*
0376  * IOC firmware port stats
0377  */
0378 struct bfa_fw_port_stats_s {
0379     struct bfa_fw_port_fpg_stats_s      fpg_stats;
0380     struct bfa_fw_port_physm_stats_s    physm_stats;
0381     union  bfa_fw_fc_port_stats_s       fc_port;
0382 };
0383 
0384 /*
0385  * fcxchg module statistics
0386  */
0387 struct bfa_fw_fcxchg_stats_s {
0388     u32 ua_tag_inv;
0389     u32 ua_state_inv;
0390 };
0391 
0392 /*
0393  *  Trunk statistics
0394  */
0395 struct bfa_fw_trunk_stats_s {
0396     u32 emt_recvd;      /*  Trunk EMT received      */
0397     u32 emt_accepted;   /*  Trunk EMT Accepted      */
0398     u32 emt_rejected;   /*  Trunk EMT rejected      */
0399     u32 etp_recvd;      /*  Trunk ETP received      */
0400     u32 etp_accepted;   /*  Trunk ETP Accepted      */
0401     u32 etp_rejected;   /*  Trunk ETP rejected      */
0402     u32 lr_recvd;       /*  Trunk LR received       */
0403     u32 rsvd;       /*  padding for 64 bit alignment */
0404 };
0405 
0406 struct bfa_fw_aport_stats_s {
0407     u32 flogi_sent;     /*  Flogi sent          */
0408     u32 flogi_acc_recvd;    /*  Flogi Acc received      */
0409     u32 flogi_rjt_recvd;    /*  Flogi rejects received  */
0410     u32 flogi_retries;  /*  Flogi retries       */
0411 
0412     u32 elp_recvd;      /*  ELP received        */
0413     u32 elp_accepted;   /*  ELP Accepted        */
0414     u32 elp_rejected;   /*  ELP rejected        */
0415     u32 elp_dropped;    /*  ELP dropped         */
0416 
0417     u32 bbcr_lr_count;  /*!< BBCR Link Resets       */
0418     u32 frame_lost_intrs;   /*!< BBCR Frame loss intrs  */
0419     u32 rrdy_lost_intrs;    /*!< BBCR Rrdy loss intrs   */
0420 
0421     u32 rsvd;
0422 };
0423 
0424 /*
0425  * IOCFC firmware stats
0426  */
0427 struct bfa_fw_iocfc_stats_s {
0428     u32 cfg_reqs;   /*  cfg request */
0429     u32 updq_reqs;  /*  update queue request */
0430     u32 ic_reqs;    /*  interrupt coalesce reqs */
0431     u32 unknown_reqs;
0432     u32 set_intr_reqs;  /*  set interrupt reqs */
0433 };
0434 
0435 /*
0436  * IOC attributes returned in queries
0437  */
0438 struct bfa_iocfc_attr_s {
0439     struct bfa_iocfc_cfg_s      config;     /*  IOCFC config   */
0440     struct bfa_iocfc_intr_attr_s    intr_attr;  /*  interrupt attr */
0441 };
0442 
0443 /*
0444  * Eth_sndrcv mod stats
0445  */
0446 struct bfa_fw_eth_sndrcv_stats_s {
0447     u32 crc_err;
0448     u32 rsvd;       /*  64bit align    */
0449 };
0450 
0451 /*
0452  * CT MAC mod stats
0453  */
0454 struct bfa_fw_mac_mod_stats_s {
0455     u32 mac_on;     /*  MAC got turned-on */
0456     u32 link_up;    /*  link-up */
0457     u32 signal_off; /*  lost signal */
0458     u32 dfe_on;     /*  DFE on */
0459     u32 mac_reset;  /*  # of MAC reset to bring lnk up */
0460     u32 pcs_reset;  /*  # of PCS reset to bring lnk up */
0461     u32 loopback;   /*  MAC got into serdes loopback */
0462     u32 lb_mac_reset;
0463             /*  # of MAC reset to bring link up in loopback */
0464     u32 lb_pcs_reset;
0465             /*  # of PCS reset to bring link up in loopback */
0466     u32 rsvd;       /*  64bit align    */
0467 };
0468 
0469 /*
0470  * CT MOD stats
0471  */
0472 struct bfa_fw_ct_mod_stats_s {
0473     u32 rxa_rds_undrun; /*  RxA RDS underrun */
0474     u32 rad_bpc_ovfl;   /*  RAD BPC overflow */
0475     u32 rad_rlb_bpc_ovfl; /*  RAD RLB BPC overflow */
0476     u32 bpc_fcs_err;    /*  BPC FCS_ERR */
0477     u32 txa_tso_hdr;    /*  TxA TSO header too long */
0478     u32 rsvd;       /*  64bit align    */
0479 };
0480 
0481 /*
0482  * RDS mod stats
0483  */
0484 struct bfa_fw_rds_stats_s {
0485     u32 no_fid_drop_err; /* RDS no fid drop error */
0486     u32 rsvd;        /* 64bit align */
0487 };
0488 
0489 /*
0490  * IOC firmware stats
0491  */
0492 struct bfa_fw_stats_s {
0493     struct bfa_fw_ioc_stats_s   ioc_stats;
0494     struct bfa_fw_iocfc_stats_s iocfc_stats;
0495     struct bfa_fw_io_stats_s    io_stats;
0496     struct bfa_fw_port_stats_s  port_stats;
0497     struct bfa_fw_fcxchg_stats_s    fcxchg_stats;
0498     struct bfa_fw_lps_stats_s   lps_stats;
0499     struct bfa_fw_trunk_stats_s trunk_stats;
0500     struct bfa_fw_aport_stats_s aport_stats;
0501     struct bfa_fw_mac_mod_stats_s   macmod_stats;
0502     struct bfa_fw_ct_mod_stats_s    ctmod_stats;
0503     struct bfa_fw_eth_sndrcv_stats_s    ethsndrcv_stats;
0504     struct bfa_fw_rds_stats_s   rds_stats;
0505 };
0506 
0507 #define BFA_IOCFC_PATHTOV_MAX   60
0508 #define BFA_IOCFC_QDEPTH_MAX    2000
0509 
0510 /*
0511  * QoS states
0512  */
0513 enum bfa_qos_state {
0514     BFA_QOS_DISABLED = 0,       /* QoS is disabled */
0515     BFA_QOS_ONLINE = 1,     /*  QoS is online */
0516     BFA_QOS_OFFLINE = 2,        /*  QoS is offline */
0517 };
0518 
0519 /*
0520  * QoS  Priority levels.
0521  */
0522 enum bfa_qos_priority {
0523     BFA_QOS_UNKNOWN = 0,
0524     BFA_QOS_HIGH  = 1,  /*  QoS Priority Level High */
0525     BFA_QOS_MED  =  2,  /*  QoS Priority Level Medium */
0526     BFA_QOS_LOW  =  3,  /*  QoS Priority Level Low */
0527 };
0528 
0529 /*
0530  * QoS  bandwidth allocation for each priority level
0531  */
0532 enum bfa_qos_bw_alloc {
0533     BFA_QOS_BW_HIGH  = 60,  /*  bandwidth allocation for High */
0534     BFA_QOS_BW_MED  =  30,  /*  bandwidth allocation for Medium */
0535     BFA_QOS_BW_LOW  =  10,  /*  bandwidth allocation for Low */
0536 };
0537 #pragma pack(1)
0538 
0539 struct bfa_qos_bw_s {
0540     u8  qos_bw_set;
0541     u8  high;
0542     u8  med;
0543     u8  low;
0544 };
0545 
0546 /*
0547  * QoS attribute returned in QoS Query
0548  */
0549 struct bfa_qos_attr_s {
0550     u8  state;      /*  QoS current state */
0551     u8  rsvd1[3];
0552     u32 total_bb_cr;    /*  Total BB Credits */
0553     struct bfa_qos_bw_s qos_bw; /* QOS bw cfg */
0554     struct bfa_qos_bw_s qos_bw_op;  /* QOS bw operational */
0555 };
0556 
0557 enum bfa_bbcr_state {
0558     BFA_BBCR_DISABLED,  /*!< BBCR is disable */
0559     BFA_BBCR_ONLINE,    /*!< BBCR is online  */
0560     BFA_BBCR_OFFLINE,   /*!< BBCR is offline */
0561 };
0562 
0563 enum bfa_bbcr_err_reason {
0564     BFA_BBCR_ERR_REASON_NONE, /*!< Unknown */
0565     BFA_BBCR_ERR_REASON_SPEED_UNSUP, /*!< Port speed < max sup_speed */
0566     BFA_BBCR_ERR_REASON_PEER_UNSUP, /*!< BBCR is disable on peer port */
0567     BFA_BBCR_ERR_REASON_NON_BRCD_SW, /*!< Connected to non BRCD switch */
0568     BFA_BBCR_ERR_REASON_FLOGI_RJT, /*!< Login rejected by the switch */
0569 };
0570 
0571 struct bfa_bbcr_attr_s {
0572     u8  state;
0573     u8  peer_bb_scn;
0574     u8  reason;
0575     u8  rsvd;
0576 };
0577 
0578 /*
0579  * These fields should be displayed only from the CLI.
0580  * There will be a separate BFAL API (get_qos_vc_attr ?)
0581  * to retrieve this.
0582  *
0583  */
0584 #define  BFA_QOS_MAX_VC  16
0585 
0586 struct bfa_qos_vc_info_s {
0587     u8 vc_credit;
0588     u8 borrow_credit;
0589     u8 priority;
0590     u8 resvd;
0591 };
0592 
0593 struct bfa_qos_vc_attr_s {
0594     u16  total_vc_count;                    /*  Total VC Count */
0595     u16  shared_credit;
0596     u32  elp_opmode_flags;
0597     struct bfa_qos_vc_info_s vc_info[BFA_QOS_MAX_VC];  /* as many as
0598                                 * total_vc_count */
0599 };
0600 
0601 /*
0602  * QoS statistics
0603  */
0604 struct bfa_qos_stats_s {
0605     u32 flogi_sent;     /*  QoS Flogi sent */
0606     u32 flogi_acc_recvd;    /*  QoS Flogi Acc received */
0607     u32 flogi_rjt_recvd;    /*  QoS Flogi rejects received */
0608     u32 flogi_retries;      /*  QoS Flogi retries */
0609 
0610     u32 elp_recvd;      /*  QoS ELP received */
0611     u32 elp_accepted;       /*  QoS ELP Accepted */
0612     u32 elp_rejected;       /*  QoS ELP rejected */
0613     u32 elp_dropped;        /*  QoS ELP dropped  */
0614 
0615     u32 qos_rscn_recvd;     /*  QoS RSCN received */
0616     u32 rsvd;           /* padding for 64 bit alignment */
0617 };
0618 
0619 /*
0620  * FCoE statistics
0621  */
0622 struct bfa_fcoe_stats_s {
0623     u64 secs_reset; /*  Seconds since stats reset        */
0624     u64 cee_linkups;    /*  CEE link up              */
0625     u64 cee_linkdns;    /*  CEE link down            */
0626     u64 fip_linkups;    /*  FIP link up              */
0627     u64 fip_linkdns;    /*  FIP link down            */
0628     u64 fip_fails;  /*  FIP failures             */
0629     u64 mac_invalids;   /*  Invalid mac assignments      */
0630     u64 vlan_req;   /*  Vlan requests            */
0631     u64 vlan_notify;    /*  Vlan notifications           */
0632     u64 vlan_err;   /*  Vlan notification errors         */
0633     u64 vlan_timeouts;  /*  Vlan request timeouts        */
0634     u64 vlan_invalids;  /*  Vlan invalids            */
0635     u64 disc_req;   /*  Discovery requests           */
0636     u64 disc_rsp;   /*  Discovery responses          */
0637     u64 disc_err;   /*  Discovery error frames       */
0638     u64 disc_unsol; /*  Discovery unsolicited        */
0639     u64 disc_timeouts;  /*  Discovery timeouts           */
0640     u64 disc_fcf_unavail; /*  Discovery FCF not avail        */
0641     u64 linksvc_unsupp; /*  FIP link service req unsupp      */
0642     u64 linksvc_err;    /*  FIP link service req errors      */
0643     u64 logo_req;   /*  FIP logos received           */
0644     u64 clrvlink_req;   /*  Clear virtual link requests      */
0645     u64 op_unsupp;  /*  FIP operation unsupp.        */
0646     u64 untagged;   /*  FIP untagged frames          */
0647     u64 txf_ucast;  /*  Tx FCoE unicast frames       */
0648     u64 txf_ucast_vlan; /*  Tx FCoE unicast vlan frames      */
0649     u64 txf_ucast_octets; /*  Tx FCoE unicast octets         */
0650     u64 txf_mcast;  /*  Tx FCoE multicast frames         */
0651     u64 txf_mcast_vlan; /*  Tx FCoE multicast vlan frames    */
0652     u64 txf_mcast_octets; /*  Tx FCoE multicast octets       */
0653     u64 txf_bcast;  /*  Tx FCoE broadcast frames         */
0654     u64 txf_bcast_vlan; /*  Tx FCoE broadcast vlan frames    */
0655     u64 txf_bcast_octets; /*  Tx FCoE broadcast octets       */
0656     u64 txf_timeout;      /*  Tx timeouts            */
0657     u64 txf_parity_errors; /*  Transmit parity err       */
0658     u64 txf_fid_parity_errors; /*  Transmit FID parity err   */
0659     u64 rxf_ucast_octets; /*  Rx FCoE unicast octets         */
0660     u64 rxf_ucast;  /*  Rx FCoE unicast frames       */
0661     u64 rxf_ucast_vlan; /*  Rx FCoE unicast vlan frames      */
0662     u64 rxf_mcast_octets; /*  Rx FCoE multicast octets       */
0663     u64 rxf_mcast;  /*  Rx FCoE multicast frames         */
0664     u64 rxf_mcast_vlan; /*  Rx FCoE multicast vlan frames    */
0665     u64 rxf_bcast_octets; /*  Rx FCoE broadcast octets       */
0666     u64 rxf_bcast;  /*  Rx FCoE broadcast frames         */
0667     u64 rxf_bcast_vlan; /*  Rx FCoE broadcast vlan frames    */
0668 };
0669 
0670 /*
0671  * QoS or FCoE stats (fcport stats excluding physical FC port stats)
0672  */
0673 union bfa_fcport_stats_u {
0674     struct bfa_qos_stats_s  fcqos;
0675     struct bfa_fcoe_stats_s fcoe;
0676 };
0677 #pragma pack()
0678 
0679 struct bfa_fcpim_del_itn_stats_s {
0680     u32 del_itn_iocomp_aborted;    /* Aborted IO requests         */
0681     u32 del_itn_iocomp_timedout;   /* IO timeouts             */
0682     u32 del_itn_iocom_sqer_needed; /* IO retry for SQ error recovery  */
0683     u32 del_itn_iocom_res_free;    /* Delayed freeing of IO resources */
0684     u32 del_itn_iocom_hostabrts;   /* Host IO abort requests          */
0685     u32 del_itn_total_ios;     /* Total IO count              */
0686     u32 del_io_iocdowns;       /* IO cleaned-up due to IOC down   */
0687     u32 del_tm_iocdowns;       /* TM cleaned-up due to IOC down   */
0688 };
0689 
0690 struct bfa_itnim_iostats_s {
0691 
0692     u32 total_ios;      /*  Total IO Requests       */
0693     u32 input_reqs;     /*  Data in-bound requests  */
0694     u32 output_reqs;        /*  Data out-bound requests */
0695     u32 io_comps;       /*  Total IO Completions    */
0696     u32 wr_throughput;      /*  Write data transferred in bytes */
0697     u32 rd_throughput;      /*  Read data transferred in bytes  */
0698 
0699     u32 iocomp_ok;      /*  Slowpath IO completions */
0700     u32 iocomp_underrun;    /*  IO underrun     */
0701     u32 iocomp_overrun;     /*  IO overrun          */
0702     u32 qwait;          /*  IO Request-Q wait       */
0703     u32 qresumes;       /*  IO Request-Q wait done  */
0704     u32 no_iotags;      /*  No free IO tag      */
0705     u32 iocomp_timedout;    /*  IO timeouts     */
0706     u32 iocom_nexus_abort;  /*  IO failure due to target offline */
0707     u32 iocom_proto_err;    /*  IO protocol errors      */
0708     u32 iocom_dif_err;      /*  IO SBC-3 protection errors  */
0709 
0710     u32 iocom_sqer_needed;  /*  fcp-2 error recovery failed */
0711     u32 iocom_res_free;     /*  Delayed freeing of IO tag   */
0712 
0713 
0714     u32 io_aborts;      /*  Host IO abort requests  */
0715     u32 iocom_hostabrts;    /*  Host IO abort completions   */
0716     u32 io_cleanups;        /*  IO clean-up requests    */
0717     u32 path_tov_expired;   /*  IO path tov expired */
0718     u32 iocomp_aborted;     /*  IO abort completions    */
0719     u32 io_iocdowns;        /*  IO cleaned-up due to IOC down */
0720     u32 iocom_utags;        /*  IO comp with unknown tags   */
0721 
0722     u32 io_tmaborts;        /*  Abort request due to TM command */
0723     u32 tm_io_comps;        /* Abort completion due to TM command */
0724 
0725     u32 creates;        /*  IT Nexus create requests    */
0726     u32 fw_create;      /*  IT Nexus FW create requests */
0727     u32 create_comps;       /*  IT Nexus FW create completions */
0728     u32 onlines;        /*  IT Nexus onlines        */
0729     u32 offlines;       /*  IT Nexus offlines       */
0730     u32 fw_delete;      /*  IT Nexus FW delete requests */
0731     u32 delete_comps;       /*  IT Nexus FW delete completions */
0732     u32 deletes;        /*  IT Nexus delete requests       */
0733     u32 sler_events;        /*  SLER events     */
0734     u32 ioc_disabled;       /*  Num IOC disables        */
0735     u32 cleanup_comps;      /*  IT Nexus cleanup completions    */
0736 
0737     u32 tm_cmnds;       /*  TM Requests     */
0738     u32 tm_fw_rsps;     /*  TM Completions      */
0739     u32 tm_success;     /*  TM initiated IO cleanup success */
0740     u32 tm_failures;        /*  TM initiated IO cleanup failure */
0741     u32 no_tskims;      /*  No free TM tag      */
0742     u32 tm_qwait;       /*  TM Request-Q wait       */
0743     u32 tm_qresumes;        /*  TM Request-Q wait done  */
0744 
0745     u32 tm_iocdowns;        /*  TM cleaned-up due to IOC down   */
0746     u32 tm_cleanups;        /*  TM cleanup requests */
0747     u32 tm_cleanup_comps;   /*  TM cleanup completions  */
0748     u32 rsvd[6];
0749 };
0750 
0751 /* Modify char* port_stt[] in bfal_port.c if a new state was added */
0752 enum bfa_port_states {
0753     BFA_PORT_ST_UNINIT      = 1,
0754     BFA_PORT_ST_ENABLING_QWAIT  = 2,
0755     BFA_PORT_ST_ENABLING        = 3,
0756     BFA_PORT_ST_LINKDOWN        = 4,
0757     BFA_PORT_ST_LINKUP      = 5,
0758     BFA_PORT_ST_DISABLING_QWAIT = 6,
0759     BFA_PORT_ST_DISABLING       = 7,
0760     BFA_PORT_ST_DISABLED        = 8,
0761     BFA_PORT_ST_STOPPED     = 9,
0762     BFA_PORT_ST_IOCDOWN     = 10,
0763     BFA_PORT_ST_IOCDIS      = 11,
0764     BFA_PORT_ST_FWMISMATCH      = 12,
0765     BFA_PORT_ST_PREBOOT_DISABLED    = 13,
0766     BFA_PORT_ST_TOGGLING_QWAIT  = 14,
0767     BFA_PORT_ST_FAA_MISCONFIG   = 15,
0768     BFA_PORT_ST_DPORT       = 16,
0769     BFA_PORT_ST_DDPORT      = 17,
0770     BFA_PORT_ST_MAX_STATE,
0771 };
0772 
0773 /*
0774  *  Port operational type (in sync with SNIA port type).
0775  */
0776 enum bfa_port_type {
0777     BFA_PORT_TYPE_UNKNOWN   = 1,    /*  port type is unknown */
0778     BFA_PORT_TYPE_NPORT = 5,    /*  P2P with switched fabric */
0779     BFA_PORT_TYPE_NLPORT    = 6,    /*  public loop */
0780     BFA_PORT_TYPE_LPORT = 20,   /*  private loop */
0781     BFA_PORT_TYPE_P2P   = 21,   /*  P2P with no switched fabric */
0782     BFA_PORT_TYPE_VPORT = 22,   /*  NPIV - virtual port */
0783 };
0784 
0785 /*
0786  *  Port topology setting. A port's topology and fabric login status
0787  *  determine its operational type.
0788  */
0789 enum bfa_port_topology {
0790     BFA_PORT_TOPOLOGY_NONE = 0, /*  No valid topology */
0791     BFA_PORT_TOPOLOGY_P2P_OLD_VER = 1, /* P2P def for older ver */
0792     BFA_PORT_TOPOLOGY_LOOP = 2, /* LOOP topology */
0793     BFA_PORT_TOPOLOGY_AUTO_OLD_VER = 3, /* auto def for older ver */
0794     BFA_PORT_TOPOLOGY_AUTO = 4, /* auto topology selection */
0795     BFA_PORT_TOPOLOGY_P2P = 5,  /* P2P only */
0796 };
0797 
0798 /*
0799  *  Physical port loopback types.
0800  */
0801 enum bfa_port_opmode {
0802     BFA_PORT_OPMODE_NORMAL   = 0x00, /*  normal non-loopback mode */
0803     BFA_PORT_OPMODE_LB_INT   = 0x01, /*  internal loop back */
0804     BFA_PORT_OPMODE_LB_SLW   = 0x02, /*  serial link wrapback (serdes) */
0805     BFA_PORT_OPMODE_LB_EXT   = 0x04, /*  external loop back (serdes) */
0806     BFA_PORT_OPMODE_LB_CBL   = 0x08, /*  cabled loop back */
0807     BFA_PORT_OPMODE_LB_NLINT = 0x20, /*  NL_Port internal loopback */
0808 };
0809 
0810 #define BFA_PORT_OPMODE_LB_HARD(_mode)          \
0811     ((_mode == BFA_PORT_OPMODE_LB_INT) ||       \
0812     (_mode == BFA_PORT_OPMODE_LB_SLW) ||        \
0813     (_mode == BFA_PORT_OPMODE_LB_EXT))
0814 
0815 /*
0816  *  Port link state
0817  */
0818 enum bfa_port_linkstate {
0819     BFA_PORT_LINKUP     = 1,    /*  Physical port/Trunk link up */
0820     BFA_PORT_LINKDOWN   = 2,    /*  Physical port/Trunk link down */
0821 };
0822 
0823 /*
0824  *  Port link state reason code
0825  */
0826 enum bfa_port_linkstate_rsn {
0827     BFA_PORT_LINKSTATE_RSN_NONE     = 0,
0828     BFA_PORT_LINKSTATE_RSN_DISABLED     = 1,
0829     BFA_PORT_LINKSTATE_RSN_RX_NOS       = 2,
0830     BFA_PORT_LINKSTATE_RSN_RX_OLS       = 3,
0831     BFA_PORT_LINKSTATE_RSN_RX_LIP       = 4,
0832     BFA_PORT_LINKSTATE_RSN_RX_LIPF7     = 5,
0833     BFA_PORT_LINKSTATE_RSN_SFP_REMOVED  = 6,
0834     BFA_PORT_LINKSTATE_RSN_PORT_FAULT   = 7,
0835     BFA_PORT_LINKSTATE_RSN_RX_LOS       = 8,
0836     BFA_PORT_LINKSTATE_RSN_LOCAL_FAULT  = 9,
0837     BFA_PORT_LINKSTATE_RSN_REMOTE_FAULT = 10,
0838     BFA_PORT_LINKSTATE_RSN_TIMEOUT      = 11,
0839     BFA_PORT_LINKSTATE_RSN_FAA_MISCONFIG    = 12,
0840 
0841 
0842 
0843     /* CEE related reason codes/errors */
0844     CEE_LLDP_INFO_AGED_OUT          = 20,
0845     CEE_LLDP_SHUTDOWN_TLV_RCVD      = 21,
0846     CEE_PEER_NOT_ADVERTISE_DCBX     = 22,
0847     CEE_PEER_NOT_ADVERTISE_PG       = 23,
0848     CEE_PEER_NOT_ADVERTISE_PFC      = 24,
0849     CEE_PEER_NOT_ADVERTISE_FCOE     = 25,
0850     CEE_PG_NOT_COMPATIBLE           = 26,
0851     CEE_PFC_NOT_COMPATIBLE          = 27,
0852     CEE_FCOE_NOT_COMPATIBLE         = 28,
0853     CEE_BAD_PG_RCVD             = 29,
0854     CEE_BAD_BW_RCVD             = 30,
0855     CEE_BAD_PFC_RCVD            = 31,
0856     CEE_BAD_APP_PRI_RCVD            = 32,
0857     CEE_FCOE_PRI_PFC_OFF            = 33,
0858     CEE_DUP_CONTROL_TLV_RCVD        = 34,
0859     CEE_DUP_FEAT_TLV_RCVD           = 35,
0860     CEE_APPLY_NEW_CFG           = 36, /* reason, not error */
0861     CEE_PROTOCOL_INIT           = 37, /* reason, not error */
0862     CEE_PHY_LINK_DOWN           = 38,
0863     CEE_LLS_FCOE_ABSENT         = 39,
0864     CEE_LLS_FCOE_DOWN           = 40,
0865     CEE_ISCSI_NOT_COMPATIBLE        = 41,
0866     CEE_ISCSI_PRI_PFC_OFF           = 42,
0867     CEE_ISCSI_PRI_OVERLAP_FCOE_PRI      = 43
0868 };
0869 
0870 #define MAX_LUN_MASK_CFG 16
0871 
0872 /*
0873  * Initially flash content may be fff. On making LUN mask enable and disable
0874  * state change.  when report lun command is being processed it goes from
0875  * BFA_LUN_MASK_ACTIVE to BFA_LUN_MASK_FETCH and comes back to
0876  * BFA_LUN_MASK_ACTIVE.
0877  */
0878 enum bfa_ioim_lun_mask_state_s {
0879     BFA_IOIM_LUN_MASK_INACTIVE = 0,
0880     BFA_IOIM_LUN_MASK_ACTIVE = 1,
0881     BFA_IOIM_LUN_MASK_FETCHED = 2,
0882 };
0883 
0884 enum bfa_lunmask_state_s {
0885     BFA_LUNMASK_DISABLED = 0x00,
0886     BFA_LUNMASK_ENABLED = 0x01,
0887     BFA_LUNMASK_MINCFG = 0x02,
0888     BFA_LUNMASK_UNINITIALIZED = 0xff,
0889 };
0890 
0891 /**
0892  * FEC states
0893  */
0894 enum bfa_fec_state_s {
0895     BFA_FEC_ONLINE = 1,     /*!< FEC is online */
0896     BFA_FEC_OFFLINE = 2,        /*!< FEC is offline */
0897     BFA_FEC_OFFLINE_NOT_16G = 3,    /*!< FEC is offline (speed not 16Gig) */
0898 };
0899 
0900 #pragma pack(1)
0901 /*
0902  * LUN mask configuration
0903  */
0904 struct bfa_lun_mask_s {
0905     wwn_t       lp_wwn;
0906     wwn_t       rp_wwn;
0907     struct scsi_lun lun;
0908     u8      ua;
0909     u8      rsvd[3];
0910     u16     rp_tag;
0911     u8      lp_tag;
0912     u8      state;
0913 };
0914 
0915 #define MAX_LUN_MASK_CFG 16
0916 struct bfa_lunmask_cfg_s {
0917     u32 status;
0918     u32 rsvd;
0919     struct bfa_lun_mask_s   lun_list[MAX_LUN_MASK_CFG];
0920 };
0921 
0922 struct bfa_throttle_cfg_s {
0923     u16 is_valid;
0924     u16 value;
0925     u32 rsvd;
0926 };
0927 
0928 struct bfa_defs_fcpim_throttle_s {
0929     u16 max_value;
0930     u16 cur_value;
0931     u16 cfg_value;
0932     u16 rsvd;
0933 };
0934 
0935 #define BFA_BB_SCN_DEF 3
0936 #define BFA_BB_SCN_MAX 0x0F
0937 
0938 /*
0939  *      Physical port configuration
0940  */
0941 struct bfa_port_cfg_s {
0942     u8   topology;  /*  bfa_port_topology       */
0943     u8   speed;     /*  enum bfa_port_speed */
0944     u8   trunked;   /*  trunked or not      */
0945     u8   qos_enabled;   /*  qos enabled or not      */
0946     u8   cfg_hardalpa;  /*  is hard alpa configured */
0947     u8   hardalpa;  /*  configured hard alpa    */
0948     __be16   maxfrsize; /*  maximum frame size      */
0949     u8   rx_bbcredit;   /*  receive buffer credits  */
0950     u8   tx_bbcredit;   /*  transmit buffer credits */
0951     u8   ratelimit; /*  ratelimit enabled or not    */
0952     u8   trl_def_speed; /*  ratelimit default speed */
0953     u8   bb_cr_enabled; /*!< Config state of BB_SCN */
0954     u8   bb_scn;    /*!< BB_SCN value for FLOGI Exchg */
0955     u8   faa_state; /*  FAA enabled/disabled        */
0956     u8   rsvd1;
0957     u16  path_tov;  /*  device path timeout */
0958     u16  q_depth;   /*  SCSI Queue depth        */
0959     struct bfa_qos_bw_s qos_bw; /* QOS bandwidth    */
0960 };
0961 #pragma pack()
0962 
0963 /*
0964  *  Port attribute values.
0965  */
0966 struct bfa_port_attr_s {
0967     /*
0968      * Static fields
0969      */
0970     wwn_t           nwwn;       /*  node wwn */
0971     wwn_t           pwwn;       /*  port wwn */
0972     wwn_t           factorynwwn;    /*  factory node wwn */
0973     wwn_t           factorypwwn;    /*  factory port wwn */
0974     enum fc_cos     cos_supported;  /*  supported class of
0975                          *  services */
0976     u32         rsvd;
0977     struct fc_symname_s port_symname;   /*  port symbolic name */
0978     enum bfa_port_speed speed_supported; /* supported speeds */
0979     bfa_boolean_t       pbind_enabled;
0980 
0981     /*
0982      * Configured values
0983      */
0984     struct bfa_port_cfg_s   pport_cfg;  /*  pport cfg */
0985 
0986     /*
0987      * Dynamic field - info from BFA
0988      */
0989     enum bfa_port_states    port_state; /*  current port state */
0990     enum bfa_port_speed speed;      /*  current speed */
0991     enum bfa_port_topology  topology;   /*  current topology */
0992     bfa_boolean_t       beacon;     /*  current beacon status */
0993     bfa_boolean_t       link_e2e_beacon; /* link beacon is on */
0994     bfa_boolean_t       bbsc_op_status; /* fc credit recovery oper
0995                          * state */
0996     enum bfa_fec_state_s    fec_state;  /*!< current FEC state */
0997 
0998     /*
0999      * Dynamic field - info from FCS
1000      */
1001     u32         pid;        /*  port ID */
1002     enum bfa_port_type  port_type;  /*  current topology */
1003     u32         loopback;   /*  external loopback */
1004     u32         authfail;   /*  auth fail state */
1005 
1006     /* FCoE specific  */
1007     u16         fcoe_vlan;
1008     u8          rsvd1[2];
1009 };
1010 
1011 /*
1012  *        Port FCP mappings.
1013  */
1014 struct bfa_port_fcpmap_s {
1015     char    osdevname[256];
1016     u32 bus;
1017     u32 target;
1018     u32 oslun;
1019     u32 fcid;
1020     wwn_t   nwwn;
1021     wwn_t   pwwn;
1022     u64 fcplun;
1023     char    luid[256];
1024 };
1025 
1026 /*
1027  *        Port RNID info.
1028  */
1029 struct bfa_port_rnid_s {
1030     wwn_t     wwn;
1031     u32   unittype;
1032     u32   portid;
1033     u32   attached_nodes_num;
1034     u16   ip_version;
1035     u16   udp_port;
1036     u8    ipaddr[16];
1037     u16   rsvd;
1038     u16   topologydiscoveryflags;
1039 };
1040 
1041 #pragma pack(1)
1042 struct bfa_fcport_fcf_s {
1043     wwn_t   name;       /*  FCF name           */
1044     wwn_t   fabric_name;    /*  Fabric Name        */
1045     u8  fipenabled; /*  FIP enabled or not     */
1046     u8  fipfailed;  /*  FIP failed or not      */
1047     u8  resv[2];
1048     u8  pri;        /*  FCF priority       */
1049     u8  version;    /*  FIP version used       */
1050     u8  available;      /*  Available for login    */
1051     u8  fka_disabled;   /*  FKA is disabled    */
1052     u8  maxsz_verified; /*  FCoE max size verified */
1053     u8  fc_map[3];      /*  FC map         */
1054     __be16  vlan;       /*  FCoE vlan tag/priority */
1055     u32 fka_adv_per;    /*  FIP  ka advert. period */
1056     mac_t   mac;        /*  FCF mac        */
1057 };
1058 
1059 /*
1060  *  Trunk states for BCU/BFAL
1061  */
1062 enum bfa_trunk_state {
1063     BFA_TRUNK_DISABLED  = 0,    /*  Trunk is not configured */
1064     BFA_TRUNK_ONLINE    = 1,    /*  Trunk is online     */
1065     BFA_TRUNK_OFFLINE   = 2,    /*  Trunk is offline        */
1066 };
1067 
1068 /*
1069  *  VC attributes for trunked link
1070  */
1071 struct bfa_trunk_vc_attr_s {
1072     u32 bb_credit;
1073     u32 elp_opmode_flags;
1074     u32 req_credit;
1075     u16 vc_credits[8];
1076 };
1077 
1078 struct bfa_fcport_loop_info_s {
1079     u8  myalpa;     /* alpa claimed */
1080     u8  alpabm_val; /* alpa bitmap valid or not (1 or 0) */
1081     u8  resvd[6];
1082     struct fc_alpabm_s alpabm;  /* alpa bitmap */
1083 };
1084 
1085 /*
1086  *  Link state information
1087  */
1088 struct bfa_port_link_s {
1089     u8   linkstate; /*  Link state bfa_port_linkstate */
1090     u8   linkstate_rsn; /*  bfa_port_linkstate_rsn_t */
1091     u8   topology;  /*  P2P/LOOP bfa_port_topology */
1092     u8   speed;     /*  Link speed (1/2/4/8 G) */
1093     u32  linkstate_opt; /*  Linkstate optional data (debug) */
1094     u8   trunked;   /*  Trunked or not (1 or 0) */
1095     u8   fec_state; /*!< State of FEC */
1096     u8   resvd[6];
1097     struct bfa_qos_attr_s  qos_attr;   /* QoS Attributes */
1098     union {
1099         struct bfa_fcport_loop_info_s loop_info;
1100         struct bfa_bbcr_attr_s bbcr_attr;
1101         union {
1102             struct bfa_qos_vc_attr_s qos_vc_attr;
1103                     /*  VC info from ELP */
1104             struct bfa_trunk_vc_attr_s trunk_vc_attr;
1105             struct bfa_fcport_fcf_s fcf;
1106                     /*  FCF information (for FCoE) */
1107         } vc_fcf;
1108     } attr;
1109 };
1110 #pragma pack()
1111 
1112 enum bfa_trunk_link_fctl {
1113     BFA_TRUNK_LINK_FCTL_NORMAL,
1114     BFA_TRUNK_LINK_FCTL_VC,
1115     BFA_TRUNK_LINK_FCTL_VC_QOS,
1116 };
1117 
1118 enum bfa_trunk_link_state {
1119     BFA_TRUNK_LINK_STATE_UP = 1,        /* link part of trunk */
1120     BFA_TRUNK_LINK_STATE_DN_LINKDN = 2, /* physical link down */
1121     BFA_TRUNK_LINK_STATE_DN_GRP_MIS = 3,    /* trunk group different */
1122     BFA_TRUNK_LINK_STATE_DN_SPD_MIS = 4,    /* speed mismatch */
1123     BFA_TRUNK_LINK_STATE_DN_MODE_MIS = 5,   /* remote port not trunked */
1124 };
1125 
1126 #define BFA_TRUNK_MAX_PORTS 2
1127 struct bfa_trunk_link_attr_s {
1128     wwn_t    trunk_wwn;
1129     enum bfa_trunk_link_fctl fctl;
1130     enum bfa_trunk_link_state link_state;
1131     enum bfa_port_speed speed;
1132     u32 deskew;
1133 };
1134 
1135 struct bfa_trunk_attr_s {
1136     enum bfa_trunk_state    state;
1137     enum bfa_port_speed speed;
1138     u32     port_id;
1139     u32     rsvd;
1140     struct bfa_trunk_link_attr_s link_attr[BFA_TRUNK_MAX_PORTS];
1141 };
1142 
1143 struct bfa_rport_hal_stats_s {
1144     u32        sm_un_cr;        /*  uninit: create events      */
1145     u32        sm_un_unexp;     /*  uninit: exception events   */
1146     u32        sm_cr_on;        /*  created: online events     */
1147     u32        sm_cr_del;       /*  created: delete events     */
1148     u32        sm_cr_hwf;       /*  created: IOC down          */
1149     u32        sm_cr_unexp;     /*  created: exception events  */
1150     u32        sm_fwc_rsp;      /*  fw create: f/w responses   */
1151     u32        sm_fwc_del;      /*  fw create: delete events   */
1152     u32        sm_fwc_off;      /*  fw create: offline events  */
1153     u32        sm_fwc_hwf;      /*  fw create: IOC down        */
1154     u32        sm_fwc_unexp;    /*  fw create: exception events*/
1155     u32        sm_on_off;       /*  online: offline events     */
1156     u32        sm_on_del;       /*  online: delete events      */
1157     u32        sm_on_hwf;       /*  online: IOC down events    */
1158     u32        sm_on_unexp;     /*  online: exception events   */
1159     u32        sm_fwd_rsp;      /*  fw delete: fw responses    */
1160     u32        sm_fwd_del;      /*  fw delete: delete events   */
1161     u32        sm_fwd_hwf;      /*  fw delete: IOC down events */
1162     u32        sm_fwd_unexp;    /*  fw delete: exception events*/
1163     u32        sm_off_del;      /*  offline: delete events     */
1164     u32        sm_off_on;       /*  offline: online events     */
1165     u32        sm_off_hwf;      /*  offline: IOC down events   */
1166     u32        sm_off_unexp;    /*  offline: exception events  */
1167     u32        sm_del_fwrsp;    /*  delete: fw responses       */
1168     u32        sm_del_hwf;      /*  delete: IOC down events    */
1169     u32        sm_del_unexp;    /*  delete: exception events   */
1170     u32        sm_delp_fwrsp;   /*  delete pend: fw responses  */
1171     u32        sm_delp_hwf;     /*  delete pend: IOC downs     */
1172     u32        sm_delp_unexp;   /*  delete pend: exceptions    */
1173     u32        sm_offp_fwrsp;   /*  off-pending: fw responses  */
1174     u32        sm_offp_del;     /*  off-pending: deletes       */
1175     u32        sm_offp_hwf;     /*  off-pending: IOC downs     */
1176     u32        sm_offp_unexp;   /*  off-pending: exceptions    */
1177     u32        sm_iocd_off;     /*  IOC down: offline events   */
1178     u32        sm_iocd_del;     /*  IOC down: delete events    */
1179     u32        sm_iocd_on;      /*  IOC down: online events    */
1180     u32        sm_iocd_unexp;   /*  IOC down: exceptions       */
1181     u32        rsvd;
1182 };
1183 #pragma pack(1)
1184 /*
1185  *  Rport's QoS attributes
1186  */
1187 struct bfa_rport_qos_attr_s {
1188     u8      qos_priority;   /*  rport's QoS priority   */
1189     u8      rsvd[3];
1190     u32     qos_flow_id;    /*  QoS flow Id  */
1191 };
1192 #pragma pack()
1193 
1194 #define BFA_IOBUCKET_MAX 14
1195 
1196 struct bfa_itnim_latency_s {
1197     u32 min[BFA_IOBUCKET_MAX];
1198     u32 max[BFA_IOBUCKET_MAX];
1199     u32 count[BFA_IOBUCKET_MAX];
1200     u32 avg[BFA_IOBUCKET_MAX];
1201 };
1202 
1203 struct bfa_itnim_ioprofile_s {
1204     u32 clock_res_mul;
1205     u32 clock_res_div;
1206     u32 index;
1207     u32 io_profile_start_time;  /*  IO profile start time   */
1208     u32 iocomps[BFA_IOBUCKET_MAX];  /*  IO completed    */
1209     struct bfa_itnim_latency_s io_latency;
1210 };
1211 
1212 /*
1213  *  vHBA port attribute values.
1214  */
1215 struct bfa_vhba_attr_s {
1216     wwn_t   nwwn;       /* node wwn */
1217     wwn_t   pwwn;       /* port wwn */
1218     u32 pid;        /* port ID */
1219     bfa_boolean_t       io_profile; /* get it from fcpim mod */
1220     bfa_boolean_t       plog_enabled;   /* portlog is enabled */
1221     u16 path_tov;
1222     u8  rsvd[2];
1223 };
1224 
1225 /*
1226  * FC physical port statistics.
1227  */
1228 struct bfa_port_fc_stats_s {
1229     u64     secs_reset;     /*  Seconds since stats is reset */
1230     u64     tx_frames;      /*  Tx frames                   */
1231     u64     tx_words;       /*  Tx words                    */
1232     u64     tx_lip;         /*  Tx LIP                      */
1233     u64 tx_lip_f7f7;    /*  Tx LIP_F7F7     */
1234     u64 tx_lip_f8f7;    /*  Tx LIP_F8F7     */
1235     u64 tx_arbf0;   /*  Tx ARB F0           */
1236     u64     tx_nos;         /*  Tx NOS                      */
1237     u64     tx_ols;         /*  Tx OLS                      */
1238     u64     tx_lr;          /*  Tx LR                       */
1239     u64     tx_lrr;         /*  Tx LRR                      */
1240     u64     rx_frames;      /*  Rx frames                   */
1241     u64     rx_words;       /*  Rx words                    */
1242     u64     lip_count;      /*  Rx LIP                      */
1243     u64 rx_lip_f7f7;    /*  Rx LIP_F7F7     */
1244     u64 rx_lip_f8f7;    /*  Rx LIP_F8F7     */
1245     u64 rx_arbf0;   /*  Rx ARB F0           */
1246     u64     nos_count;      /*  Rx NOS                      */
1247     u64     ols_count;      /*  Rx OLS                      */
1248     u64     lr_count;       /*  Rx LR                       */
1249     u64     lrr_count;      /*  Rx LRR                      */
1250     u64     invalid_crcs;   /*  Rx CRC err frames           */
1251     u64     invalid_crc_gd_eof; /*  Rx CRC err good EOF frames */
1252     u64     undersized_frm; /*  Rx undersized frames        */
1253     u64     oversized_frm;  /*  Rx oversized frames */
1254     u64     bad_eof_frm;    /*  Rx frames with bad EOF      */
1255     u64     error_frames;   /*  Errored frames              */
1256     u64     dropped_frames; /*  Dropped frames              */
1257     u64     link_failures;  /*  Link Failure (LF) count     */
1258     u64     loss_of_syncs;  /*  Loss of sync count          */
1259     u64     loss_of_signals; /*  Loss of signal count       */
1260     u64     primseq_errs;   /*  Primitive sequence protocol err. */
1261     u64     bad_os_count;   /*  Invalid ordered sets        */
1262     u64     err_enc_out;    /*  Encoding err nonframe_8b10b */
1263     u64     err_enc;        /*  Encoding err frame_8b10b    */
1264     u64 bbcr_frames_lost; /*!< BBCR Frames Lost */
1265     u64 bbcr_rrdys_lost; /*!< BBCR RRDYs Lost */
1266     u64 bbcr_link_resets; /*!< BBCR Link Resets */
1267     u64 bbcr_frame_lost_intrs; /*!< BBCR Frame loss intrs */
1268     u64 bbcr_rrdy_lost_intrs; /*!< BBCR Rrdy loss intrs */
1269     u64 loop_timeouts;  /*  Loop timeouts       */
1270 };
1271 
1272 /*
1273  * Eth Physical Port statistics.
1274  */
1275 struct bfa_port_eth_stats_s {
1276     u64     secs_reset;     /*  Seconds since stats is reset */
1277     u64     frame_64;       /*  Frames 64 bytes             */
1278     u64     frame_65_127;   /*  Frames 65-127 bytes */
1279     u64     frame_128_255;  /*  Frames 128-255 bytes        */
1280     u64     frame_256_511;  /*  Frames 256-511 bytes        */
1281     u64     frame_512_1023; /*  Frames 512-1023 bytes       */
1282     u64     frame_1024_1518; /*  Frames 1024-1518 bytes     */
1283     u64     frame_1519_1522; /*  Frames 1519-1522 bytes     */
1284     u64     tx_bytes;       /*  Tx bytes                    */
1285     u64     tx_packets;      /*  Tx packets         */
1286     u64     tx_mcast_packets; /*  Tx multicast packets      */
1287     u64     tx_bcast_packets; /*  Tx broadcast packets      */
1288     u64     tx_control_frame; /*  Tx control frame          */
1289     u64     tx_drop;        /*  Tx drops                    */
1290     u64     tx_jabber;      /*  Tx jabber                   */
1291     u64     tx_fcs_error;   /*  Tx FCS errors               */
1292     u64     tx_fragments;   /*  Tx fragments                */
1293     u64     rx_bytes;       /*  Rx bytes                    */
1294     u64     rx_packets;     /*  Rx packets                  */
1295     u64     rx_mcast_packets; /*  Rx multicast packets      */
1296     u64     rx_bcast_packets; /*  Rx broadcast packets      */
1297     u64     rx_control_frames; /*  Rx control frames        */
1298     u64     rx_unknown_opcode; /*  Rx unknown opcode        */
1299     u64     rx_drop;        /*  Rx drops                    */
1300     u64     rx_jabber;      /*  Rx jabber                   */
1301     u64     rx_fcs_error;   /*  Rx FCS errors               */
1302     u64     rx_alignment_error; /*  Rx alignment errors     */
1303     u64     rx_frame_length_error; /*  Rx frame len errors  */
1304     u64     rx_code_error;  /*  Rx code errors              */
1305     u64     rx_fragments;   /*  Rx fragments                */
1306     u64     rx_pause;       /*  Rx pause                    */
1307     u64     rx_zero_pause;  /*  Rx zero pause               */
1308     u64     tx_pause;       /*  Tx pause                    */
1309     u64     tx_zero_pause;  /*  Tx zero pause               */
1310     u64     rx_fcoe_pause;  /*  Rx FCoE pause               */
1311     u64     rx_fcoe_zero_pause; /*  Rx FCoE zero pause      */
1312     u64     tx_fcoe_pause;  /*  Tx FCoE pause               */
1313     u64     tx_fcoe_zero_pause; /*  Tx FCoE zero pause      */
1314     u64     rx_iscsi_pause; /*  Rx iSCSI pause              */
1315     u64     rx_iscsi_zero_pause; /*  Rx iSCSI zero pause    */
1316     u64     tx_iscsi_pause; /*  Tx iSCSI pause              */
1317     u64     tx_iscsi_zero_pause; /*  Tx iSCSI zero pause    */
1318 };
1319 
1320 /*
1321  *              Port statistics.
1322  */
1323 union bfa_port_stats_u {
1324     struct bfa_port_fc_stats_s      fc;
1325     struct bfa_port_eth_stats_s     eth;
1326 };
1327 
1328 struct bfa_port_cfg_mode_s {
1329     u16     max_pf;
1330     u16     max_vf;
1331     enum bfa_mode_s mode;
1332 };
1333 
1334 #pragma pack(1)
1335 
1336 #define BFA_CEE_LLDP_MAX_STRING_LEN (128)
1337 #define BFA_CEE_DCBX_MAX_PRIORITY   (8)
1338 #define BFA_CEE_DCBX_MAX_PGID       (8)
1339 
1340 struct bfa_cee_lldp_str_s {
1341     u8  sub_type;
1342     u8  len;
1343     u8  rsvd[2];
1344     u8  value[BFA_CEE_LLDP_MAX_STRING_LEN];
1345 };
1346 
1347 struct bfa_cee_lldp_cfg_s {
1348     struct bfa_cee_lldp_str_s chassis_id;
1349     struct bfa_cee_lldp_str_s port_id;
1350     struct bfa_cee_lldp_str_s port_desc;
1351     struct bfa_cee_lldp_str_s sys_name;
1352     struct bfa_cee_lldp_str_s sys_desc;
1353     struct bfa_cee_lldp_str_s mgmt_addr;
1354     u16 time_to_live;
1355     u16 enabled_system_cap;
1356 };
1357 
1358 /* CEE/DCBX parameters */
1359 struct bfa_cee_dcbx_cfg_s {
1360     u8  pgid[BFA_CEE_DCBX_MAX_PRIORITY];
1361     u8  pg_percentage[BFA_CEE_DCBX_MAX_PGID];
1362     u8  pfc_primap; /* bitmap of priorties with PFC enabled */
1363     u8  fcoe_primap; /* bitmap of priorities used for FcoE traffic */
1364     u8  iscsi_primap; /* bitmap of priorities used for iSCSI traffic */
1365     u8  dcbx_version; /* operating version:CEE or preCEE */
1366     u8  lls_fcoe; /* FCoE Logical Link Status */
1367     u8  lls_lan; /* LAN Logical Link Status */
1368     u8  rsvd[2];
1369 };
1370 
1371 /* CEE Query */
1372 struct bfa_cee_attr_s {
1373     u8  cee_status;
1374     u8  error_reason;
1375     struct bfa_cee_lldp_cfg_s lldp_remote;
1376     struct bfa_cee_dcbx_cfg_s dcbx_remote;
1377     mac_t src_mac;
1378     u8  link_speed;
1379     u8  nw_priority;
1380     u8  filler[2];
1381 };
1382 
1383 /* LLDP/DCBX/CEE Statistics */
1384 struct bfa_cee_stats_s {
1385     u32     lldp_tx_frames;     /* LLDP Tx Frames */
1386     u32     lldp_rx_frames;     /* LLDP Rx Frames */
1387     u32     lldp_rx_frames_invalid; /* LLDP Rx Frames invalid */
1388     u32     lldp_rx_frames_new;     /* LLDP Rx Frames new */
1389     u32     lldp_tlvs_unrecognized; /* LLDP Rx unrecog. TLVs */
1390     u32     lldp_rx_shutdown_tlvs;  /* LLDP Rx shutdown TLVs */
1391     u32     lldp_info_aged_out;     /* LLDP remote info aged */
1392     u32     dcbx_phylink_ups;       /* DCBX phy link ups */
1393     u32     dcbx_phylink_downs;     /* DCBX phy link downs */
1394     u32     dcbx_rx_tlvs;           /* DCBX Rx TLVs */
1395     u32     dcbx_rx_tlvs_invalid;   /* DCBX Rx TLVs invalid */
1396     u32     dcbx_control_tlv_error; /* DCBX control TLV errors */
1397     u32     dcbx_feature_tlv_error; /* DCBX feature TLV errors */
1398     u32     dcbx_cee_cfg_new;       /* DCBX new CEE cfg rcvd */
1399     u32     cee_status_down;        /* DCB status down */
1400     u32     cee_status_up;          /* DCB status up */
1401     u32     cee_hw_cfg_changed;     /* DCB hw cfg changed */
1402     u32     cee_rx_invalid_cfg;     /* DCB invalid cfg */
1403 };
1404 
1405 #pragma pack()
1406 
1407 /*
1408  *          AEN related definitions
1409  */
1410 #define BFAD_NL_VENDOR_ID (((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) \
1411                | BFA_PCI_VENDOR_ID_BROCADE)
1412 
1413 /* BFA remote port events */
1414 enum bfa_rport_aen_event {
1415     BFA_RPORT_AEN_ONLINE     = 1,   /* RPort online event */
1416     BFA_RPORT_AEN_OFFLINE    = 2,   /* RPort offline event */
1417     BFA_RPORT_AEN_DISCONNECT = 3,   /* RPort disconnect event */
1418     BFA_RPORT_AEN_QOS_PRIO   = 4,   /* QOS priority change event */
1419     BFA_RPORT_AEN_QOS_FLOWID = 5,   /* QOS flow Id change event */
1420 };
1421 
1422 struct bfa_rport_aen_data_s {
1423     u16             vf_id;  /* vf_id of this logical port */
1424     u16             rsvd[3];
1425     wwn_t           ppwwn;  /* WWN of its physical port */
1426     wwn_t           lpwwn;  /* WWN of this logical port */
1427     wwn_t           rpwwn;  /* WWN of this remote port */
1428     union {
1429         struct bfa_rport_qos_attr_s qos;
1430     } priv;
1431 };
1432 
1433 union bfa_aen_data_u {
1434     struct bfa_adapter_aen_data_s   adapter;
1435     struct bfa_port_aen_data_s  port;
1436     struct bfa_lport_aen_data_s lport;
1437     struct bfa_rport_aen_data_s rport;
1438     struct bfa_itnim_aen_data_s itnim;
1439     struct bfa_audit_aen_data_s audit;
1440     struct bfa_ioc_aen_data_s   ioc;
1441 };
1442 
1443 #define BFA_AEN_MAX_ENTRY   512
1444 
1445 struct bfa_aen_entry_s {
1446     struct list_head    qe;
1447     enum bfa_aen_category   aen_category;
1448     int                     aen_type;
1449     union bfa_aen_data_u    aen_data;
1450     u64         aen_tv_sec;
1451     u64         aen_tv_usec;
1452     u32                     seq_num;
1453     u32                     bfad_num;
1454 };
1455 
1456 #endif /* __BFA_DEFS_SVC_H__ */