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 __BFI_MS_H__
0012 #define __BFI_MS_H__
0013 
0014 #include "bfi.h"
0015 #include "bfa_fc.h"
0016 #include "bfa_defs_svc.h"
0017 
0018 #pragma pack(1)
0019 
0020 enum bfi_iocfc_h2i_msgs {
0021     BFI_IOCFC_H2I_CFG_REQ       = 1,
0022     BFI_IOCFC_H2I_SET_INTR_REQ  = 2,
0023     BFI_IOCFC_H2I_UPDATEQ_REQ   = 3,
0024     BFI_IOCFC_H2I_FAA_QUERY_REQ = 4,
0025     BFI_IOCFC_H2I_ADDR_REQ      = 5,
0026 };
0027 
0028 enum bfi_iocfc_i2h_msgs {
0029     BFI_IOCFC_I2H_CFG_REPLY     = BFA_I2HM(1),
0030     BFI_IOCFC_I2H_UPDATEQ_RSP   = BFA_I2HM(3),
0031     BFI_IOCFC_I2H_FAA_QUERY_RSP = BFA_I2HM(4),
0032     BFI_IOCFC_I2H_ADDR_MSG      = BFA_I2HM(5),
0033 };
0034 
0035 struct bfi_iocfc_cfg_s {
0036     u8  num_cqs;    /*  Number of CQs to be used    */
0037     u8   sense_buf_len; /*  SCSI sense length       */
0038     u16 rsvd_1;
0039     u32 endian_sig; /*  endian signature of host     */
0040     u8  rsvd_2;
0041     u8  single_msix_vec;
0042     u8  rsvd[2];
0043     __be16  num_ioim_reqs;
0044     __be16  num_fwtio_reqs;
0045 
0046 
0047     /*
0048      * Request and response circular queue base addresses, size and
0049      * shadow index pointers.
0050      */
0051     union bfi_addr_u  req_cq_ba[BFI_IOC_MAX_CQS];
0052     union bfi_addr_u  req_shadow_ci[BFI_IOC_MAX_CQS];
0053     __be16    req_cq_elems[BFI_IOC_MAX_CQS];
0054     union bfi_addr_u  rsp_cq_ba[BFI_IOC_MAX_CQS];
0055     union bfi_addr_u  rsp_shadow_pi[BFI_IOC_MAX_CQS];
0056     __be16    rsp_cq_elems[BFI_IOC_MAX_CQS];
0057 
0058     union bfi_addr_u  stats_addr;   /*  DMA-able address for stats    */
0059     union bfi_addr_u  cfgrsp_addr;  /*  config response dma address  */
0060     union bfi_addr_u  ioim_snsbase[BFI_IOIM_SNSBUF_SEGS];
0061                     /*  IO sense buf base addr segments */
0062     struct bfa_iocfc_intr_attr_s intr_attr; /*  IOC interrupt attributes */
0063 };
0064 
0065 /*
0066  * Boot target wwn information for this port. This contains either the stored
0067  * or discovered boot target port wwns for the port.
0068  */
0069 struct bfi_iocfc_bootwwns {
0070     wwn_t       wwn[BFA_BOOT_BOOTLUN_MAX];
0071     u8      nwwns;
0072     u8      rsvd[7];
0073 };
0074 
0075 /**
0076  * Queue configuration response from firmware
0077  */
0078 struct bfi_iocfc_qreg_s {
0079     u32 cpe_q_ci_off[BFI_IOC_MAX_CQS];
0080     u32 cpe_q_pi_off[BFI_IOC_MAX_CQS];
0081     u32 cpe_qctl_off[BFI_IOC_MAX_CQS];
0082     u32 rme_q_ci_off[BFI_IOC_MAX_CQS];
0083     u32 rme_q_pi_off[BFI_IOC_MAX_CQS];
0084     u32 rme_qctl_off[BFI_IOC_MAX_CQS];
0085     u8  hw_qid[BFI_IOC_MAX_CQS];
0086 };
0087 
0088 struct bfi_iocfc_cfgrsp_s {
0089     struct bfa_iocfc_fwcfg_s    fwcfg;
0090     struct bfa_iocfc_intr_attr_s    intr_attr;
0091     struct bfi_iocfc_bootwwns   bootwwns;
0092     struct bfi_pbc_s        pbc_cfg;
0093     struct bfi_iocfc_qreg_s     qreg;
0094 };
0095 
0096 /*
0097  * BFI_IOCFC_H2I_CFG_REQ message
0098  */
0099 struct bfi_iocfc_cfg_req_s {
0100     struct bfi_mhdr_s      mh;
0101     union bfi_addr_u      ioc_cfg_dma_addr;
0102 };
0103 
0104 
0105 /*
0106  * BFI_IOCFC_I2H_CFG_REPLY message
0107  */
0108 struct bfi_iocfc_cfg_reply_s {
0109     struct bfi_mhdr_s  mh;      /*  Common msg header     */
0110     u8   cfg_success;   /*  cfg reply status       */
0111     u8   lpu_bm;        /*  LPUs assigned for this IOC */
0112     u8   rsvd[2];
0113 };
0114 
0115 
0116 /*
0117  * BFI_IOCFC_H2I_SET_INTR_REQ message
0118  */
0119 struct bfi_iocfc_set_intr_req_s {
0120     struct bfi_mhdr_s mh;       /*  common msg header       */
0121     u8      coalesce;   /*  enable intr coalescing  */
0122     u8      rsvd[3];
0123     __be16  delay;      /*  delay timer 0..1125us   */
0124     __be16  latency;    /*  latency timer 0..225us  */
0125 };
0126 
0127 
0128 /*
0129  * BFI_IOCFC_H2I_UPDATEQ_REQ message
0130  */
0131 struct bfi_iocfc_updateq_req_s {
0132     struct bfi_mhdr_s mh;       /*  common msg header       */
0133     u32 reqq_ba;        /*  reqq base addr      */
0134     u32 rspq_ba;        /*  rspq base addr      */
0135     u32 reqq_sci;       /*  reqq shadow ci      */
0136     u32 rspq_spi;       /*  rspq shadow pi      */
0137 };
0138 
0139 
0140 /*
0141  * BFI_IOCFC_I2H_UPDATEQ_RSP message
0142  */
0143 struct bfi_iocfc_updateq_rsp_s {
0144     struct bfi_mhdr_s mh;       /*  common msg header   */
0145     u8  status;         /*  updateq  status */
0146     u8  rsvd[3];
0147 };
0148 
0149 
0150 /*
0151  * H2I Messages
0152  */
0153 union bfi_iocfc_h2i_msg_u {
0154     struct bfi_mhdr_s       mh;
0155     struct bfi_iocfc_cfg_req_s  cfg_req;
0156     struct bfi_iocfc_updateq_req_s updateq_req;
0157     u32 mboxmsg[BFI_IOC_MSGSZ];
0158 };
0159 
0160 
0161 /*
0162  * I2H Messages
0163  */
0164 union bfi_iocfc_i2h_msg_u {
0165     struct bfi_mhdr_s       mh;
0166     struct bfi_iocfc_cfg_reply_s    cfg_reply;
0167     struct bfi_iocfc_updateq_rsp_s updateq_rsp;
0168     u32 mboxmsg[BFI_IOC_MSGSZ];
0169 };
0170 
0171 /*
0172  * BFI_IOCFC_H2I_FAA_ENABLE_REQ BFI_IOCFC_H2I_FAA_DISABLE_REQ message
0173  */
0174 struct bfi_faa_en_dis_s {
0175     struct bfi_mhdr_s mh;   /* common msg header    */
0176 };
0177 
0178 struct bfi_faa_addr_msg_s {
0179     struct  bfi_mhdr_s mh;  /* common msg header    */
0180     u8  rsvd[4];
0181     wwn_t   pwwn;       /* Fabric acquired PWWN */
0182     wwn_t   nwwn;       /* Fabric acquired PWWN */
0183 };
0184 
0185 /*
0186  * BFI_IOCFC_H2I_FAA_QUERY_REQ message
0187  */
0188 struct bfi_faa_query_s {
0189     struct bfi_mhdr_s mh;   /* common msg header    */
0190     u8  faa_status; /* FAA status           */
0191     u8  addr_source;    /* PWWN source          */
0192     u8  rsvd[2];
0193     wwn_t   faa;        /* Fabric acquired PWWN */
0194 };
0195 
0196 /*
0197  * BFI_IOCFC_I2H_FAA_ENABLE_RSP, BFI_IOCFC_I2H_FAA_DISABLE_RSP message
0198  */
0199 struct bfi_faa_en_dis_rsp_s {
0200     struct bfi_mhdr_s mh;   /* common msg header    */
0201     u8  status;     /* updateq  status      */
0202     u8  rsvd[3];
0203 };
0204 
0205 /*
0206  * BFI_IOCFC_I2H_FAA_QUERY_RSP message
0207  */
0208 #define bfi_faa_query_rsp_t struct bfi_faa_query_s
0209 
0210 enum bfi_fcport_h2i {
0211     BFI_FCPORT_H2I_ENABLE_REQ       = (1),
0212     BFI_FCPORT_H2I_DISABLE_REQ      = (2),
0213     BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ   = (3),
0214     BFI_FCPORT_H2I_STATS_GET_REQ        = (4),
0215     BFI_FCPORT_H2I_STATS_CLEAR_REQ      = (5),
0216 };
0217 
0218 
0219 enum bfi_fcport_i2h {
0220     BFI_FCPORT_I2H_ENABLE_RSP       = BFA_I2HM(1),
0221     BFI_FCPORT_I2H_DISABLE_RSP      = BFA_I2HM(2),
0222     BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP   = BFA_I2HM(3),
0223     BFI_FCPORT_I2H_STATS_GET_RSP        = BFA_I2HM(4),
0224     BFI_FCPORT_I2H_STATS_CLEAR_RSP      = BFA_I2HM(5),
0225     BFI_FCPORT_I2H_EVENT            = BFA_I2HM(6),
0226     BFI_FCPORT_I2H_TRUNK_SCN        = BFA_I2HM(7),
0227     BFI_FCPORT_I2H_ENABLE_AEN       = BFA_I2HM(8),
0228     BFI_FCPORT_I2H_DISABLE_AEN      = BFA_I2HM(9),
0229 };
0230 
0231 
0232 /*
0233  * Generic REQ type
0234  */
0235 struct bfi_fcport_req_s {
0236     struct bfi_mhdr_s  mh;      /*  msg header              */
0237     u32    msgtag;  /*  msgtag for reply            */
0238 };
0239 
0240 /*
0241  * Generic RSP type
0242  */
0243 struct bfi_fcport_rsp_s {
0244     struct bfi_mhdr_s  mh;      /*  common msg header           */
0245     u8         status;  /*  port enable status          */
0246     u8         rsvd[3];
0247     struct  bfa_port_cfg_s port_cfg;/* port configuration   */
0248     u32 msgtag;         /* msgtag for reply */
0249 };
0250 
0251 /*
0252  * BFI_FCPORT_H2I_ENABLE_REQ
0253  */
0254 struct bfi_fcport_enable_req_s {
0255     struct bfi_mhdr_s  mh;      /*  msg header              */
0256     u32    rsvd1;
0257     wwn_t          nwwn;    /*  node wwn of physical port       */
0258     wwn_t          pwwn;    /*  port wwn of physical port       */
0259     struct bfa_port_cfg_s port_cfg; /*  port configuration      */
0260     union bfi_addr_u   stats_dma_addr; /*  DMA address for stats        */
0261     u32    msgtag;  /*  msgtag for reply            */
0262     u8  use_flash_cfg;  /* get prot cfg from flash */
0263     u8  rsvd2[3];
0264 };
0265 
0266 /*
0267  * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
0268  */
0269 struct bfi_fcport_set_svc_params_req_s {
0270     struct bfi_mhdr_s  mh;      /*  msg header */
0271     __be16     tx_bbcredit; /*  Tx credits */
0272     u8  rsvd[2];
0273 };
0274 
0275 /*
0276  * BFI_FCPORT_I2H_EVENT
0277  */
0278 struct bfi_fcport_event_s {
0279     struct bfi_mhdr_s   mh; /*  common msg header */
0280     struct bfa_port_link_s  link_state;
0281 };
0282 
0283 /*
0284  * BFI_FCPORT_I2H_TRUNK_SCN
0285  */
0286 struct bfi_fcport_trunk_link_s {
0287     wwn_t           trunk_wwn;
0288     u8          fctl;       /* bfa_trunk_link_fctl_t */
0289     u8          state;      /* bfa_trunk_link_state_t */
0290     u8          speed;      /* bfa_port_speed_t */
0291     u8          rsvd;
0292     __be32      deskew;
0293 };
0294 
0295 #define BFI_FCPORT_MAX_LINKS    2
0296 struct bfi_fcport_trunk_scn_s {
0297     struct bfi_mhdr_s   mh;
0298     u8          trunk_state;    /* bfa_trunk_state_t */
0299     u8          trunk_speed;    /* bfa_port_speed_t */
0300     u8          rsvd_a[2];
0301     struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS];
0302 };
0303 
0304 /*
0305  * fcport H2I message
0306  */
0307 union bfi_fcport_h2i_msg_u {
0308     struct bfi_mhdr_s           *mhdr;
0309     struct bfi_fcport_enable_req_s      *penable;
0310     struct bfi_fcport_req_s         *pdisable;
0311     struct bfi_fcport_set_svc_params_req_s  *psetsvcparams;
0312     struct bfi_fcport_req_s         *pstatsget;
0313     struct bfi_fcport_req_s         *pstatsclear;
0314 };
0315 
0316 /*
0317  * fcport I2H message
0318  */
0319 union bfi_fcport_i2h_msg_u {
0320     struct bfi_msg_s            *msg;
0321     struct bfi_fcport_rsp_s         *penable_rsp;
0322     struct bfi_fcport_rsp_s         *pdisable_rsp;
0323     struct bfi_fcport_rsp_s         *psetsvcparams_rsp;
0324     struct bfi_fcport_rsp_s         *pstatsget_rsp;
0325     struct bfi_fcport_rsp_s         *pstatsclear_rsp;
0326     struct bfi_fcport_event_s       *event;
0327     struct bfi_fcport_trunk_scn_s       *trunk_scn;
0328 };
0329 
0330 enum bfi_fcxp_h2i {
0331     BFI_FCXP_H2I_SEND_REQ = 1,
0332 };
0333 
0334 enum bfi_fcxp_i2h {
0335     BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1),
0336 };
0337 
0338 #define BFA_FCXP_MAX_SGES   2
0339 
0340 /*
0341  * FCXP send request structure
0342  */
0343 struct bfi_fcxp_send_req_s {
0344     struct bfi_mhdr_s  mh;      /*  Common msg header           */
0345     __be16  fcxp_tag;   /*  driver request tag          */
0346     __be16  max_frmsz;  /*  max send frame size     */
0347     __be16  vf_id;      /*  vsan tag if applicable      */
0348     u16 rport_fw_hndl;  /*  FW Handle for the remote port  */
0349     u8   class;     /*  FC class used for req/rsp       */
0350     u8   rsp_timeout;   /*  timeout in secs, 0-no response */
0351     u8   cts;       /*  continue sequence           */
0352     u8   lp_fwtag;  /*  lport tag               */
0353     struct fchs_s   fchs;   /*  request FC header structure    */
0354     __be32  req_len;    /*  request payload length      */
0355     __be32  rsp_maxlen; /*  max response length expected   */
0356     struct bfi_alen_s req_alen; /* request buffer   */
0357     struct bfi_alen_s rsp_alen; /* response buffer  */
0358 };
0359 
0360 /*
0361  * FCXP send response structure
0362  */
0363 struct bfi_fcxp_send_rsp_s {
0364     struct bfi_mhdr_s  mh;      /*  Common msg header           */
0365     __be16  fcxp_tag;   /*  send request tag            */
0366     u8   req_status;    /*  request status          */
0367     u8   rsvd;
0368     __be32  rsp_len;    /*  actual response length      */
0369     __be32  residue_len;    /*  residual response length        */
0370     struct fchs_s   fchs;   /*  response FC header structure   */
0371 };
0372 
0373 enum bfi_uf_h2i {
0374     BFI_UF_H2I_BUF_POST = 1,
0375 };
0376 
0377 enum bfi_uf_i2h {
0378     BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1),
0379 };
0380 
0381 #define BFA_UF_MAX_SGES 2
0382 
0383 struct bfi_uf_buf_post_s {
0384     struct bfi_mhdr_s  mh;      /*  Common msg header       */
0385     u16 buf_tag;    /*  buffer tag          */
0386     __be16  buf_len;    /*  total buffer length */
0387     struct bfi_alen_s alen; /* buffer address/len pair  */
0388 };
0389 
0390 struct bfi_uf_frm_rcvd_s {
0391     struct bfi_mhdr_s  mh;      /*  Common msg header       */
0392     u16 buf_tag;    /*  buffer tag          */
0393     u16 rsvd;
0394     u16 frm_len;    /*  received frame length   */
0395     u16 xfr_len;    /*  tranferred length       */
0396 };
0397 
0398 enum bfi_lps_h2i_msgs {
0399     BFI_LPS_H2I_LOGIN_REQ   = 1,
0400     BFI_LPS_H2I_LOGOUT_REQ  = 2,
0401     BFI_LPS_H2I_N2N_PID_REQ = 3,
0402 };
0403 
0404 enum bfi_lps_i2h_msgs {
0405     BFI_LPS_I2H_LOGIN_RSP   = BFA_I2HM(1),
0406     BFI_LPS_I2H_LOGOUT_RSP  = BFA_I2HM(2),
0407     BFI_LPS_I2H_CVL_EVENT   = BFA_I2HM(3),
0408 };
0409 
0410 struct bfi_lps_login_req_s {
0411     struct bfi_mhdr_s  mh;      /*  common msg header       */
0412     u8      bfa_tag;
0413     u8      alpa;
0414     __be16      pdu_size;
0415     wwn_t       pwwn;
0416     wwn_t       nwwn;
0417     u8      fdisc;
0418     u8      auth_en;
0419     u8      lps_role;
0420     u8      bb_scn;
0421     u32     vvl_flag;
0422 };
0423 
0424 struct bfi_lps_login_rsp_s {
0425     struct bfi_mhdr_s  mh;      /*  common msg header       */
0426     u8      fw_tag;
0427     u8      status;
0428     u8      lsrjt_rsn;
0429     u8      lsrjt_expl;
0430     wwn_t       port_name;
0431     wwn_t       node_name;
0432     __be16      bb_credit;
0433     u8      f_port;
0434     u8      npiv_en;
0435     u32 lp_pid:24;
0436     u32 auth_req:8;
0437     mac_t       lp_mac;
0438     mac_t       fcf_mac;
0439     u8      ext_status;
0440     u8      brcd_switch;    /*  attached peer is brcd switch */
0441     u8      bfa_tag;
0442     u8      rsvd;
0443 };
0444 
0445 struct bfi_lps_logout_req_s {
0446     struct bfi_mhdr_s  mh;      /*  common msg header       */
0447     u8      fw_tag;
0448     u8      rsvd[3];
0449     wwn_t       port_name;
0450 };
0451 
0452 struct bfi_lps_logout_rsp_s {
0453     struct bfi_mhdr_s  mh;      /*  common msg header       */
0454     u8      bfa_tag;
0455     u8      status;
0456     u8      rsvd[2];
0457 };
0458 
0459 struct bfi_lps_cvl_event_s {
0460     struct bfi_mhdr_s  mh;      /*  common msg header       */
0461     u8      bfa_tag;
0462     u8      rsvd[3];
0463 };
0464 
0465 struct bfi_lps_n2n_pid_req_s {
0466     struct bfi_mhdr_s   mh; /*  common msg header       */
0467     u8  fw_tag;
0468     u32 lp_pid:24;
0469 };
0470 
0471 union bfi_lps_h2i_msg_u {
0472     struct bfi_mhdr_s       *msg;
0473     struct bfi_lps_login_req_s  *login_req;
0474     struct bfi_lps_logout_req_s *logout_req;
0475     struct bfi_lps_n2n_pid_req_s    *n2n_pid_req;
0476 };
0477 
0478 union bfi_lps_i2h_msg_u {
0479     struct bfi_msg_s        *msg;
0480     struct bfi_lps_login_rsp_s  *login_rsp;
0481     struct bfi_lps_logout_rsp_s *logout_rsp;
0482     struct bfi_lps_cvl_event_s  *cvl_event;
0483 };
0484 
0485 enum bfi_rport_h2i_msgs {
0486     BFI_RPORT_H2I_CREATE_REQ = 1,
0487     BFI_RPORT_H2I_DELETE_REQ = 2,
0488     BFI_RPORT_H2I_SET_SPEED_REQ  = 3,
0489 };
0490 
0491 enum bfi_rport_i2h_msgs {
0492     BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1),
0493     BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2),
0494     BFI_RPORT_I2H_QOS_SCN    = BFA_I2HM(3),
0495     BFI_RPORT_I2H_LIP_SCN_ONLINE =  BFA_I2HM(4),
0496     BFI_RPORT_I2H_LIP_SCN_OFFLINE = BFA_I2HM(5),
0497     BFI_RPORT_I2H_NO_DEV    = BFA_I2HM(6),
0498 };
0499 
0500 struct bfi_rport_create_req_s {
0501     struct bfi_mhdr_s  mh;      /*  common msg header       */
0502     u16 bfa_handle; /*  host rport handle       */
0503     __be16  max_frmsz;  /*  max rcv pdu size        */
0504     u32 pid:24, /*  remote port ID      */
0505         lp_fwtag:8; /*  local port tag      */
0506     u32 local_pid:24,   /*  local port ID       */
0507         cisc:8;
0508     u8  fc_class;   /*  supported FC classes    */
0509     u8  vf_en;      /*  virtual fabric enable   */
0510     u16 vf_id;      /*  virtual fabric ID       */
0511 };
0512 
0513 struct bfi_rport_create_rsp_s {
0514     struct bfi_mhdr_s  mh;      /*  common msg header       */
0515     u8      status;     /*  rport creation status   */
0516     u8      rsvd[3];
0517     u16 bfa_handle; /*  host rport handle       */
0518     u16 fw_handle;  /*  firmware rport handle   */
0519     struct bfa_rport_qos_attr_s qos_attr;  /* QoS Attributes */
0520 };
0521 
0522 struct bfa_rport_speed_req_s {
0523     struct bfi_mhdr_s  mh;      /*  common msg header       */
0524     u16 fw_handle;  /*  firmware rport handle   */
0525     u8      speed;      /*  rport's speed via RPSC  */
0526     u8      rsvd;
0527 };
0528 
0529 struct bfi_rport_delete_req_s {
0530     struct bfi_mhdr_s  mh;      /*  common msg header       */
0531     u16 fw_handle;  /*  firmware rport handle   */
0532     u16 rsvd;
0533 };
0534 
0535 struct bfi_rport_delete_rsp_s {
0536     struct bfi_mhdr_s  mh;      /*  common msg header       */
0537     u16 bfa_handle; /*  host rport handle       */
0538     u8      status;     /*  rport deletion status   */
0539     u8      rsvd;
0540 };
0541 
0542 struct bfi_rport_qos_scn_s {
0543     struct bfi_mhdr_s  mh;      /*  common msg header       */
0544     u16 bfa_handle; /*  host rport handle       */
0545     u16 rsvd;
0546     struct bfa_rport_qos_attr_s old_qos_attr;  /* Old QoS Attributes */
0547     struct bfa_rport_qos_attr_s new_qos_attr;  /* New QoS Attributes */
0548 };
0549 
0550 struct bfi_rport_lip_scn_s {
0551     struct bfi_mhdr_s  mh;      /*!< common msg header  */
0552     u16 bfa_handle; /*!< host rport handle  */
0553     u8      status;     /*!< scn online status  */
0554     u8      rsvd;
0555     struct bfa_fcport_loop_info_s   loop_info;
0556 };
0557 
0558 union bfi_rport_h2i_msg_u {
0559     struct bfi_msg_s        *msg;
0560     struct bfi_rport_create_req_s   *create_req;
0561     struct bfi_rport_delete_req_s   *delete_req;
0562     struct bfi_rport_speed_req_s    *speed_req;
0563 };
0564 
0565 union bfi_rport_i2h_msg_u {
0566     struct bfi_msg_s        *msg;
0567     struct bfi_rport_create_rsp_s   *create_rsp;
0568     struct bfi_rport_delete_rsp_s   *delete_rsp;
0569     struct bfi_rport_qos_scn_s  *qos_scn_evt;
0570     struct bfi_rport_lip_scn_s  *lip_scn;
0571 };
0572 
0573 /*
0574  * Initiator mode I-T nexus interface defines.
0575  */
0576 
0577 enum bfi_itn_h2i {
0578     BFI_ITN_H2I_CREATE_REQ = 1, /*  i-t nexus creation */
0579     BFI_ITN_H2I_DELETE_REQ = 2, /*  i-t nexus deletion */
0580 };
0581 
0582 enum bfi_itn_i2h {
0583     BFI_ITN_I2H_CREATE_RSP = BFA_I2HM(1),
0584     BFI_ITN_I2H_DELETE_RSP = BFA_I2HM(2),
0585     BFI_ITN_I2H_SLER_EVENT = BFA_I2HM(3),
0586 };
0587 
0588 struct bfi_itn_create_req_s {
0589     struct bfi_mhdr_s  mh;      /*  common msg header        */
0590     u16 fw_handle;  /*  f/w handle for itnim     */
0591     u8  class;      /*  FC class for IO      */
0592     u8  seq_rec;    /*  sequence recovery support    */
0593     u8  msg_no;     /*  seq id of the msg        */
0594     u8  role;
0595 };
0596 
0597 struct bfi_itn_create_rsp_s {
0598     struct bfi_mhdr_s  mh;      /*  common msg header        */
0599     u16 bfa_handle; /*  bfa handle for itnim     */
0600     u8  status;     /*  fcp request status       */
0601     u8  seq_id;     /*  seq id of the msg        */
0602 };
0603 
0604 struct bfi_itn_delete_req_s {
0605     struct bfi_mhdr_s  mh;      /*  common msg header        */
0606     u16 fw_handle;  /*  f/w itnim handle         */
0607     u8  seq_id;     /*  seq id of the msg        */
0608     u8  rsvd;
0609 };
0610 
0611 struct bfi_itn_delete_rsp_s {
0612     struct bfi_mhdr_s  mh;      /*  common msg header        */
0613     u16 bfa_handle; /*  bfa handle for itnim     */
0614     u8  status;     /*  fcp request status       */
0615     u8  seq_id;     /*  seq id of the msg        */
0616 };
0617 
0618 struct bfi_itn_sler_event_s {
0619     struct bfi_mhdr_s  mh;      /*  common msg header        */
0620     u16 bfa_handle; /*  bfa handle for itnim     */
0621     u16 rsvd;
0622 };
0623 
0624 union bfi_itn_h2i_msg_u {
0625     struct bfi_itn_create_req_s *create_req;
0626     struct bfi_itn_delete_req_s *delete_req;
0627     struct bfi_msg_s    *msg;
0628 };
0629 
0630 union bfi_itn_i2h_msg_u {
0631     struct bfi_itn_create_rsp_s *create_rsp;
0632     struct bfi_itn_delete_rsp_s *delete_rsp;
0633     struct bfi_itn_sler_event_s *sler_event;
0634     struct bfi_msg_s    *msg;
0635 };
0636 
0637 /*
0638  * Initiator mode IO interface defines.
0639  */
0640 
0641 enum bfi_ioim_h2i {
0642     BFI_IOIM_H2I_IOABORT_REQ = 1,   /*  IO abort request     */
0643     BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /*  IO cleanup request   */
0644 };
0645 
0646 enum bfi_ioim_i2h {
0647     BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1),  /*  non-fp IO response   */
0648     BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2), /*  ABORT rsp    */
0649 };
0650 
0651 /*
0652  * IO command DIF info
0653  */
0654 struct bfi_ioim_dif_s {
0655     u32 dif_info[4];
0656 };
0657 
0658 /*
0659  * FCP IO messages overview
0660  *
0661  * @note
0662  * - Max CDB length supported is 64 bytes.
0663  * - SCSI Linked commands and SCSI bi-directional Commands not
0664  *  supported.
0665  *
0666  */
0667 struct bfi_ioim_req_s {
0668     struct bfi_mhdr_s  mh;      /*  Common msg header        */
0669     __be16  io_tag;     /*  I/O tag          */
0670     u16 rport_hdl;  /*  itnim/rport firmware handle */
0671     struct fcp_cmnd_s   cmnd;   /*  IO request info */
0672 
0673     /*
0674      * SG elements array within the IO request must be double word
0675      * aligned. This alignment is required to optimize SGM setup for the IO.
0676      */
0677     struct bfi_sge_s    sges[BFI_SGE_INLINE_MAX];
0678     u8  io_timeout;
0679     u8  dif_en;
0680     u8  rsvd_a[2];
0681     struct bfi_ioim_dif_s  dif;
0682 };
0683 
0684 /*
0685  *  This table shows various IO status codes from firmware and their
0686  *  meaning. Host driver can use these status codes to further process
0687  *  IO completions.
0688  *
0689  *  BFI_IOIM_STS_OK     : IO completed with error free SCSI &
0690  *                  transport status.
0691  *                   io-tag can be reused.
0692  *
0693  *  BFA_IOIM_STS_SCSI_ERR       : IO completed with scsi error.
0694  *  - io-tag can be reused.
0695  *
0696  *  BFI_IOIM_STS_HOST_ABORTED   : IO was aborted successfully due to
0697  *                      host request.
0698  *                  - io-tag cannot be reused yet.
0699  *
0700  *  BFI_IOIM_STS_ABORTED        : IO was aborted successfully
0701  *                      internally by f/w.
0702  *                  - io-tag cannot be reused yet.
0703  *
0704  *  BFI_IOIM_STS_TIMEDOUT   : IO timedout and ABTS/RRQ is happening
0705  *                  in the firmware and
0706  *                  - io-tag cannot be reused yet.
0707  *
0708  *  BFI_IOIM_STS_SQER_NEEDED    : Firmware could not recover the IO
0709  *                    with sequence level error
0710  *  logic and hence host needs to retry
0711  *                    this IO with a different IO tag
0712  *                  - io-tag cannot be used yet.
0713  *
0714  *  BFI_IOIM_STS_NEXUS_ABORT    : Second Level Error Recovery from host
0715  *                    is required because 2 consecutive ABTS
0716  *                    timedout and host needs logout and
0717  *                    re-login with the target
0718  *                  - io-tag cannot be used yet.
0719  *
0720  *  BFI_IOIM_STS_UNDERRUN   : IO completed with SCSI status good,
0721  *                    but the data tranferred is less than
0722  *                    the fcp data length in the command.
0723  *                    ex. SCSI INQUIRY where transferred
0724  *                    data length and residue count in FCP
0725  *                    response accounts for total fcp-dl
0726  *                    - io-tag can be reused.
0727  *
0728  *  BFI_IOIM_STS_OVERRUN    : IO completed with SCSI status good,
0729  *                    but the data transerred is more than
0730  *                    fcp data length in the command. ex.
0731  *                    TAPE IOs where blocks can of unequal
0732  *                    lengths.
0733  *                  - io-tag can be reused.
0734  *
0735  *  BFI_IOIM_STS_RES_FREE   : Firmware has completed using io-tag
0736  *                    during abort process
0737  *                  - io-tag can be reused.
0738  *
0739  *  BFI_IOIM_STS_PROTO_ERR  : Firmware detected a protocol error.
0740  *                    ex target sent more data than
0741  *                    requested, or there was data frame
0742  *                    loss and other reasons
0743  *                  - io-tag cannot be used yet.
0744  *
0745  *  BFI_IOIM_STS_DIF_ERR    : Firwmare detected DIF error. ex: DIF
0746  *                  CRC err or Ref Tag err or App tag err.
0747  *                  - io-tag can be reused.
0748  *
0749  *  BFA_IOIM_STS_TSK_MGT_ABORT  : IO was aborted because of Task
0750  *                    Management command from the host
0751  *                    - io-tag can be reused.
0752  *
0753  *  BFI_IOIM_STS_UTAG       : Firmware does not know about this
0754  *                    io_tag.
0755  *                  - io-tag can be reused.
0756  */
0757 enum bfi_ioim_status {
0758     BFI_IOIM_STS_OK = 0,
0759     BFI_IOIM_STS_HOST_ABORTED = 1,
0760     BFI_IOIM_STS_ABORTED = 2,
0761     BFI_IOIM_STS_TIMEDOUT = 3,
0762     BFI_IOIM_STS_RES_FREE = 4,
0763     BFI_IOIM_STS_SQER_NEEDED = 5,
0764     BFI_IOIM_STS_PROTO_ERR = 6,
0765     BFI_IOIM_STS_UTAG = 7,
0766     BFI_IOIM_STS_PATHTOV = 8,
0767 };
0768 
0769 /*
0770  * I/O response message
0771  */
0772 struct bfi_ioim_rsp_s {
0773     struct bfi_mhdr_s   mh; /*  common msg header       */
0774     __be16  io_tag;     /*  completed IO tag         */
0775     u16 bfa_rport_hndl; /*  releated rport handle    */
0776     u8  io_status;  /*  IO completion status     */
0777     u8  reuse_io_tag;   /*  IO tag can be reused    */
0778     u16 abort_tag;  /*  host abort request tag  */
0779     u8      scsi_status;    /*  scsi status from target  */
0780     u8      sns_len;    /*  scsi sense length        */
0781     u8      resid_flags;    /*  IO residue flags         */
0782     u8      rsvd_a;
0783     __be32  residue;    /*  IO residual length in bytes */
0784     u32 rsvd_b[3];
0785 };
0786 
0787 struct bfi_ioim_abort_req_s {
0788     struct bfi_mhdr_s  mh;  /*  Common msg header  */
0789     __be16  io_tag; /*  I/O tag */
0790     u16 abort_tag;  /*  unique request tag */
0791 };
0792 
0793 /*
0794  * Initiator mode task management command interface defines.
0795  */
0796 
0797 enum bfi_tskim_h2i {
0798     BFI_TSKIM_H2I_TM_REQ    = 1, /*  task-mgmt command  */
0799     BFI_TSKIM_H2I_ABORT_REQ = 2, /*  task-mgmt command  */
0800 };
0801 
0802 enum bfi_tskim_i2h {
0803     BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1),
0804 };
0805 
0806 struct bfi_tskim_req_s {
0807     struct bfi_mhdr_s  mh;  /*  Common msg header   */
0808     __be16  tsk_tag;    /*  task management tag */
0809     u16 itn_fhdl;   /*  itn firmware handle */
0810     struct  scsi_lun lun;   /*  LU number   */
0811     u8  tm_flags;   /*  see enum fcp_tm_cmnd    */
0812     u8  t_secs; /*  Timeout value in seconds    */
0813     u8  rsvd[2];
0814 };
0815 
0816 struct bfi_tskim_abortreq_s {
0817     struct bfi_mhdr_s  mh;  /*  Common msg header   */
0818     __be16  tsk_tag;    /*  task management tag */
0819     u16 rsvd;
0820 };
0821 
0822 enum bfi_tskim_status {
0823     /*
0824      * Following are FCP-4 spec defined status codes,
0825      * **DO NOT CHANGE THEM **
0826      */
0827     BFI_TSKIM_STS_OK    = 0,
0828     BFI_TSKIM_STS_NOT_SUPP = 4,
0829     BFI_TSKIM_STS_FAILED    = 5,
0830 
0831     /*
0832      * Defined by BFA
0833      */
0834     BFI_TSKIM_STS_TIMEOUT  = 10,    /*  TM request timedout */
0835     BFI_TSKIM_STS_ABORTED  = 11,    /*  Aborted on host request */
0836     BFI_TSKIM_STS_UTAG     = 12,    /*  unknown tag for request */
0837 };
0838 
0839 struct bfi_tskim_rsp_s {
0840     struct bfi_mhdr_s  mh;      /*  Common msg header        */
0841     __be16  tsk_tag;    /*  task mgmt cmnd tag       */
0842     u8  tsk_status; /*  @ref bfi_tskim_status */
0843     u8  rsvd;
0844 };
0845 
0846 #pragma pack()
0847 
0848 /*
0849  * Crossbow PCI MSI-X vector defines
0850  */
0851 enum {
0852     BFI_MSIX_CPE_QMIN_CB = 0,
0853     BFI_MSIX_CPE_QMAX_CB = 7,
0854     BFI_MSIX_RME_QMIN_CB = 8,
0855     BFI_MSIX_RME_QMAX_CB = 15,
0856     BFI_MSIX_CB_MAX = 22,
0857 };
0858 
0859 /*
0860  * Catapult FC PCI MSI-X vector defines
0861  */
0862 enum {
0863     BFI_MSIX_LPU_ERR_CT = 0,
0864     BFI_MSIX_CPE_QMIN_CT = 1,
0865     BFI_MSIX_CPE_QMAX_CT = 4,
0866     BFI_MSIX_RME_QMIN_CT = 5,
0867     BFI_MSIX_RME_QMAX_CT = 8,
0868     BFI_MSIX_CT_MAX = 9,
0869 };
0870 
0871 #endif /* __BFI_MS_H__ */