Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is part of the Chelsio FCoE driver for Linux.
0003  *
0004  * Copyright (c) 2009-2010 Chelsio Communications, Inc. All rights reserved.
0005  *
0006  * This software is available to you under a choice of one of two
0007  * licenses.  You may choose to be licensed under the terms of the GNU
0008  * General Public License (GPL) Version 2, available from the file
0009  * COPYING in the main directory of this source tree, or the
0010  * OpenIB.org BSD license below:
0011  *
0012  *     Redistribution and use in source and binary forms, with or
0013  *     without modification, are permitted provided that the following
0014  *     conditions are met:
0015  *
0016  *      - Redistributions of source code must retain the above
0017  *        copyright notice, this list of conditions and the following
0018  *        disclaimer.
0019  *
0020  *      - Redistributions in binary form must reproduce the above
0021  *        copyright notice, this list of conditions and the following
0022  *        disclaimer in the documentation and/or other materials
0023  *        provided with the distribution.
0024  *
0025  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0026  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0027  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0028  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
0029  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
0030  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0031  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0032  * SOFTWARE.
0033  */
0034 
0035 #ifndef _T4FW_API_STOR_H_
0036 #define _T4FW_API_STOR_H_
0037 
0038 
0039 /******************************************************************************
0040  *   R E T U R N   V A L U E S
0041  ********************************/
0042 
0043 enum fw_fcoe_link_sub_op {
0044     FCOE_LINK_DOWN  = 0x0,
0045     FCOE_LINK_UP    = 0x1,
0046     FCOE_LINK_COND  = 0x2,
0047 };
0048 
0049 enum fw_fcoe_link_status {
0050     FCOE_LINKDOWN   = 0x0,
0051     FCOE_LINKUP = 0x1,
0052 };
0053 
0054 enum fw_ofld_prot {
0055     PROT_FCOE   = 0x1,
0056     PROT_ISCSI  = 0x2,
0057 };
0058 
0059 enum rport_type_fcoe {
0060     FLOGI_VFPORT    = 0x1,      /* 0xfffffe */
0061     FDISC_VFPORT    = 0x2,      /* 0xfffffe */
0062     NS_VNPORT   = 0x3,      /* 0xfffffc */
0063     REG_FC4_VNPORT  = 0x4,      /* any FC4 type VN_PORT */
0064     REG_VNPORT  = 0x5,      /* 0xfffxxx - non FC4 port in switch */
0065     FDMI_VNPORT = 0x6,      /* 0xfffffa */
0066     FAB_CTLR_VNPORT = 0x7,      /* 0xfffffd */
0067 };
0068 
0069 enum event_cause_fcoe {
0070     PLOGI_ACC_RCVD      = 0x01,
0071     PLOGI_RJT_RCVD      = 0x02,
0072     PLOGI_RCVD      = 0x03,
0073     PLOGO_RCVD      = 0x04,
0074     PRLI_ACC_RCVD       = 0x05,
0075     PRLI_RJT_RCVD       = 0x06,
0076     PRLI_RCVD       = 0x07,
0077     PRLO_RCVD       = 0x08,
0078     NPORT_ID_CHGD       = 0x09,
0079     FLOGO_RCVD      = 0x0a,
0080     CLR_VIRT_LNK_RCVD   = 0x0b,
0081     FLOGI_ACC_RCVD      = 0x0c,
0082     FLOGI_RJT_RCVD      = 0x0d,
0083     FDISC_ACC_RCVD      = 0x0e,
0084     FDISC_RJT_RCVD      = 0x0f,
0085     FLOGI_TMO_MAX_RETRY = 0x10,
0086     IMPL_LOGO_ADISC_ACC = 0x11,
0087     IMPL_LOGO_ADISC_RJT = 0x12,
0088     IMPL_LOGO_ADISC_CNFLT   = 0x13,
0089     PRLI_TMO        = 0x14,
0090     ADISC_TMO       = 0x15,
0091     RSCN_DEV_LOST       = 0x16,
0092     SCR_ACC_RCVD        = 0x17,
0093     ADISC_RJT_RCVD      = 0x18,
0094     LOGO_SNT        = 0x19,
0095     PROTO_ERR_IMPL_LOGO = 0x1a,
0096 };
0097 
0098 enum fcoe_cmn_type {
0099     FCOE_ELS,
0100     FCOE_CT,
0101     FCOE_SCSI_CMD,
0102     FCOE_UNSOL_ELS,
0103 };
0104 
0105 enum fw_wr_stor_opcodes {
0106     FW_RDEV_WR                     = 0x38,
0107     FW_FCOE_ELS_CT_WR              = 0x30,
0108     FW_SCSI_WRITE_WR               = 0x31,
0109     FW_SCSI_READ_WR                = 0x32,
0110     FW_SCSI_CMD_WR                 = 0x33,
0111     FW_SCSI_ABRT_CLS_WR            = 0x34,
0112 };
0113 
0114 struct fw_rdev_wr {
0115     __be32 op_to_immdlen;
0116     __be32 alloc_to_len16;
0117     __be64 cookie;
0118     u8     protocol;
0119     u8     event_cause;
0120     u8     cur_state;
0121     u8     prev_state;
0122     __be32 flags_to_assoc_flowid;
0123     union rdev_entry {
0124         struct fcoe_rdev_entry {
0125             __be32 flowid;
0126             u8     protocol;
0127             u8     event_cause;
0128             u8     flags;
0129             u8     rjt_reason;
0130             u8     cur_login_st;
0131             u8     prev_login_st;
0132             __be16 rcv_fr_sz;
0133             u8     rd_xfer_rdy_to_rport_type;
0134             u8     vft_to_qos;
0135             u8     org_proc_assoc_to_acc_rsp_code;
0136             u8     enh_disc_to_tgt;
0137             u8     wwnn[8];
0138             u8     wwpn[8];
0139             __be16 iqid;
0140             u8     fc_oui[3];
0141             u8     r_id[3];
0142         } fcoe_rdev;
0143         struct iscsi_rdev_entry {
0144             __be32 flowid;
0145             u8     protocol;
0146             u8     event_cause;
0147             u8     flags;
0148             u8     r3;
0149             __be16 iscsi_opts;
0150             __be16 tcp_opts;
0151             __be16 ip_opts;
0152             __be16 max_rcv_len;
0153             __be16 max_snd_len;
0154             __be16 first_brst_len;
0155             __be16 max_brst_len;
0156             __be16 r4;
0157             __be16 def_time2wait;
0158             __be16 def_time2ret;
0159             __be16 nop_out_intrvl;
0160             __be16 non_scsi_to;
0161             __be16 isid;
0162             __be16 tsid;
0163             __be16 port;
0164             __be16 tpgt;
0165             u8     r5[6];
0166             __be16 iqid;
0167         } iscsi_rdev;
0168     } u;
0169 };
0170 
0171 #define FW_RDEV_WR_FLOWID_GET(x)    (((x) >> 8) & 0xfffff)
0172 #define FW_RDEV_WR_ASSOC_FLOWID_GET(x)  (((x) >> 0) & 0xfffff)
0173 #define FW_RDEV_WR_RPORT_TYPE_GET(x)    (((x) >> 0) & 0x1f)
0174 #define FW_RDEV_WR_NPIV_GET(x)      (((x) >> 6) & 0x1)
0175 #define FW_RDEV_WR_CLASS_GET(x)     (((x) >> 4) & 0x3)
0176 #define FW_RDEV_WR_TASK_RETRY_ID_GET(x) (((x) >> 5) & 0x1)
0177 #define FW_RDEV_WR_RETRY_GET(x)     (((x) >> 4) & 0x1)
0178 #define FW_RDEV_WR_CONF_CMPL_GET(x) (((x) >> 3) & 0x1)
0179 #define FW_RDEV_WR_INI_GET(x)       (((x) >> 1) & 0x1)
0180 #define FW_RDEV_WR_TGT_GET(x)       (((x) >> 0) & 0x1)
0181 
0182 struct fw_fcoe_els_ct_wr {
0183     __be32 op_immdlen;
0184     __be32 flowid_len16;
0185     u64    cookie;
0186     __be16 iqid;
0187     u8     tmo_val;
0188     u8     els_ct_type;
0189     u8     ctl_pri;
0190     u8     cp_en_class;
0191     __be16 xfer_cnt;
0192     u8     fl_to_sp;
0193     u8     l_id[3];
0194     u8     r5;
0195     u8     r_id[3];
0196     __be64 rsp_dmaaddr;
0197     __be32 rsp_dmalen;
0198     __be32 r6;
0199 };
0200 
0201 #define FW_FCOE_ELS_CT_WR_OPCODE(x)     ((x) << 24)
0202 #define FW_FCOE_ELS_CT_WR_OPCODE_GET(x)     (((x) >> 24) & 0xff)
0203 #define FW_FCOE_ELS_CT_WR_IMMDLEN(x)        ((x) << 0)
0204 #define FW_FCOE_ELS_CT_WR_IMMDLEN_GET(x)    (((x) >> 0) & 0xff)
0205 #define FW_FCOE_ELS_CT_WR_SP(x)         ((x) << 0)
0206 
0207 struct fw_scsi_write_wr {
0208     __be32 op_immdlen;
0209     __be32 flowid_len16;
0210     u64    cookie;
0211     __be16 iqid;
0212     u8     tmo_val;
0213     u8     use_xfer_cnt;
0214     union fw_scsi_write_priv {
0215         struct fcoe_write_priv {
0216             u8   ctl_pri;
0217             u8   cp_en_class;
0218             u8   r3_lo[2];
0219         } fcoe;
0220         struct iscsi_write_priv {
0221             u8   r3[4];
0222         } iscsi;
0223     } u;
0224     __be32 xfer_cnt;
0225     __be32 ini_xfer_cnt;
0226     __be64 rsp_dmaaddr;
0227     __be32 rsp_dmalen;
0228     __be32 r4;
0229 };
0230 
0231 #define FW_SCSI_WRITE_WR_IMMDLEN(x) ((x) << 0)
0232 
0233 struct fw_scsi_read_wr {
0234     __be32 op_immdlen;
0235     __be32 flowid_len16;
0236     u64    cookie;
0237     __be16 iqid;
0238     u8     tmo_val;
0239     u8     use_xfer_cnt;
0240     union fw_scsi_read_priv {
0241         struct fcoe_read_priv {
0242             u8   ctl_pri;
0243             u8   cp_en_class;
0244             u8   r3_lo[2];
0245         } fcoe;
0246         struct iscsi_read_priv {
0247             u8   r3[4];
0248         } iscsi;
0249     } u;
0250     __be32 xfer_cnt;
0251     __be32 ini_xfer_cnt;
0252     __be64 rsp_dmaaddr;
0253     __be32 rsp_dmalen;
0254     __be32 r4;
0255 };
0256 
0257 #define FW_SCSI_READ_WR_IMMDLEN(x)  ((x) << 0)
0258 
0259 struct fw_scsi_cmd_wr {
0260     __be32 op_immdlen;
0261     __be32 flowid_len16;
0262     u64    cookie;
0263     __be16 iqid;
0264     u8     tmo_val;
0265     u8     r3;
0266     union fw_scsi_cmd_priv {
0267         struct fcoe_cmd_priv {
0268             u8   ctl_pri;
0269             u8   cp_en_class;
0270             u8   r4_lo[2];
0271         } fcoe;
0272         struct iscsi_cmd_priv {
0273             u8   r4[4];
0274         } iscsi;
0275     } u;
0276     u8     r5[8];
0277     __be64 rsp_dmaaddr;
0278     __be32 rsp_dmalen;
0279     __be32 r6;
0280 };
0281 
0282 #define FW_SCSI_CMD_WR_IMMDLEN(x)   ((x) << 0)
0283 
0284 #define SCSI_ABORT 0
0285 #define SCSI_CLOSE 1
0286 
0287 struct fw_scsi_abrt_cls_wr {
0288     __be32 op_immdlen;
0289     __be32 flowid_len16;
0290     u64    cookie;
0291     __be16 iqid;
0292     u8     tmo_val;
0293     u8     sub_opcode_to_chk_all_io;
0294     u8     r3[4];
0295     u64    t_cookie;
0296 };
0297 
0298 #define FW_SCSI_ABRT_CLS_WR_SUB_OPCODE(x)   ((x) << 2)
0299 #define FW_SCSI_ABRT_CLS_WR_SUB_OPCODE_GET(x)   (((x) >> 2) & 0x3f)
0300 #define FW_SCSI_ABRT_CLS_WR_CHK_ALL_IO(x)   ((x) << 0)
0301 
0302 enum fw_cmd_stor_opcodes {
0303     FW_FCOE_RES_INFO_CMD           = 0x31,
0304     FW_FCOE_LINK_CMD               = 0x32,
0305     FW_FCOE_VNP_CMD                = 0x33,
0306     FW_FCOE_SPARAMS_CMD            = 0x35,
0307     FW_FCOE_STATS_CMD              = 0x37,
0308     FW_FCOE_FCF_CMD                = 0x38,
0309 };
0310 
0311 struct fw_fcoe_res_info_cmd {
0312     __be32 op_to_read;
0313     __be32 retval_len16;
0314     __be16 e_d_tov;
0315     __be16 r_a_tov_seq;
0316     __be16 r_a_tov_els;
0317     __be16 r_r_tov;
0318     __be32 max_xchgs;
0319     __be32 max_ssns;
0320     __be32 used_xchgs;
0321     __be32 used_ssns;
0322     __be32 max_fcfs;
0323     __be32 max_vnps;
0324     __be32 used_fcfs;
0325     __be32 used_vnps;
0326 };
0327 
0328 struct fw_fcoe_link_cmd {
0329     __be32 op_to_portid;
0330     __be32 retval_len16;
0331     __be32 sub_opcode_fcfi;
0332     u8     r3;
0333     u8     lstatus;
0334     __be16 flags;
0335     u8     r4;
0336     u8     set_vlan;
0337     __be16 vlan_id;
0338     __be32 vnpi_pkd;
0339     __be16 r6;
0340     u8     phy_mac[6];
0341     u8     vnport_wwnn[8];
0342     u8     vnport_wwpn[8];
0343 };
0344 
0345 #define FW_FCOE_LINK_CMD_PORTID(x)  ((x) << 0)
0346 #define FW_FCOE_LINK_CMD_PORTID_GET(x)  (((x) >> 0) & 0xf)
0347 #define FW_FCOE_LINK_CMD_SUB_OPCODE(x)  ((x) << 24U)
0348 #define FW_FCOE_LINK_CMD_FCFI(x)    ((x) << 0)
0349 #define FW_FCOE_LINK_CMD_FCFI_GET(x)    (((x) >> 0) & 0xffffff)
0350 #define FW_FCOE_LINK_CMD_VNPI_GET(x)    (((x) >> 0) & 0xfffff)
0351 
0352 struct fw_fcoe_vnp_cmd {
0353     __be32 op_to_fcfi;
0354     __be32 alloc_to_len16;
0355     __be32 gen_wwn_to_vnpi;
0356     __be32 vf_id;
0357     __be16 iqid;
0358     u8   vnport_mac[6];
0359     u8   vnport_wwnn[8];
0360     u8   vnport_wwpn[8];
0361     u8   cmn_srv_parms[16];
0362     u8   clsp_word_0_1[8];
0363 };
0364 
0365 #define FW_FCOE_VNP_CMD_FCFI(x)     ((x) << 0)
0366 #define FW_FCOE_VNP_CMD_ALLOC       (1U << 31)
0367 #define FW_FCOE_VNP_CMD_FREE        (1U << 30)
0368 #define FW_FCOE_VNP_CMD_MODIFY      (1U << 29)
0369 #define FW_FCOE_VNP_CMD_GEN_WWN     (1U << 22)
0370 #define FW_FCOE_VNP_CMD_VFID_EN     (1U << 20)
0371 #define FW_FCOE_VNP_CMD_VNPI(x)     ((x) << 0)
0372 #define FW_FCOE_VNP_CMD_VNPI_GET(x) (((x) >> 0) & 0xfffff)
0373 
0374 struct fw_fcoe_sparams_cmd {
0375     __be32 op_to_portid;
0376     __be32 retval_len16;
0377     u8     r3[7];
0378     u8     cos;
0379     u8     lport_wwnn[8];
0380     u8     lport_wwpn[8];
0381     u8     cmn_srv_parms[16];
0382     u8     cls_srv_parms[16];
0383 };
0384 
0385 #define FW_FCOE_SPARAMS_CMD_PORTID(x)   ((x) << 0)
0386 
0387 struct fw_fcoe_stats_cmd {
0388     __be32 op_to_flowid;
0389     __be32 free_to_len16;
0390     union fw_fcoe_stats {
0391         struct fw_fcoe_stats_ctl {
0392             u8   nstats_port;
0393             u8   port_valid_ix;
0394             __be16 r6;
0395             __be32 r7;
0396             __be64 stat0;
0397             __be64 stat1;
0398             __be64 stat2;
0399             __be64 stat3;
0400             __be64 stat4;
0401             __be64 stat5;
0402         } ctl;
0403         struct fw_fcoe_port_stats {
0404             __be64 tx_bcast_bytes;
0405             __be64 tx_bcast_frames;
0406             __be64 tx_mcast_bytes;
0407             __be64 tx_mcast_frames;
0408             __be64 tx_ucast_bytes;
0409             __be64 tx_ucast_frames;
0410             __be64 tx_drop_frames;
0411             __be64 tx_offload_bytes;
0412             __be64 tx_offload_frames;
0413             __be64 rx_bcast_bytes;
0414             __be64 rx_bcast_frames;
0415             __be64 rx_mcast_bytes;
0416             __be64 rx_mcast_frames;
0417             __be64 rx_ucast_bytes;
0418             __be64 rx_ucast_frames;
0419             __be64 rx_err_frames;
0420         } port_stats;
0421         struct fw_fcoe_fcf_stats {
0422             __be32 fip_tx_bytes;
0423             __be32 fip_tx_fr;
0424             __be64 fcf_ka;
0425             __be64 mcast_adv_rcvd;
0426             __be16 ucast_adv_rcvd;
0427             __be16 sol_sent;
0428             __be16 vlan_req;
0429             __be16 vlan_rpl;
0430             __be16 clr_vlink;
0431             __be16 link_down;
0432             __be16 link_up;
0433             __be16 logo;
0434             __be16 flogi_req;
0435             __be16 flogi_rpl;
0436             __be16 fdisc_req;
0437             __be16 fdisc_rpl;
0438             __be16 fka_prd_chg;
0439             __be16 fc_map_chg;
0440             __be16 vfid_chg;
0441             u8   no_fka_req;
0442             u8   no_vnp;
0443         } fcf_stats;
0444         struct fw_fcoe_pcb_stats {
0445             __be64 tx_bytes;
0446             __be64 tx_frames;
0447             __be64 rx_bytes;
0448             __be64 rx_frames;
0449             __be32 vnp_ka;
0450             __be32 unsol_els_rcvd;
0451             __be64 unsol_cmd_rcvd;
0452             __be16 implicit_logo;
0453             __be16 flogi_inv_sparm;
0454             __be16 fdisc_inv_sparm;
0455             __be16 flogi_rjt;
0456             __be16 fdisc_rjt;
0457             __be16 no_ssn;
0458             __be16 mac_flt_fail;
0459             __be16 inv_fr_rcvd;
0460         } pcb_stats;
0461         struct fw_fcoe_scb_stats {
0462             __be64 tx_bytes;
0463             __be64 tx_frames;
0464             __be64 rx_bytes;
0465             __be64 rx_frames;
0466             __be32 host_abrt_req;
0467             __be32 adap_auto_abrt;
0468             __be32 adap_abrt_rsp;
0469             __be32 host_ios_req;
0470             __be16 ssn_offl_ios;
0471             __be16 ssn_not_rdy_ios;
0472             u8   rx_data_ddp_err;
0473             u8   ddp_flt_set_err;
0474             __be16 rx_data_fr_err;
0475             u8   bad_st_abrt_req;
0476             u8   no_io_abrt_req;
0477             u8   abort_tmo;
0478             u8   abort_tmo_2;
0479             __be32 abort_req;
0480             u8   no_ppod_res_tmo;
0481             u8   bp_tmo;
0482             u8   adap_auto_cls;
0483             u8   no_io_cls_req;
0484             __be32 host_cls_req;
0485             __be64 unsol_cmd_rcvd;
0486             __be32 plogi_req_rcvd;
0487             __be32 prli_req_rcvd;
0488             __be16 logo_req_rcvd;
0489             __be16 prlo_req_rcvd;
0490             __be16 plogi_rjt_rcvd;
0491             __be16 prli_rjt_rcvd;
0492             __be32 adisc_req_rcvd;
0493             __be32 rscn_rcvd;
0494             __be32 rrq_req_rcvd;
0495             __be32 unsol_els_rcvd;
0496             u8   adisc_rjt_rcvd;
0497             u8   scr_rjt;
0498             u8   ct_rjt;
0499             u8   inval_bls_rcvd;
0500             __be32 ba_rjt_rcvd;
0501         } scb_stats;
0502     } u;
0503 };
0504 
0505 #define FW_FCOE_STATS_CMD_FLOWID(x) ((x) << 0)
0506 #define FW_FCOE_STATS_CMD_FREE      (1U << 30)
0507 #define FW_FCOE_STATS_CMD_NSTATS(x) ((x) << 4)
0508 #define FW_FCOE_STATS_CMD_PORT(x)   ((x) << 0)
0509 #define FW_FCOE_STATS_CMD_PORT_VALID    (1U << 7)
0510 #define FW_FCOE_STATS_CMD_IX(x)     ((x) << 0)
0511 
0512 struct fw_fcoe_fcf_cmd {
0513     __be32 op_to_fcfi;
0514     __be32 retval_len16;
0515     __be16 priority_pkd;
0516     u8     mac[6];
0517     u8     name_id[8];
0518     u8     fabric[8];
0519     __be16 vf_id;
0520     __be16 max_fcoe_size;
0521     u8     vlan_id;
0522     u8     fc_map[3];
0523     __be32 fka_adv;
0524     __be32 r6;
0525     u8     r7_hi;
0526     u8     fpma_to_portid;
0527     u8     spma_mac[6];
0528     __be64 r8;
0529 };
0530 
0531 #define FW_FCOE_FCF_CMD_FCFI(x)     ((x) << 0)
0532 #define FW_FCOE_FCF_CMD_FCFI_GET(x) (((x) >> 0) & 0xfffff)
0533 #define FW_FCOE_FCF_CMD_PRIORITY_GET(x) (((x) >> 0) & 0xff)
0534 #define FW_FCOE_FCF_CMD_FPMA_GET(x) (((x) >> 6) & 0x1)
0535 #define FW_FCOE_FCF_CMD_SPMA_GET(x) (((x) >> 5) & 0x1)
0536 #define FW_FCOE_FCF_CMD_LOGIN_GET(x)    (((x) >> 4) & 0x1)
0537 #define FW_FCOE_FCF_CMD_PORTID_GET(x)   (((x) >> 0) & 0xf)
0538 
0539 #endif /* _T4FW_API_STOR_H_ */