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_FCS_H__
0012 #define __BFA_DEFS_FCS_H__
0013 
0014 #include "bfa_fc.h"
0015 #include "bfa_defs_svc.h"
0016 
0017 /*
0018  * VF states
0019  */
0020 enum bfa_vf_state {
0021     BFA_VF_UNINIT    = 0,   /*  fabric is not yet initialized */
0022     BFA_VF_LINK_DOWN = 1,   /*  link is down */
0023     BFA_VF_FLOGI     = 2,   /*  flogi is in progress */
0024     BFA_VF_AUTH      = 3,   /*  authentication in progress */
0025     BFA_VF_NOFABRIC  = 4,   /*  fabric is not present */
0026     BFA_VF_ONLINE    = 5,   /*  login to fabric is complete */
0027     BFA_VF_EVFP      = 6,   /*  EVFP is in progress */
0028     BFA_VF_ISOLATED  = 7,   /*  port isolated due to vf_id mismatch */
0029 };
0030 
0031 /*
0032  * VF statistics
0033  */
0034 struct bfa_vf_stats_s {
0035     u32 flogi_sent; /*  Num FLOGIs sent */
0036     u32 flogi_rsp_err;  /*  FLOGI response errors */
0037     u32 flogi_acc_err;  /*  FLOGI accept errors */
0038     u32 flogi_accepts;  /*  FLOGI accepts received */
0039     u32 flogi_rejects;  /*  FLOGI rejects received */
0040     u32 flogi_unknown_rsp; /*  Unknown responses for FLOGI */
0041     u32 flogi_alloc_wait; /*  Allocation waits prior to sending FLOGI */
0042     u32 flogi_rcvd; /*  FLOGIs received */
0043     u32 flogi_rejected; /*  Incoming FLOGIs rejected */
0044     u32 fabric_onlines; /*  Internal fabric online notification sent
0045                  *  to other modules */
0046     u32 fabric_offlines; /* Internal fabric offline notification sent
0047                   * to other modules */
0048     u32 resvd; /*  padding for 64 bit alignment */
0049 };
0050 
0051 /*
0052  * VF attributes returned in queries
0053  */
0054 struct bfa_vf_attr_s {
0055     enum bfa_vf_state  state;       /*  VF state */
0056     u32        rsvd;
0057     wwn_t           fabric_name;    /*  fabric name */
0058 };
0059 
0060 #define BFA_FCS_MAX_LPORTS 256
0061 #define BFA_FCS_FABRIC_IPADDR_SZ  16
0062 
0063 /*
0064  * symbolic names for base port/virtual port
0065  */
0066 #define BFA_SYMNAME_MAXLEN  128 /* 128 bytes */
0067 struct bfa_lport_symname_s {
0068     char        symname[BFA_SYMNAME_MAXLEN];
0069 };
0070 
0071 /*
0072 * Roles of FCS port:
0073  *     - FCP IM and FCP TM roles cannot be enabled together for a FCS port
0074  *     - Create multiple ports if both IM and TM functions required.
0075  *     - Atleast one role must be specified.
0076  */
0077 enum bfa_lport_role {
0078     BFA_LPORT_ROLE_FCP_IM   = 0x01, /*  FCP initiator role */
0079     BFA_LPORT_ROLE_FCP_MAX  = BFA_LPORT_ROLE_FCP_IM,
0080 };
0081 
0082 /*
0083  * FCS port configuration.
0084  */
0085 struct bfa_lport_cfg_s {
0086     wwn_t          pwwn;       /*  port wwn */
0087     wwn_t          nwwn;       /*  node wwn */
0088     struct bfa_lport_symname_s  sym_name;   /*  vm port symbolic name */
0089     struct bfa_lport_symname_s node_sym_name; /* Node symbolic name */
0090     enum bfa_lport_role roles;      /* FCS port roles */
0091     u32     rsvd;
0092     bfa_boolean_t   preboot_vp;  /*  vport created from PBC */
0093     u8  tag[16];        /* opaque tag from application */
0094     u8  padding[4];
0095 };
0096 
0097 /*
0098  * FCS port states
0099  */
0100 enum bfa_lport_state {
0101     BFA_LPORT_UNINIT  = 0,  /*  PORT is not yet initialized */
0102     BFA_LPORT_FDISC   = 1,  /*  FDISC is in progress */
0103     BFA_LPORT_ONLINE  = 2,  /*  login to fabric is complete */
0104     BFA_LPORT_OFFLINE = 3,  /*  No login to fabric */
0105 };
0106 
0107 /*
0108  * FCS port type.
0109  */
0110 enum bfa_lport_type {
0111     BFA_LPORT_TYPE_PHYSICAL = 0,
0112     BFA_LPORT_TYPE_VIRTUAL,
0113 };
0114 
0115 /*
0116  * FCS port offline reason.
0117  */
0118 enum bfa_lport_offline_reason {
0119     BFA_LPORT_OFFLINE_UNKNOWN = 0,
0120     BFA_LPORT_OFFLINE_LINKDOWN,
0121     BFA_LPORT_OFFLINE_FAB_UNSUPPORTED,  /*  NPIV not supported by the
0122      *    fabric */
0123     BFA_LPORT_OFFLINE_FAB_NORESOURCES,
0124     BFA_LPORT_OFFLINE_FAB_LOGOUT,
0125 };
0126 
0127 /*
0128  * FCS lport info.
0129  */
0130 struct bfa_lport_info_s {
0131     u8   port_type; /* bfa_lport_type_t : physical or
0132      * virtual */
0133     u8   port_state;    /* one of bfa_lport_state values */
0134     u8   offline_reason;    /* one of bfa_lport_offline_reason_t
0135      * values */
0136     wwn_t      port_wwn;
0137     wwn_t      node_wwn;
0138 
0139     /*
0140      * following 4 feilds are valid for Physical Ports only
0141      */
0142     u32 max_vports_supp;    /* Max supported vports */
0143     u32 num_vports_inuse;   /* Num of in use vports */
0144     u32 max_rports_supp;    /* Max supported rports */
0145     u32 num_rports_inuse;   /* Num of doscovered rports */
0146 
0147 };
0148 
0149 /*
0150  * FCS port statistics
0151  */
0152 struct bfa_lport_stats_s {
0153     u32 ns_plogi_sent;
0154     u32 ns_plogi_rsp_err;
0155     u32 ns_plogi_acc_err;
0156     u32 ns_plogi_accepts;
0157     u32 ns_rejects; /* NS command rejects */
0158     u32 ns_plogi_unknown_rsp;
0159     u32 ns_plogi_alloc_wait;
0160 
0161     u32 ns_retries; /* NS command retries */
0162     u32 ns_timeouts;    /* NS command timeouts */
0163 
0164     u32 ns_rspnid_sent;
0165     u32 ns_rspnid_accepts;
0166     u32 ns_rspnid_rsp_err;
0167     u32 ns_rspnid_rejects;
0168     u32 ns_rspnid_alloc_wait;
0169 
0170     u32 ns_rftid_sent;
0171     u32 ns_rftid_accepts;
0172     u32 ns_rftid_rsp_err;
0173     u32 ns_rftid_rejects;
0174     u32 ns_rftid_alloc_wait;
0175 
0176     u32 ns_rffid_sent;
0177     u32 ns_rffid_accepts;
0178     u32 ns_rffid_rsp_err;
0179     u32 ns_rffid_rejects;
0180     u32 ns_rffid_alloc_wait;
0181 
0182     u32 ns_gidft_sent;
0183     u32 ns_gidft_accepts;
0184     u32 ns_gidft_rsp_err;
0185     u32 ns_gidft_rejects;
0186     u32 ns_gidft_unknown_rsp;
0187     u32 ns_gidft_alloc_wait;
0188 
0189     u32 ns_rnnid_sent;
0190     u32 ns_rnnid_accepts;
0191     u32 ns_rnnid_rsp_err;
0192     u32 ns_rnnid_rejects;
0193     u32 ns_rnnid_alloc_wait;
0194 
0195     u32 ns_rsnn_nn_sent;
0196     u32 ns_rsnn_nn_accepts;
0197     u32 ns_rsnn_nn_rsp_err;
0198     u32 ns_rsnn_nn_rejects;
0199     u32 ns_rsnn_nn_alloc_wait;
0200 
0201     /*
0202      * Mgmt Server stats
0203      */
0204     u32 ms_retries; /* MS command retries */
0205     u32 ms_timeouts;    /* MS command timeouts */
0206     u32 ms_plogi_sent;
0207     u32 ms_plogi_rsp_err;
0208     u32 ms_plogi_acc_err;
0209     u32 ms_plogi_accepts;
0210     u32 ms_rejects; /* MS command rejects */
0211     u32 ms_plogi_unknown_rsp;
0212     u32 ms_plogi_alloc_wait;
0213 
0214     u32 num_rscn;   /* Num of RSCN received */
0215     u32 num_portid_rscn;/* Num portid format RSCN
0216     * received */
0217 
0218     u32 uf_recvs;   /* Unsolicited recv frames  */
0219     u32 uf_recv_drops;  /* Dropped received frames  */
0220 
0221     u32 plogi_rcvd; /* Received plogi   */
0222     u32 prli_rcvd;  /* Received prli    */
0223     u32 adisc_rcvd; /* Received adisc   */
0224     u32 prlo_rcvd;  /* Received prlo    */
0225     u32 logo_rcvd;  /* Received logo    */
0226     u32 rpsc_rcvd;  /* Received rpsc    */
0227     u32 un_handled_els_rcvd;    /* Received unhandled ELS   */
0228     u32 rport_plogi_timeouts; /* Rport plogi retry timeout count */
0229     u32 rport_del_max_plogi_retry; /* Deleted rport
0230                         * (max retry of plogi) */
0231 };
0232 
0233 /*
0234  * BFA port attribute returned in queries
0235  */
0236 struct bfa_lport_attr_s {
0237     enum bfa_lport_state state; /*  port state */
0238     u32  pid;   /*  port ID */
0239     struct bfa_lport_cfg_s   port_cfg;  /*  port configuration */
0240     enum bfa_port_type port_type;   /*  current topology */
0241     u32  loopback;  /*  cable is externally looped back */
0242     wwn_t   fabric_name; /*  attached switch's nwwn */
0243     u8  fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ]; /*  attached
0244     * fabric's ip addr */
0245     mac_t      fpma_mac;    /*  Lport's FPMA Mac address */
0246     u16 authfail;   /*  auth failed state */
0247 };
0248 
0249 
0250 /*
0251  * VPORT states
0252  */
0253 enum bfa_vport_state {
0254     BFA_FCS_VPORT_UNINIT        = 0,
0255     BFA_FCS_VPORT_CREATED       = 1,
0256     BFA_FCS_VPORT_OFFLINE       = 1,
0257     BFA_FCS_VPORT_FDISC_SEND    = 2,
0258     BFA_FCS_VPORT_FDISC     = 3,
0259     BFA_FCS_VPORT_FDISC_RETRY   = 4,
0260     BFA_FCS_VPORT_FDISC_RSP_WAIT    = 5,
0261     BFA_FCS_VPORT_ONLINE        = 6,
0262     BFA_FCS_VPORT_DELETING      = 7,
0263     BFA_FCS_VPORT_CLEANUP       = 8,
0264     BFA_FCS_VPORT_LOGO_SEND     = 9,
0265     BFA_FCS_VPORT_LOGO      = 10,
0266     BFA_FCS_VPORT_ERROR     = 11,
0267     BFA_FCS_VPORT_MAX_STATE,
0268 };
0269 
0270 /*
0271  * vport statistics
0272  */
0273 struct bfa_vport_stats_s {
0274     struct bfa_lport_stats_s port_stats;    /*  base class (port) stats */
0275     /*
0276      * TODO - remove
0277      */
0278 
0279     u32        fdisc_sent;  /*  num fdisc sent */
0280     u32        fdisc_accepts;   /*  fdisc accepts */
0281     u32        fdisc_retries;   /*  fdisc retries */
0282     u32        fdisc_timeouts;  /*  fdisc timeouts */
0283     u32        fdisc_rsp_err;   /*  fdisc response error */
0284     u32        fdisc_acc_bad;   /*  bad fdisc accepts */
0285     u32        fdisc_rejects;   /*  fdisc rejects */
0286     u32        fdisc_unknown_rsp;
0287     /*
0288      *!< fdisc rsp unknown error
0289      */
0290     u32        fdisc_alloc_wait;/*  fdisc req (fcxp)alloc wait */
0291 
0292     u32        logo_alloc_wait;/*  logo req (fcxp) alloc wait */
0293     u32        logo_sent;   /*  logo sent */
0294     u32        logo_accepts;    /*  logo accepts */
0295     u32        logo_rejects;    /*  logo rejects */
0296     u32        logo_rsp_err;    /*  logo rsp errors */
0297     u32        logo_unknown_rsp;
0298             /*  logo rsp unknown errors */
0299 
0300     u32        fab_no_npiv; /*  fabric does not support npiv */
0301 
0302     u32        fab_offline; /*  offline events from fab SM */
0303     u32        fab_online;  /*  online events from fab SM */
0304     u32        fab_cleanup; /*  cleanup request from fab SM */
0305     u32        rsvd;
0306 };
0307 
0308 /*
0309  * BFA vport attribute returned in queries
0310  */
0311 struct bfa_vport_attr_s {
0312     struct bfa_lport_attr_s   port_attr; /*  base class (port) attributes */
0313     enum bfa_vport_state vport_state; /*  vport state */
0314     u32          rsvd;
0315 };
0316 
0317 /*
0318  * FCS remote port states
0319  */
0320 enum bfa_rport_state {
0321     BFA_RPORT_UNINIT    = 0,    /*  PORT is not yet initialized */
0322     BFA_RPORT_OFFLINE   = 1,    /*  rport is offline */
0323     BFA_RPORT_PLOGI     = 2,    /*  PLOGI to rport is in progress */
0324     BFA_RPORT_ONLINE    = 3,    /*  login to rport is complete */
0325     BFA_RPORT_PLOGI_RETRY   = 4,    /*  retrying login to rport */
0326     BFA_RPORT_NSQUERY   = 5,    /*  nameserver query */
0327     BFA_RPORT_ADISC     = 6,    /*  ADISC authentication */
0328     BFA_RPORT_LOGO      = 7,    /*  logging out with rport */
0329     BFA_RPORT_LOGORCV   = 8,    /*  handling LOGO from rport */
0330     BFA_RPORT_NSDISC    = 9,    /*  re-discover rport */
0331 };
0332 
0333 /*
0334  *  Rport Scsi Function : Initiator/Target.
0335  */
0336 enum bfa_rport_function {
0337     BFA_RPORT_INITIATOR = 0x01, /*  SCSI Initiator  */
0338     BFA_RPORT_TARGET    = 0x02, /*  SCSI Target */
0339 };
0340 
0341 /*
0342  * port/node symbolic names for rport
0343  */
0344 #define BFA_RPORT_SYMNAME_MAXLEN    255
0345 struct bfa_rport_symname_s {
0346     char            symname[BFA_RPORT_SYMNAME_MAXLEN];
0347 };
0348 
0349 /*
0350  * FCS remote port statistics
0351  */
0352 struct bfa_rport_stats_s {
0353     u32        offlines;           /*  remote port offline count  */
0354     u32        onlines;            /*  remote port online count   */
0355     u32        rscns;              /*  RSCN affecting rport       */
0356     u32        plogis;          /*  plogis sent                */
0357     u32        plogi_accs;      /*  plogi accepts              */
0358     u32        plogi_timeouts;      /*  plogi timeouts             */
0359     u32        plogi_rejects;       /*  rcvd plogi rejects         */
0360     u32        plogi_failed;        /*  local failure              */
0361     u32        plogi_rcvd;      /*  plogis rcvd                */
0362     u32        prli_rcvd;          /*  inbound PRLIs              */
0363     u32        adisc_rcvd;         /*  ADISCs received            */
0364     u32        adisc_rejects;      /*  recvd  ADISC rejects       */
0365     u32        adisc_sent;         /*  ADISC requests sent        */
0366     u32        adisc_accs;         /*  ADISC accepted by rport    */
0367     u32        adisc_failed;       /*  ADISC failed (no response) */
0368     u32        adisc_rejected;     /*  ADISC rejected by us    */
0369     u32        logos;              /*  logos sent                 */
0370     u32        logo_accs;          /*  LOGO accepts from rport    */
0371     u32        logo_failed;        /*  LOGO failures              */
0372     u32        logo_rejected;      /*  LOGO rejects from rport    */
0373     u32        logo_rcvd;          /*  LOGO from remote port      */
0374 
0375     u32        rpsc_rcvd;         /*  RPSC received            */
0376     u32        rpsc_rejects;      /*  recvd  RPSC rejects       */
0377     u32        rpsc_sent;         /*  RPSC requests sent        */
0378     u32        rpsc_accs;         /*  RPSC accepted by rport    */
0379     u32        rpsc_failed;       /*  RPSC failed (no response) */
0380     u32        rpsc_rejected;     /*  RPSC rejected by us    */
0381 
0382     u32 rjt_insuff_res; /*  LS RJT with insuff resources */
0383     struct bfa_rport_hal_stats_s    hal_stats;  /*  BFA rport stats    */
0384 };
0385 
0386 /*
0387  * FCS remote port attributes returned in queries
0388  */
0389 struct bfa_rport_attr_s {
0390     wwn_t       nwwn;   /*  node wwn */
0391     wwn_t       pwwn;   /*  port wwn */
0392     enum fc_cos cos_supported;  /*  supported class of services */
0393     u32     pid;    /*  port ID */
0394     u32     df_sz;  /*  Max payload size */
0395     enum bfa_rport_state    state;  /*  Rport State machine state */
0396     enum fc_cos fc_cos; /*  FC classes of services */
0397     bfa_boolean_t   cisc;   /*  CISC capable device */
0398     struct bfa_rport_symname_s symname; /*  Symbolic Name */
0399     enum bfa_rport_function scsi_function; /*  Initiator/Target */
0400     struct bfa_rport_qos_attr_s qos_attr; /*  qos attributes  */
0401     enum bfa_port_speed curr_speed;   /*  operating speed got from
0402                         * RPSC ELS. UNKNOWN, if RPSC
0403                         * is not supported */
0404     bfa_boolean_t   trl_enforced;   /*  TRL enforced ? TRUE/FALSE */
0405     enum bfa_port_speed assigned_speed; /* Speed assigned by the user.
0406                          * will be used if RPSC is not
0407                          * supported by the rport */
0408 };
0409 
0410 struct bfa_rport_remote_link_stats_s {
0411     u32 lfc; /*  Link Failure Count */
0412     u32 lsyc; /*  Loss of Synchronization Count */
0413     u32 lsic; /*  Loss of Signal Count */
0414     u32 pspec; /*  Primitive Sequence Protocol Error Count */
0415     u32 itwc; /*  Invalid Transmission Word Count */
0416     u32 icc; /*  Invalid CRC Count */
0417 };
0418 
0419 struct bfa_rport_qualifier_s {
0420     wwn_t   pwwn;   /* Port WWN */
0421     u32 pid;    /* port ID */
0422     u32 rsvd;
0423 };
0424 
0425 #define BFA_MAX_IO_INDEX 7
0426 #define BFA_NO_IO_INDEX 9
0427 
0428 /*
0429  * FCS itnim states
0430  */
0431 enum bfa_itnim_state {
0432     BFA_ITNIM_OFFLINE   = 0,    /*  offline */
0433     BFA_ITNIM_PRLI_SEND = 1,    /*  prli send */
0434     BFA_ITNIM_PRLI_SENT = 2,    /*  prli sent */
0435     BFA_ITNIM_PRLI_RETRY    = 3,    /*  prli retry */
0436     BFA_ITNIM_HCB_ONLINE    = 4,    /*  online callback */
0437     BFA_ITNIM_ONLINE    = 5,    /*  online */
0438     BFA_ITNIM_HCB_OFFLINE   = 6,    /*  offline callback */
0439     BFA_ITNIM_INITIATIOR    = 7,    /*  initiator */
0440 };
0441 
0442 /*
0443  * FCS remote port statistics
0444  */
0445 struct bfa_itnim_stats_s {
0446     u32        onlines; /*  num rport online */
0447     u32        offlines;    /*  num rport offline */
0448     u32        prli_sent;   /*  num prli sent out */
0449     u32        fcxp_alloc_wait;/*  num fcxp alloc waits */
0450     u32        prli_rsp_err;    /*  num prli rsp errors */
0451     u32        prli_rsp_acc;    /*  num prli rsp accepts */
0452     u32        initiator;   /*  rport is an initiator */
0453     u32        prli_rsp_parse_err;  /*  prli rsp parsing errors */
0454     u32        prli_rsp_rjt;    /*  num prli rsp rejects */
0455     u32        timeout; /*  num timeouts detected */
0456     u32        sler;        /*  num sler notification from BFA */
0457     u32 rsvd;       /* padding for 64 bit alignment */
0458 };
0459 
0460 /*
0461  * FCS itnim attributes returned in queries
0462  */
0463 struct bfa_itnim_attr_s {
0464     enum bfa_itnim_state state; /*  FCS itnim state        */
0465     u8 retry;       /*  data retransmision support */
0466     u8  task_retry_id;  /*  task retry ident support   */
0467     u8 rec_support;    /*  REC supported              */
0468     u8 conf_comp;      /*  confirmed completion supp  */
0469 };
0470 
0471 #endif /* __BFA_DEFS_FCS_H__ */