Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * Copyright(c) 2007 Intel Corporation. All rights reserved.
0004  *
0005  * Maintained at www.Open-FCoE.org
0006  */
0007 
0008 #ifndef _FC_ELS_H_
0009 #define _FC_ELS_H_
0010 
0011 #include <linux/types.h>
0012 #include <asm/byteorder.h>
0013 
0014 /*
0015  * Fibre Channel Switch - Enhanced Link Services definitions.
0016  * From T11 FC-LS Rev 1.2 June 7, 2005.
0017  */
0018 
0019 /*
0020  * ELS Command codes - byte 0 of the frame payload
0021  */
0022 enum fc_els_cmd {
0023     ELS_LS_RJT =    0x01,   /* ESL reject */
0024     ELS_LS_ACC =    0x02,   /* ESL Accept */
0025     ELS_PLOGI = 0x03,   /* N_Port login */
0026     ELS_FLOGI = 0x04,   /* F_Port login */
0027     ELS_LOGO =  0x05,   /* Logout */
0028     ELS_ABTX =  0x06,   /* Abort exchange - obsolete */
0029     ELS_RCS =   0x07,   /* read connection status */
0030     ELS_RES =   0x08,   /* read exchange status block */
0031     ELS_RSS =   0x09,   /* read sequence status block */
0032     ELS_RSI =   0x0a,   /* read sequence initiative */
0033     ELS_ESTS =  0x0b,   /* establish streaming */
0034     ELS_ESTC =  0x0c,   /* estimate credit */
0035     ELS_ADVC =  0x0d,   /* advise credit */
0036     ELS_RTV =   0x0e,   /* read timeout value */
0037     ELS_RLS =   0x0f,   /* read link error status block */
0038     ELS_ECHO =  0x10,   /* echo */
0039     ELS_TEST =  0x11,   /* test */
0040     ELS_RRQ =   0x12,   /* reinstate recovery qualifier */
0041     ELS_REC =   0x13,   /* read exchange concise */
0042     ELS_SRR =   0x14,   /* sequence retransmission request */
0043     ELS_FPIN =  0x16,   /* Fabric Performance Impact Notification */
0044     ELS_EDC =   0x17,   /* Exchange Diagnostic Capabilities */
0045     ELS_RDP =   0x18,   /* Read Diagnostic Parameters */
0046     ELS_RDF =   0x19,   /* Register Diagnostic Functions */
0047     ELS_PRLI =  0x20,   /* process login */
0048     ELS_PRLO =  0x21,   /* process logout */
0049     ELS_SCN =   0x22,   /* state change notification */
0050     ELS_TPLS =  0x23,   /* test process login state */
0051     ELS_TPRLO = 0x24,   /* third party process logout */
0052     ELS_LCLM =  0x25,   /* login control list mgmt (obs) */
0053     ELS_GAID =  0x30,   /* get alias_ID */
0054     ELS_FACT =  0x31,   /* fabric activate alias_id */
0055     ELS_FDACDT =    0x32,   /* fabric deactivate alias_id */
0056     ELS_NACT =  0x33,   /* N-port activate alias_id */
0057     ELS_NDACT = 0x34,   /* N-port deactivate alias_id */
0058     ELS_QOSR =  0x40,   /* quality of service request */
0059     ELS_RVCS =  0x41,   /* read virtual circuit status */
0060     ELS_PDISC = 0x50,   /* discover N_port service params */
0061     ELS_FDISC = 0x51,   /* discover F_port service params */
0062     ELS_ADISC = 0x52,   /* discover address */
0063     ELS_RNC =   0x53,   /* report node cap (obs) */
0064     ELS_FARP_REQ =  0x54,   /* FC ARP request */
0065     ELS_FARP_REPL = 0x55,   /* FC ARP reply */
0066     ELS_RPS =   0x56,   /* read port status block */
0067     ELS_RPL =   0x57,   /* read port list */
0068     ELS_RPBC =  0x58,   /* read port buffer condition */
0069     ELS_FAN =   0x60,   /* fabric address notification */
0070     ELS_RSCN =  0x61,   /* registered state change notification */
0071     ELS_SCR =   0x62,   /* state change registration */
0072     ELS_RNFT =  0x63,   /* report node FC-4 types */
0073     ELS_CSR =   0x68,   /* clock synch. request */
0074     ELS_CSU =   0x69,   /* clock synch. update */
0075     ELS_LINIT = 0x70,   /* loop initialize */
0076     ELS_LSTS =  0x72,   /* loop status */
0077     ELS_RNID =  0x78,   /* request node ID data */
0078     ELS_RLIR =  0x79,   /* registered link incident report */
0079     ELS_LIRR =  0x7a,   /* link incident record registration */
0080     ELS_SRL =   0x7b,   /* scan remote loop */
0081     ELS_SBRP =  0x7c,   /* set bit-error reporting params */
0082     ELS_RPSC =  0x7d,   /* report speed capabilities */
0083     ELS_QSA =   0x7e,   /* query security attributes */
0084     ELS_EVFP =  0x7f,   /* exchange virt. fabrics params */
0085     ELS_LKA =   0x80,   /* link keep-alive */
0086     ELS_AUTH_ELS =  0x90,   /* authentication ELS */
0087 };
0088 
0089 /*
0090  * Initializer useful for decoding table.
0091  * Please keep this in sync with the above definitions.
0092  */
0093 #define FC_ELS_CMDS_INIT {          \
0094     [ELS_LS_RJT] =  "LS_RJT",       \
0095     [ELS_LS_ACC] =  "LS_ACC",       \
0096     [ELS_PLOGI] =   "PLOGI",        \
0097     [ELS_FLOGI] =   "FLOGI",        \
0098     [ELS_LOGO] =    "LOGO",         \
0099     [ELS_ABTX] =    "ABTX",         \
0100     [ELS_RCS] = "RCS",          \
0101     [ELS_RES] = "RES",          \
0102     [ELS_RSS] = "RSS",          \
0103     [ELS_RSI] = "RSI",          \
0104     [ELS_ESTS] =    "ESTS",         \
0105     [ELS_ESTC] =    "ESTC",         \
0106     [ELS_ADVC] =    "ADVC",         \
0107     [ELS_RTV] = "RTV",          \
0108     [ELS_RLS] = "RLS",          \
0109     [ELS_ECHO] =    "ECHO",         \
0110     [ELS_TEST] =    "TEST",         \
0111     [ELS_RRQ] = "RRQ",          \
0112     [ELS_REC] = "REC",          \
0113     [ELS_SRR] = "SRR",          \
0114     [ELS_FPIN] =    "FPIN",         \
0115     [ELS_EDC] = "EDC",          \
0116     [ELS_RDP] = "RDP",          \
0117     [ELS_RDF] = "RDF",          \
0118     [ELS_PRLI] =    "PRLI",         \
0119     [ELS_PRLO] =    "PRLO",         \
0120     [ELS_SCN] = "SCN",          \
0121     [ELS_TPLS] =    "TPLS",         \
0122     [ELS_TPRLO] =   "TPRLO",        \
0123     [ELS_LCLM] =    "LCLM",         \
0124     [ELS_GAID] =    "GAID",         \
0125     [ELS_FACT] =    "FACT",         \
0126     [ELS_FDACDT] =  "FDACDT",       \
0127     [ELS_NACT] =    "NACT",         \
0128     [ELS_NDACT] =   "NDACT",        \
0129     [ELS_QOSR] =    "QOSR",         \
0130     [ELS_RVCS] =    "RVCS",         \
0131     [ELS_PDISC] =   "PDISC",        \
0132     [ELS_FDISC] =   "FDISC",        \
0133     [ELS_ADISC] =   "ADISC",        \
0134     [ELS_RNC] = "RNC",          \
0135     [ELS_FARP_REQ] = "FARP_REQ",        \
0136     [ELS_FARP_REPL] =  "FARP_REPL",     \
0137     [ELS_RPS] = "RPS",          \
0138     [ELS_RPL] = "RPL",          \
0139     [ELS_RPBC] =    "RPBC",         \
0140     [ELS_FAN] = "FAN",          \
0141     [ELS_RSCN] =    "RSCN",         \
0142     [ELS_SCR] = "SCR",          \
0143     [ELS_RNFT] =    "RNFT",         \
0144     [ELS_CSR] = "CSR",          \
0145     [ELS_CSU] = "CSU",          \
0146     [ELS_LINIT] =   "LINIT",        \
0147     [ELS_LSTS] =    "LSTS",         \
0148     [ELS_RNID] =    "RNID",         \
0149     [ELS_RLIR] =    "RLIR",         \
0150     [ELS_LIRR] =    "LIRR",         \
0151     [ELS_SRL] = "SRL",          \
0152     [ELS_SBRP] =    "SBRP",         \
0153     [ELS_RPSC] =    "RPSC",         \
0154     [ELS_QSA] = "QSA",          \
0155     [ELS_EVFP] =    "EVFP",         \
0156     [ELS_LKA] = "LKA",          \
0157     [ELS_AUTH_ELS] = "AUTH_ELS",        \
0158 }
0159 
0160 /*
0161  * LS_ACC payload.
0162  */
0163 struct fc_els_ls_acc {
0164     __u8          la_cmd;       /* command code ELS_LS_ACC */
0165     __u8          la_resv[3];   /* reserved */
0166 };
0167 
0168 /*
0169  * ELS reject payload.
0170  */
0171 struct fc_els_ls_rjt {
0172     __u8    er_cmd;     /* command code ELS_LS_RJT */
0173     __u8    er_resv[4]; /* reserved must be zero */
0174     __u8    er_reason;  /* reason (enum fc_els_rjt_reason below) */
0175     __u8    er_explan;  /* explanation (enum fc_els_rjt_explan below) */
0176     __u8    er_vendor;  /* vendor specific code */
0177 };
0178 
0179 /*
0180  * ELS reject reason codes (er_reason).
0181  */
0182 enum fc_els_rjt_reason {
0183     ELS_RJT_NONE =      0,  /* no reject - not to be sent */
0184     ELS_RJT_INVAL =     0x01,   /* invalid ELS command code */
0185     ELS_RJT_LOGIC =     0x03,   /* logical error */
0186     ELS_RJT_BUSY =      0x05,   /* logical busy */
0187     ELS_RJT_PROT =      0x07,   /* protocol error */
0188     ELS_RJT_UNAB =      0x09,   /* unable to perform command request */
0189     ELS_RJT_UNSUP =     0x0b,   /* command not supported */
0190     ELS_RJT_INPROG =    0x0e,   /* command already in progress */
0191     ELS_RJT_FIP =       0x20,   /* FIP error */
0192     ELS_RJT_VENDOR =    0xff,   /* vendor specific error */
0193 };
0194 
0195 
0196 /*
0197  * reason code explanation (er_explan).
0198  */
0199 enum fc_els_rjt_explan {
0200     ELS_EXPL_NONE =     0x00,   /* No additional explanation */
0201     ELS_EXPL_SPP_OPT_ERR =  0x01,   /* service parameter error - options */
0202     ELS_EXPL_SPP_ICTL_ERR = 0x03,   /* service parm error - initiator ctl */
0203     ELS_EXPL_AH =       0x11,   /* invalid association header */
0204     ELS_EXPL_AH_REQ =   0x13,   /* association_header required */
0205     ELS_EXPL_SID =      0x15,   /* invalid originator S_ID */
0206     ELS_EXPL_OXID_RXID =    0x17,   /* invalid OX_ID-RX_ID combination */
0207     ELS_EXPL_INPROG =   0x19,   /* Request already in progress */
0208     ELS_EXPL_PLOGI_REQD =   0x1e,   /* N_Port login required */
0209     ELS_EXPL_INSUF_RES =    0x29,   /* insufficient resources */
0210     ELS_EXPL_UNAB_DATA =    0x2a,   /* unable to supply requested data */
0211     ELS_EXPL_UNSUPR =   0x2c,   /* Request not supported */
0212     ELS_EXPL_INV_LEN =  0x2d,   /* Invalid payload length */
0213     ELS_EXPL_NOT_NEIGHBOR = 0x62,   /* VN2VN_Port not in neighbor set */
0214     /* TBD - above definitions incomplete */
0215 };
0216 
0217 /*
0218  * Link Service TLV Descriptor Tag Values
0219  */
0220 enum fc_ls_tlv_dtag {
0221     ELS_DTAG_LS_REQ_INFO =      0x00000001,
0222         /* Link Service Request Information Descriptor */
0223     ELS_DTAG_LNK_FAULT_CAP =    0x0001000D,
0224         /* Link Fault Capability Descriptor */
0225     ELS_DTAG_CG_SIGNAL_CAP =    0x0001000F,
0226         /* Congestion Signaling Capability Descriptor */
0227     ELS_DTAG_LNK_INTEGRITY =    0x00020001,
0228         /* Link Integrity Notification Descriptor */
0229     ELS_DTAG_DELIVERY =     0x00020002,
0230         /* Delivery Notification Descriptor */
0231     ELS_DTAG_PEER_CONGEST =     0x00020003,
0232         /* Peer Congestion Notification Descriptor */
0233     ELS_DTAG_CONGESTION =       0x00020004,
0234         /* Congestion Notification Descriptor */
0235     ELS_DTAG_FPIN_REGISTER =    0x00030001,
0236         /* FPIN Registration Descriptor */
0237 };
0238 
0239 /*
0240  * Initializer useful for decoding table.
0241  * Please keep this in sync with the above definitions.
0242  */
0243 #define FC_LS_TLV_DTAG_INIT {                         \
0244     { ELS_DTAG_LS_REQ_INFO,     "Link Service Request Information" }, \
0245     { ELS_DTAG_LNK_FAULT_CAP,   "Link Fault Capability" },        \
0246     { ELS_DTAG_CG_SIGNAL_CAP,   "Congestion Signaling Capability" },  \
0247     { ELS_DTAG_LNK_INTEGRITY,   "Link Integrity Notification" },      \
0248     { ELS_DTAG_DELIVERY,        "Delivery Notification Present" },    \
0249     { ELS_DTAG_PEER_CONGEST,    "Peer Congestion Notification" },     \
0250     { ELS_DTAG_CONGESTION,      "Congestion Notification" },          \
0251     { ELS_DTAG_FPIN_REGISTER,   "FPIN Registration" },            \
0252 }
0253 
0254 
0255 /*
0256  * Generic Link Service TLV Descriptor format
0257  *
0258  * This structure, as it defines no payload, will also be referred to
0259  * as the "tlv header" - which contains the tag and len fields.
0260  */
0261 struct fc_tlv_desc {
0262     __be32      desc_tag;   /* Notification Descriptor Tag */
0263     __be32      desc_len;   /* Length of Descriptor (in bytes).
0264                      * Size of descriptor excluding
0265                      * desc_tag and desc_len fields.
0266                      */
0267     __u8        desc_value[];  /* Descriptor Value */
0268 };
0269 
0270 /* Descriptor tag and len fields are considered the mandatory header
0271  * for a descriptor
0272  */
0273 #define FC_TLV_DESC_HDR_SZ  sizeof(struct fc_tlv_desc)
0274 
0275 /*
0276  * Macro, used when initializing payloads, to return the descriptor length.
0277  * Length is size of descriptor minus the tag and len fields.
0278  */
0279 #define FC_TLV_DESC_LENGTH_FROM_SZ(desc)    \
0280         (sizeof(desc) - FC_TLV_DESC_HDR_SZ)
0281 
0282 /* Macro, used on received payloads, to return the descriptor length */
0283 #define FC_TLV_DESC_SZ_FROM_LENGTH(tlv)     \
0284         (__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ)
0285 
0286 /*
0287  * This helper is used to walk descriptors in a descriptor list.
0288  * Given the address of the current descriptor, which minimally contains a
0289  * tag and len field, calculate the address of the next descriptor based
0290  * on the len field.
0291  */
0292 static inline void *fc_tlv_next_desc(void *desc)
0293 {
0294     struct fc_tlv_desc *tlv = desc;
0295 
0296     return (desc + FC_TLV_DESC_SZ_FROM_LENGTH(tlv));
0297 }
0298 
0299 
0300 /*
0301  * Link Service Request Information Descriptor
0302  */
0303 struct fc_els_lsri_desc {
0304     __be32      desc_tag;   /* descriptor tag (0x0000 0001) */
0305     __be32      desc_len;   /* Length of Descriptor (in bytes) (4).
0306                      * Size of descriptor excluding
0307                      * desc_tag and desc_len fields.
0308                      */
0309     struct {
0310         __u8    cmd;        /* ELS cmd byte */
0311         __u8    bytes[3];   /* bytes 1..3 */
0312     } rqst_w0;          /* Request word 0 */
0313 };
0314 
0315 
0316 /*
0317  * Common service parameters (N ports).
0318  */
0319 struct fc_els_csp {
0320     __u8        sp_hi_ver;  /* highest version supported (obs.) */
0321     __u8        sp_lo_ver;  /* highest version supported (obs.) */
0322     __be16      sp_bb_cred; /* buffer-to-buffer credits */
0323     __be16      sp_features;    /* common feature flags */
0324     __be16      sp_bb_data; /* b-b state number and data field sz */
0325     union {
0326         struct {
0327             __be16  _sp_tot_seq; /* total concurrent sequences */
0328             __be16  _sp_rel_off; /* rel. offset by info cat */
0329         } sp_plogi;
0330         struct {
0331             __be32  _sp_r_a_tov; /* resource alloc. timeout msec */
0332         } sp_flogi_acc;
0333     } sp_u;
0334     __be32      sp_e_d_tov; /* error detect timeout value */
0335 };
0336 #define sp_tot_seq  sp_u.sp_plogi._sp_tot_seq
0337 #define sp_rel_off  sp_u.sp_plogi._sp_rel_off
0338 #define sp_r_a_tov  sp_u.sp_flogi_acc._sp_r_a_tov
0339 
0340 #define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */
0341 
0342 /*
0343  * Minimum and maximum values for max data field size in service parameters.
0344  */
0345 #define FC_SP_MIN_MAX_PAYLOAD   FC_MIN_MAX_PAYLOAD
0346 #define FC_SP_MAX_MAX_PAYLOAD   FC_MAX_PAYLOAD
0347 
0348 /*
0349  * sp_features
0350  */
0351 #define FC_SP_FT_NPIV   0x8000  /* multiple N_Port_ID support (FLOGI) */
0352 #define FC_SP_FT_CIRO   0x8000  /* continuously increasing rel off (PLOGI) */
0353 #define FC_SP_FT_CLAD   0x8000  /* clean address (in FLOGI LS_ACC) */
0354 #define FC_SP_FT_RAND   0x4000  /* random relative offset */
0355 #define FC_SP_FT_VAL    0x2000  /* valid vendor version level */
0356 #define FC_SP_FT_NPIV_ACC   0x2000  /* NPIV assignment (FLOGI LS_ACC) */
0357 #define FC_SP_FT_FPORT  0x1000  /* F port (1) vs. N port (0) */
0358 #define FC_SP_FT_ABB    0x0800  /* alternate BB_credit management */
0359 #define FC_SP_FT_EDTR   0x0400  /* E_D_TOV Resolution is nanoseconds */
0360 #define FC_SP_FT_MCAST  0x0200  /* multicast */
0361 #define FC_SP_FT_BCAST  0x0100  /* broadcast */
0362 #define FC_SP_FT_HUNT   0x0080  /* hunt group */
0363 #define FC_SP_FT_SIMP   0x0040  /* dedicated simplex */
0364 #define FC_SP_FT_SEC    0x0020  /* reserved for security */
0365 #define FC_SP_FT_CSYN   0x0010  /* clock synch. supported */
0366 #define FC_SP_FT_RTTOV  0x0008  /* R_T_TOV value 100 uS, else 100 mS */
0367 #define FC_SP_FT_HALF   0x0004  /* dynamic half duplex */
0368 #define FC_SP_FT_SEQC   0x0002  /* SEQ_CNT */
0369 #define FC_SP_FT_PAYL   0x0001  /* FLOGI payload length 256, else 116 */
0370 
0371 /*
0372  * Class-specific service parameters.
0373  */
0374 struct fc_els_cssp {
0375     __be16      cp_class;   /* class flags */
0376     __be16      cp_init;    /* initiator flags */
0377     __be16      cp_recip;   /* recipient flags */
0378     __be16      cp_rdfs;    /* receive data field size */
0379     __be16      cp_con_seq; /* concurrent sequences */
0380     __be16      cp_ee_cred; /* N-port end-to-end credit */
0381     __u8        cp_resv1;   /* reserved */
0382     __u8        cp_open_seq;    /* open sequences per exchange */
0383     __u8        _cp_resv2[2];   /* reserved */
0384 };
0385 
0386 /*
0387  * cp_class flags.
0388  */
0389 #define FC_CPC_VALID    0x8000      /* class valid */
0390 #define FC_CPC_IMIX 0x4000      /* intermix mode */
0391 #define FC_CPC_SEQ  0x0800      /* sequential delivery */
0392 #define FC_CPC_CAMP 0x0200      /* camp-on */
0393 #define FC_CPC_PRI  0x0080      /* priority */
0394 
0395 /*
0396  * cp_init flags.
0397  * (TBD: not all flags defined here).
0398  */
0399 #define FC_CPI_CSYN 0x0010      /* clock synch. capable */
0400 
0401 /*
0402  * cp_recip flags.
0403  */
0404 #define FC_CPR_CSYN 0x0008      /* clock synch. capable */
0405 
0406 /*
0407  * NFC_ELS_FLOGI: Fabric login request.
0408  * NFC_ELS_PLOGI: Port login request (same format).
0409  */
0410 struct fc_els_flogi {
0411     __u8        fl_cmd;     /* command */
0412     __u8        _fl_resvd[3];   /* must be zero */
0413     struct fc_els_csp fl_csp;   /* common service parameters */
0414     __be64      fl_wwpn;    /* port name */
0415     __be64      fl_wwnn;    /* node name */
0416     struct fc_els_cssp fl_cssp[4];  /* class 1-4 service parameters */
0417     __u8        fl_vend[16];    /* vendor version level */
0418 } __attribute__((__packed__));
0419 
0420 /*
0421  * Process login service parameter page.
0422  */
0423 struct fc_els_spp {
0424     __u8        spp_type;   /* type code or common service params */
0425     __u8        spp_type_ext;   /* type code extension */
0426     __u8        spp_flags;
0427     __u8        _spp_resvd;
0428     __be32      spp_orig_pa;    /* originator process associator */
0429     __be32      spp_resp_pa;    /* responder process associator */
0430     __be32      spp_params; /* service parameters */
0431 };
0432 
0433 /*
0434  * spp_flags.
0435  */
0436 #define FC_SPP_OPA_VAL      0x80    /* originator proc. assoc. valid */
0437 #define FC_SPP_RPA_VAL      0x40    /* responder proc. assoc. valid */
0438 #define FC_SPP_EST_IMG_PAIR 0x20    /* establish image pair */
0439 #define FC_SPP_RESP_MASK    0x0f    /* mask for response code (below) */
0440 
0441 /*
0442  * SPP response code in spp_flags - lower 4 bits.
0443  */
0444 enum fc_els_spp_resp {
0445     FC_SPP_RESP_ACK =   1,  /* request executed */
0446     FC_SPP_RESP_RES =   2,  /* unable due to lack of resources */
0447     FC_SPP_RESP_INIT =  3,  /* initialization not complete */
0448     FC_SPP_RESP_NO_PA =     4,  /* unknown process associator */
0449     FC_SPP_RESP_CONF =  5,  /* configuration precludes image pair */
0450     FC_SPP_RESP_COND =  6,  /* request completed conditionally */
0451     FC_SPP_RESP_MULT =  7,  /* unable to handle multiple SPPs */
0452     FC_SPP_RESP_INVL =  8,  /* SPP is invalid */
0453 };
0454 
0455 /*
0456  * ELS_RRQ - Reinstate Recovery Qualifier
0457  */
0458 struct fc_els_rrq {
0459     __u8        rrq_cmd;    /* command (0x12) */
0460     __u8        rrq_zero[3];    /* specified as zero - part of cmd */
0461     __u8        rrq_resvd;  /* reserved */
0462     __u8        rrq_s_id[3];    /* originator FID */
0463     __be16      rrq_ox_id;  /* originator exchange ID */
0464     __be16      rrq_rx_id;  /* responders exchange ID */
0465 };
0466 
0467 /*
0468  * ELS_REC - Read exchange concise.
0469  */
0470 struct fc_els_rec {
0471     __u8        rec_cmd;    /* command (0x13) */
0472     __u8        rec_zero[3];    /* specified as zero - part of cmd */
0473     __u8        rec_resvd;  /* reserved */
0474     __u8        rec_s_id[3];    /* originator FID */
0475     __be16      rec_ox_id;  /* originator exchange ID */
0476     __be16      rec_rx_id;  /* responders exchange ID */
0477 };
0478 
0479 /*
0480  * ELS_REC LS_ACC payload.
0481  */
0482 struct fc_els_rec_acc {
0483     __u8        reca_cmd;   /* accept (0x02) */
0484     __u8        reca_zero[3];   /* specified as zero - part of cmd */
0485     __be16      reca_ox_id; /* originator exchange ID */
0486     __be16      reca_rx_id; /* responders exchange ID */
0487     __u8        reca_resvd1;    /* reserved */
0488     __u8        reca_ofid[3];   /* originator FID */
0489     __u8        reca_resvd2;    /* reserved */
0490     __u8        reca_rfid[3];   /* responder FID */
0491     __be32      reca_fc4value;  /* FC4 value */
0492     __be32      reca_e_stat;    /* ESB (exchange status block) status */
0493 };
0494 
0495 /*
0496  * ELS_PRLI - Process login request and response.
0497  */
0498 struct fc_els_prli {
0499     __u8        prli_cmd;   /* command */
0500     __u8        prli_spp_len;   /* length of each serv. parm. page */
0501     __be16      prli_len;   /* length of entire payload */
0502     /* service parameter pages follow */
0503 };
0504 
0505 /*
0506  * ELS_PRLO - Process logout request and response.
0507  */
0508 struct fc_els_prlo {
0509     __u8            prlo_cmd;       /* command */
0510     __u8            prlo_obs;       /* obsolete, but shall be set to 10h */
0511     __be16          prlo_len;       /* payload length */
0512 };
0513 
0514 /*
0515  * ELS_ADISC payload
0516  */
0517 struct fc_els_adisc {
0518     __u8        adisc_cmd;
0519     __u8        adisc_resv[3];
0520     __u8            adisc_resv1;
0521     __u8            adisc_hard_addr[3];
0522     __be64          adisc_wwpn;
0523     __be64          adisc_wwnn;
0524     __u8            adisc_resv2;
0525     __u8            adisc_port_id[3];
0526 } __attribute__((__packed__));
0527 
0528 /*
0529  * ELS_LOGO - process or fabric logout.
0530  */
0531 struct fc_els_logo {
0532     __u8        fl_cmd;     /* command code */
0533     __u8        fl_zero[3]; /* specified as zero - part of cmd */
0534     __u8        fl_resvd;   /* reserved */
0535     __u8        fl_n_port_id[3];/* N port ID */
0536     __be64      fl_n_port_wwn;  /* port name */
0537 };
0538 
0539 /*
0540  * ELS_RTV - read timeout value.
0541  */
0542 struct fc_els_rtv {
0543     __u8        rtv_cmd;    /* command code 0x0e */
0544     __u8        rtv_zero[3];    /* specified as zero - part of cmd */
0545 };
0546 
0547 /*
0548  * LS_ACC for ELS_RTV - read timeout value.
0549  */
0550 struct fc_els_rtv_acc {
0551     __u8        rtv_cmd;    /* command code 0x02 */
0552     __u8        rtv_zero[3];    /* specified as zero - part of cmd */
0553     __be32      rtv_r_a_tov;    /* resource allocation timeout value */
0554     __be32      rtv_e_d_tov;    /* error detection timeout value */
0555     __be32      rtv_toq;    /* timeout qualifier (see below) */
0556 };
0557 
0558 /*
0559  * rtv_toq bits.
0560  */
0561 #define FC_ELS_RTV_EDRES (1 << 26)  /* E_D_TOV resolution is nS else mS */
0562 #define FC_ELS_RTV_RTTOV (1 << 19)  /* R_T_TOV is 100 uS else 100 mS */
0563 
0564 /*
0565  * ELS_SCR - state change registration payload.
0566  */
0567 struct fc_els_scr {
0568     __u8        scr_cmd;    /* command code */
0569     __u8        scr_resv[6];    /* reserved */
0570     __u8        scr_reg_func;   /* registration function (see below) */
0571 };
0572 
0573 enum fc_els_scr_func {
0574     ELS_SCRF_FAB =  1,  /* fabric-detected registration */
0575     ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */
0576     ELS_SCRF_FULL = 3,  /* full registration */
0577     ELS_SCRF_CLEAR = 255,   /* remove any current registrations */
0578 };
0579 
0580 /*
0581  * ELS_RSCN - registered state change notification payload.
0582  */
0583 struct fc_els_rscn {
0584     __u8        rscn_cmd;   /* RSCN opcode (0x61) */
0585     __u8        rscn_page_len;  /* page length (4) */
0586     __be16      rscn_plen;  /* payload length including this word */
0587 
0588     /* followed by 4-byte generic affected Port_ID pages */
0589 };
0590 
0591 struct fc_els_rscn_page {
0592     __u8        rscn_page_flags; /* event and address format */
0593     __u8        rscn_fid[3];    /* fabric ID */
0594 };
0595 
0596 #define ELS_RSCN_EV_QUAL_BIT    2   /* shift count for event qualifier */
0597 #define ELS_RSCN_EV_QUAL_MASK   0xf /* mask for event qualifier */
0598 #define ELS_RSCN_ADDR_FMT_BIT   0   /* shift count for address format */
0599 #define ELS_RSCN_ADDR_FMT_MASK  0x3 /* mask for address format */
0600 
0601 enum fc_els_rscn_ev_qual {
0602     ELS_EV_QUAL_NONE = 0,       /* unspecified */
0603     ELS_EV_QUAL_NS_OBJ = 1,     /* changed name server object */
0604     ELS_EV_QUAL_PORT_ATTR = 2,  /* changed port attribute */
0605     ELS_EV_QUAL_SERV_OBJ = 3,   /* changed service object */
0606     ELS_EV_QUAL_SW_CONFIG = 4,  /* changed switch configuration */
0607     ELS_EV_QUAL_REM_OBJ = 5,    /* removed object */
0608 };
0609 
0610 enum fc_els_rscn_addr_fmt {
0611     ELS_ADDR_FMT_PORT = 0,  /* rscn_fid is a port address */
0612     ELS_ADDR_FMT_AREA = 1,  /* rscn_fid is a area address */
0613     ELS_ADDR_FMT_DOM = 2,   /* rscn_fid is a domain address */
0614     ELS_ADDR_FMT_FAB = 3,   /* anything on fabric may have changed */
0615 };
0616 
0617 /*
0618  * ELS_RNID - request Node ID.
0619  */
0620 struct fc_els_rnid {
0621     __u8        rnid_cmd;   /* RNID opcode (0x78) */
0622     __u8        rnid_resv[3];   /* reserved */
0623     __u8        rnid_fmt;   /* data format */
0624     __u8        rnid_resv2[3];  /* reserved */
0625 };
0626 
0627 /*
0628  * Node Identification Data formats (rnid_fmt)
0629  */
0630 enum fc_els_rnid_fmt {
0631     ELS_RNIDF_NONE = 0,     /* no specific identification data */
0632     ELS_RNIDF_GEN = 0xdf,       /* general topology discovery format */
0633 };
0634 
0635 /*
0636  * ELS_RNID response.
0637  */
0638 struct fc_els_rnid_resp {
0639     __u8        rnid_cmd;   /* response code (LS_ACC) */
0640     __u8        rnid_resv[3];   /* reserved */
0641     __u8        rnid_fmt;   /* data format */
0642     __u8        rnid_cid_len;   /* common ID data length */
0643     __u8        rnid_resv2; /* reserved */
0644     __u8        rnid_sid_len;   /* specific ID data length */
0645 };
0646 
0647 struct fc_els_rnid_cid {
0648     __be64      rnid_wwpn;  /* N port name */
0649     __be64      rnid_wwnn;  /* node name */
0650 };
0651 
0652 struct fc_els_rnid_gen {
0653     __u8        rnid_vend_id[16]; /* vendor-unique ID */
0654     __be32      rnid_atype; /* associated type (see below) */
0655     __be32      rnid_phys_port; /* physical port number */
0656     __be32      rnid_att_nodes; /* number of attached nodes */
0657     __u8        rnid_node_mgmt; /* node management (see below) */
0658     __u8        rnid_ip_ver;    /* IP version (see below) */
0659     __be16      rnid_prot_port; /* UDP / TCP port number */
0660     __be32      rnid_ip_addr[4]; /* IP address */
0661     __u8        rnid_resvd[2];  /* reserved */
0662     __be16      rnid_vend_spec; /* vendor-specific field */
0663 };
0664 
0665 enum fc_els_rnid_atype {
0666     ELS_RNIDA_UNK =     0x01,   /* unknown */
0667     ELS_RNIDA_OTHER =   0x02,   /* none of the following */
0668     ELS_RNIDA_HUB =     0x03,
0669     ELS_RNIDA_SWITCH =  0x04,
0670     ELS_RNIDA_GATEWAY = 0x05,
0671     ELS_RNIDA_CONV =    0x06,   /* Obsolete, do not use this value */
0672     ELS_RNIDA_HBA =         0x07,   /* Obsolete, do not use this value */
0673     ELS_RNIDA_PROXY =       0x08,   /* Obsolete, do not use this value */
0674     ELS_RNIDA_STORAGE = 0x09,
0675     ELS_RNIDA_HOST =    0x0a,
0676     ELS_RNIDA_SUBSYS =  0x0b,   /* storage subsystem (e.g., RAID) */
0677     ELS_RNIDA_ACCESS =  0x0e,   /* access device (e.g. media changer) */
0678     ELS_RNIDA_NAS =     0x11,   /* NAS server */
0679     ELS_RNIDA_BRIDGE =  0x12,   /* bridge */
0680     ELS_RNIDA_VIRT =    0x13,   /* virtualization device */
0681     ELS_RNIDA_MF =      0xff,   /* multifunction device (bits below) */
0682     ELS_RNIDA_MF_HUB =  1UL << 31,  /* hub */
0683     ELS_RNIDA_MF_SW =   1UL << 30,  /* switch */
0684     ELS_RNIDA_MF_GW =   1UL << 29,  /* gateway */
0685     ELS_RNIDA_MF_ST =   1UL << 28,  /* storage */
0686     ELS_RNIDA_MF_HOST = 1UL << 27,  /* host */
0687     ELS_RNIDA_MF_SUB =  1UL << 26,  /* storage subsystem */
0688     ELS_RNIDA_MF_ACC =  1UL << 25,  /* storage access dev */
0689     ELS_RNIDA_MF_WDM =  1UL << 24,  /* wavelength division mux */
0690     ELS_RNIDA_MF_NAS =  1UL << 23,  /* NAS server */
0691     ELS_RNIDA_MF_BR =   1UL << 22,  /* bridge */
0692     ELS_RNIDA_MF_VIRT = 1UL << 21,  /* virtualization device */
0693 };
0694 
0695 enum fc_els_rnid_mgmt {
0696     ELS_RNIDM_SNMP =    0,
0697     ELS_RNIDM_TELNET =  1,
0698     ELS_RNIDM_HTTP =    2,
0699     ELS_RNIDM_HTTPS =   3,
0700     ELS_RNIDM_XML =     4,  /* HTTP + XML */
0701 };
0702 
0703 enum fc_els_rnid_ipver {
0704     ELS_RNIDIP_NONE =   0,  /* no IP support or node mgmt. */
0705     ELS_RNIDIP_V4 =     1,  /* IPv4 */
0706     ELS_RNIDIP_V6 =     2,  /* IPv6 */
0707 };
0708 
0709 /*
0710  * ELS RPL - Read Port List.
0711  */
0712 struct fc_els_rpl {
0713     __u8        rpl_cmd;    /* command */
0714     __u8        rpl_resv[5];    /* reserved - must be zero */
0715     __be16      rpl_max_size;   /* maximum response size or zero */
0716     __u8        rpl_resv1;  /* reserved - must be zero */
0717     __u8        rpl_index[3];   /* starting index */
0718 };
0719 
0720 /*
0721  * Port number block in RPL response.
0722  */
0723 struct fc_els_pnb {
0724     __be32      pnb_phys_pn;    /* physical port number */
0725     __u8        pnb_resv;   /* reserved */
0726     __u8        pnb_port_id[3]; /* port ID */
0727     __be64      pnb_wwpn;   /* port name */
0728 };
0729 
0730 /*
0731  * RPL LS_ACC response.
0732  */
0733 struct fc_els_rpl_resp {
0734     __u8        rpl_cmd;    /* ELS_LS_ACC */
0735     __u8        rpl_resv1;  /* reserved - must be zero */
0736     __be16      rpl_plen;   /* payload length */
0737     __u8        rpl_resv2;  /* reserved - must be zero */
0738     __u8        rpl_llen[3];    /* list length */
0739     __u8        rpl_resv3;  /* reserved - must be zero */
0740     __u8        rpl_index[3];   /* starting index */
0741     struct fc_els_pnb rpl_pnb[1];   /* variable number of PNBs */
0742 };
0743 
0744 /*
0745  * Link Error Status Block.
0746  */
0747 struct fc_els_lesb {
0748     __be32      lesb_link_fail; /* link failure count */
0749     __be32      lesb_sync_loss; /* loss of synchronization count */
0750     __be32      lesb_sig_loss;  /* loss of signal count */
0751     __be32      lesb_prim_err;  /* primitive sequence error count */
0752     __be32      lesb_inv_word;  /* invalid transmission word count */
0753     __be32      lesb_inv_crc;   /* invalid CRC count */
0754 };
0755 
0756 /*
0757  * ELS RPS - Read Port Status Block request.
0758  */
0759 struct fc_els_rps {
0760     __u8        rps_cmd;    /* command */
0761     __u8        rps_resv[2];    /* reserved - must be zero */
0762     __u8        rps_flag;   /* flag - see below */
0763     __be64      rps_port_spec;  /* port selection */
0764 };
0765 
0766 enum fc_els_rps_flag {
0767     FC_ELS_RPS_DID =    0x00,   /* port identified by D_ID of req. */
0768     FC_ELS_RPS_PPN =    0x01,   /* port_spec is physical port number */
0769     FC_ELS_RPS_WWPN =   0x02,   /* port_spec is port WWN */
0770 };
0771 
0772 /*
0773  * ELS RPS LS_ACC response.
0774  */
0775 struct fc_els_rps_resp {
0776     __u8        rps_cmd;    /* command - LS_ACC */
0777     __u8        rps_resv[2];    /* reserved - must be zero */
0778     __u8        rps_flag;   /* flag - see below */
0779     __u8        rps_resv2[2];   /* reserved */
0780     __be16      rps_status; /* port status - see below */
0781     struct fc_els_lesb rps_lesb;    /* link error status block */
0782 };
0783 
0784 enum fc_els_rps_resp_flag {
0785     FC_ELS_RPS_LPEV =   0x01,   /* L_port extension valid */
0786 };
0787 
0788 enum fc_els_rps_resp_status {
0789     FC_ELS_RPS_PTP =    1 << 5, /* point-to-point connection */
0790     FC_ELS_RPS_LOOP =   1 << 4, /* loop mode */
0791     FC_ELS_RPS_FAB =    1 << 3, /* fabric present */
0792     FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */
0793     FC_ELS_RPS_NO_SYNC =    1 << 1, /* loss of synchronization */
0794     FC_ELS_RPS_RESET =  1 << 0, /* in link reset protocol */
0795 };
0796 
0797 /*
0798  * ELS LIRR - Link Incident Record Registration request.
0799  */
0800 struct fc_els_lirr {
0801     __u8        lirr_cmd;   /* command */
0802     __u8        lirr_resv[3];   /* reserved - must be zero */
0803     __u8        lirr_func;  /* registration function */
0804     __u8        lirr_fmt;   /* FC-4 type of RLIR requested */
0805     __u8        lirr_resv2[2];  /* reserved - must be zero */
0806 };
0807 
0808 enum fc_els_lirr_func {
0809     ELS_LIRR_SET_COND =     0x01,   /* set - conditionally receive */
0810     ELS_LIRR_SET_UNCOND =   0x02,   /* set - unconditionally receive */
0811     ELS_LIRR_CLEAR =    0xff    /* clear registration */
0812 };
0813 
0814 /*
0815  * ELS SRL - Scan Remote Loop request.
0816  */
0817 struct fc_els_srl {
0818     __u8        srl_cmd;    /* command */
0819     __u8        srl_resv[3];    /* reserved - must be zero */
0820     __u8        srl_flag;   /* flag - see below */
0821     __u8        srl_flag_param[3];  /* flag parameter */
0822 };
0823 
0824 enum fc_els_srl_flag {
0825     FC_ELS_SRL_ALL =    0x00,   /* scan all FL ports */
0826     FC_ELS_SRL_ONE =    0x01,   /* scan specified loop */
0827     FC_ELS_SRL_EN_PER = 0x02,   /* enable periodic scanning (param) */
0828     FC_ELS_SRL_DIS_PER =    0x03,   /* disable periodic scanning */
0829 };
0830 
0831 /*
0832  * ELS RLS - Read Link Error Status Block request.
0833  */
0834 struct fc_els_rls {
0835     __u8        rls_cmd;    /* command */
0836     __u8        rls_resv[4];    /* reserved - must be zero */
0837     __u8        rls_port_id[3]; /* port ID */
0838 };
0839 
0840 /*
0841  * ELS RLS LS_ACC Response.
0842  */
0843 struct fc_els_rls_resp {
0844     __u8        rls_cmd;    /* ELS_LS_ACC */
0845     __u8        rls_resv[3];    /* reserved - must be zero */
0846     struct fc_els_lesb rls_lesb;    /* link error status block */
0847 };
0848 
0849 /*
0850  * ELS RLIR - Registered Link Incident Report.
0851  * This is followed by the CLIR and the CLID, described below.
0852  */
0853 struct fc_els_rlir {
0854     __u8        rlir_cmd;   /* command */
0855     __u8        rlir_resv[3];   /* reserved - must be zero */
0856     __u8        rlir_fmt;   /* format (FC4-type if type specific) */
0857     __u8        rlir_clr_len;   /* common link incident record length */
0858     __u8        rlir_cld_len;   /* common link incident desc. length */
0859     __u8        rlir_slr_len;   /* spec. link incident record length */
0860 };
0861 
0862 /*
0863  * CLIR - Common Link Incident Record Data. - Sent via RLIR.
0864  */
0865 struct fc_els_clir {
0866     __be64      clir_wwpn;  /* incident port name */
0867     __be64      clir_wwnn;  /* incident port node name */
0868     __u8        clir_port_type; /* incident port type */
0869     __u8        clir_port_id[3];    /* incident port ID */
0870 
0871     __be64      clir_conn_wwpn; /* connected port name */
0872     __be64      clir_conn_wwnn; /* connected node name */
0873     __be64      clir_fab_name;  /* fabric name */
0874     __be32      clir_phys_port; /* physical port number */
0875     __be32      clir_trans_id;  /* transaction ID */
0876     __u8        clir_resv[3];   /* reserved */
0877     __u8        clir_ts_fmt;    /* time stamp format */
0878     __be64      clir_timestamp; /* time stamp */
0879 };
0880 
0881 /*
0882  * CLIR clir_ts_fmt - time stamp format values.
0883  */
0884 enum fc_els_clir_ts_fmt {
0885     ELS_CLIR_TS_UNKNOWN =   0,  /* time stamp field unknown */
0886     ELS_CLIR_TS_SEC_FRAC =  1,  /* time in seconds and fractions */
0887     ELS_CLIR_TS_CSU =   2,  /* time in clock synch update format */
0888 };
0889 
0890 /*
0891  * Common Link Incident Descriptor - sent via RLIR.
0892  */
0893 struct fc_els_clid {
0894     __u8        clid_iq;    /* incident qualifier flags */
0895     __u8        clid_ic;    /* incident code */
0896     __be16      clid_epai;  /* domain/area of ISL */
0897 };
0898 
0899 /*
0900  * CLID incident qualifier flags.
0901  */
0902 enum fc_els_clid_iq {
0903     ELS_CLID_SWITCH =   0x20,   /* incident port is a switch node */
0904     ELS_CLID_E_PORT =   0x10,   /* incident is an ISL (E) port */
0905     ELS_CLID_SEV_MASK = 0x0c,   /* severity 2-bit field mask */
0906     ELS_CLID_SEV_INFO = 0x00,   /* report is informational */
0907     ELS_CLID_SEV_INOP = 0x08,   /* link not operational */
0908     ELS_CLID_SEV_DEG =  0x04,   /* link degraded but operational */
0909     ELS_CLID_LASER =    0x02,   /* subassembly is a laser */
0910     ELS_CLID_FRU =      0x01,   /* format can identify a FRU */
0911 };
0912 
0913 /*
0914  * CLID incident code.
0915  */
0916 enum fc_els_clid_ic {
0917     ELS_CLID_IC_IMPL =  1,  /* implicit incident */
0918     ELS_CLID_IC_BER =   2,  /* bit-error-rate threshold exceeded */
0919     ELS_CLID_IC_LOS =   3,  /* loss of synch or signal */
0920     ELS_CLID_IC_NOS =   4,  /* non-operational primitive sequence */
0921     ELS_CLID_IC_PST =   5,  /* primitive sequence timeout */
0922     ELS_CLID_IC_INVAL = 6,  /* invalid primitive sequence */
0923     ELS_CLID_IC_LOOP_TO =   7,  /* loop initialization time out */
0924     ELS_CLID_IC_LIP =   8,  /* receiving LIP */
0925 };
0926 
0927 /*
0928  * Link Integrity event types
0929  */
0930 enum fc_fpin_li_event_types {
0931     FPIN_LI_UNKNOWN =       0x0,
0932     FPIN_LI_LINK_FAILURE =      0x1,
0933     FPIN_LI_LOSS_OF_SYNC =      0x2,
0934     FPIN_LI_LOSS_OF_SIG =       0x3,
0935     FPIN_LI_PRIM_SEQ_ERR =      0x4,
0936     FPIN_LI_INVALID_TX_WD =     0x5,
0937     FPIN_LI_INVALID_CRC =       0x6,
0938     FPIN_LI_DEVICE_SPEC =       0xF,
0939 };
0940 
0941 /*
0942  * Initializer useful for decoding table.
0943  * Please keep this in sync with the above definitions.
0944  */
0945 #define FC_FPIN_LI_EVT_TYPES_INIT {                 \
0946     { FPIN_LI_UNKNOWN,      "Unknown" },            \
0947     { FPIN_LI_LINK_FAILURE,     "Link Failure" },       \
0948     { FPIN_LI_LOSS_OF_SYNC,     "Loss of Synchronization" },    \
0949     { FPIN_LI_LOSS_OF_SIG,      "Loss of Signal" },     \
0950     { FPIN_LI_PRIM_SEQ_ERR,     "Primitive Sequence Protocol Error" }, \
0951     { FPIN_LI_INVALID_TX_WD,    "Invalid Transmission Word" },  \
0952     { FPIN_LI_INVALID_CRC,      "Invalid CRC" },        \
0953     { FPIN_LI_DEVICE_SPEC,      "Device Specific" },        \
0954 }
0955 
0956 /*
0957  * Delivery event types
0958  */
0959 enum fc_fpin_deli_event_types {
0960     FPIN_DELI_UNKNOWN =     0x0,
0961     FPIN_DELI_TIMEOUT =     0x1,
0962     FPIN_DELI_UNABLE_TO_ROUTE = 0x2,
0963     FPIN_DELI_DEVICE_SPEC =     0xF,
0964 };
0965 
0966 /*
0967  * Initializer useful for decoding table.
0968  * Please keep this in sync with the above definitions.
0969  */
0970 #define FC_FPIN_DELI_EVT_TYPES_INIT {                   \
0971     { FPIN_DELI_UNKNOWN,        "Unknown" },            \
0972     { FPIN_DELI_TIMEOUT,        "Timeout" },            \
0973     { FPIN_DELI_UNABLE_TO_ROUTE,    "Unable to Route" },        \
0974     { FPIN_DELI_DEVICE_SPEC,    "Device Specific" },        \
0975 }
0976 
0977 /*
0978  * Congestion event types
0979  */
0980 enum fc_fpin_congn_event_types {
0981     FPIN_CONGN_CLEAR =      0x0,
0982     FPIN_CONGN_LOST_CREDIT =    0x1,
0983     FPIN_CONGN_CREDIT_STALL =   0x2,
0984     FPIN_CONGN_OVERSUBSCRIPTION =   0x3,
0985     FPIN_CONGN_DEVICE_SPEC =    0xF,
0986 };
0987 
0988 /*
0989  * Initializer useful for decoding table.
0990  * Please keep this in sync with the above definitions.
0991  */
0992 #define FC_FPIN_CONGN_EVT_TYPES_INIT {                  \
0993     { FPIN_CONGN_CLEAR,     "Clear" },          \
0994     { FPIN_CONGN_LOST_CREDIT,   "Lost Credit" },        \
0995     { FPIN_CONGN_CREDIT_STALL,  "Credit Stall" },       \
0996     { FPIN_CONGN_OVERSUBSCRIPTION,  "Oversubscription" },       \
0997     { FPIN_CONGN_DEVICE_SPEC,   "Device Specific" },        \
0998 }
0999 
1000 enum fc_fpin_congn_severity_types {
1001     FPIN_CONGN_SEVERITY_WARNING =   0xF1,
1002     FPIN_CONGN_SEVERITY_ERROR = 0xF7,
1003 };
1004 
1005 /*
1006  * Link Integrity Notification Descriptor
1007  */
1008 struct fc_fn_li_desc {
1009     __be32      desc_tag;   /* Descriptor Tag (0x00020001) */
1010     __be32      desc_len;   /* Length of Descriptor (in bytes).
1011                      * Size of descriptor excluding
1012                      * desc_tag and desc_len fields.
1013                      */
1014     __be64      detecting_wwpn; /* Port Name that detected event */
1015     __be64      attached_wwpn;  /* Port Name of device attached to
1016                      * detecting Port Name
1017                      */
1018     __be16      event_type; /* see enum fc_fpin_li_event_types */
1019     __be16      event_modifier; /* Implementation specific value
1020                      * describing the event type
1021                      */
1022     __be32      event_threshold;/* duration in ms of the link
1023                      * integrity detection cycle
1024                      */
1025     __be32      event_count;    /* minimum number of event
1026                      * occurrences during the event
1027                      * threshold to caause the LI event
1028                      */
1029     __be32      pname_count;    /* number of portname_list elements */
1030     __be64      pname_list[];   /* list of N_Port_Names accessible
1031                      * through the attached port
1032                      */
1033 };
1034 
1035 /*
1036  * Delivery Notification Descriptor
1037  */
1038 struct fc_fn_deli_desc {
1039     __be32      desc_tag;   /* Descriptor Tag (0x00020002) */
1040     __be32      desc_len;   /* Length of Descriptor (in bytes).
1041                      * Size of descriptor excluding
1042                      * desc_tag and desc_len fields.
1043                      */
1044     __be64      detecting_wwpn; /* Port Name that detected event */
1045     __be64      attached_wwpn;  /* Port Name of device attached to
1046                      * detecting Port Name
1047                      */
1048     __be32      deli_reason_code;/* see enum fc_fpin_deli_event_types */
1049 };
1050 
1051 /*
1052  * Peer Congestion Notification Descriptor
1053  */
1054 struct fc_fn_peer_congn_desc {
1055     __be32      desc_tag;   /* Descriptor Tag (0x00020003) */
1056     __be32      desc_len;   /* Length of Descriptor (in bytes).
1057                      * Size of descriptor excluding
1058                      * desc_tag and desc_len fields.
1059                      */
1060     __be64      detecting_wwpn; /* Port Name that detected event */
1061     __be64      attached_wwpn;  /* Port Name of device attached to
1062                      * detecting Port Name
1063                      */
1064     __be16      event_type; /* see enum fc_fpin_congn_event_types */
1065     __be16      event_modifier; /* Implementation specific value
1066                      * describing the event type
1067                      */
1068     __be32      event_period;   /* duration (ms) of the detected
1069                      * congestion event
1070                      */
1071     __be32      pname_count;    /* number of portname_list elements */
1072     __be64      pname_list[];   /* list of N_Port_Names accessible
1073                      * through the attached port
1074                      */
1075 };
1076 
1077 /*
1078  * Congestion Notification Descriptor
1079  */
1080 struct fc_fn_congn_desc {
1081     __be32      desc_tag;   /* Descriptor Tag (0x00020004) */
1082     __be32      desc_len;   /* Length of Descriptor (in bytes).
1083                      * Size of descriptor excluding
1084                      * desc_tag and desc_len fields.
1085                      */
1086     __be16      event_type; /* see enum fc_fpin_congn_event_types */
1087     __be16      event_modifier; /* Implementation specific value
1088                      * describing the event type
1089                      */
1090     __be32      event_period;   /* duration (ms) of the detected
1091                      * congestion event
1092                      */
1093     __u8        severity;   /* command */
1094     __u8        resv[3];    /* reserved - must be zero */
1095 };
1096 
1097 /*
1098  * ELS_FPIN - Fabric Performance Impact Notification
1099  */
1100 struct fc_els_fpin {
1101     __u8        fpin_cmd;   /* command (0x16) */
1102     __u8        fpin_zero[3];   /* specified as zero - part of cmd */
1103     __be32      desc_len;   /* Length of Descriptor List (in bytes).
1104                      * Size of ELS excluding fpin_cmd,
1105                      * fpin_zero and desc_len fields.
1106                      */
1107     struct fc_tlv_desc  fpin_desc[];    /* Descriptor list */
1108 };
1109 
1110 /* Diagnostic Function Descriptor - FPIN Registration */
1111 struct fc_df_desc_fpin_reg {
1112     __be32      desc_tag;   /* FPIN Registration (0x00030001) */
1113     __be32      desc_len;   /* Length of Descriptor (in bytes).
1114                      * Size of descriptor excluding
1115                      * desc_tag and desc_len fields.
1116                      */
1117     __be32      count;      /* Number of desc_tags elements */
1118     __be32      desc_tags[];    /* Array of Descriptor Tags.
1119                      * Each tag indicates a function
1120                      * supported by the N_Port (request)
1121                      * or by the  N_Port and Fabric
1122                      * Controller (reply; may be a subset
1123                      * of the request).
1124                      * See ELS_FN_DTAG_xxx for tag values.
1125                      */
1126 };
1127 
1128 /*
1129  * ELS_RDF - Register Diagnostic Functions
1130  */
1131 struct fc_els_rdf {
1132     __u8        fpin_cmd;   /* command (0x19) */
1133     __u8        fpin_zero[3];   /* specified as zero - part of cmd */
1134     __be32      desc_len;   /* Length of Descriptor List (in bytes).
1135                      * Size of ELS excluding fpin_cmd,
1136                      * fpin_zero and desc_len fields.
1137                      */
1138     struct fc_tlv_desc  desc[]; /* Descriptor list */
1139 };
1140 
1141 /*
1142  * ELS RDF LS_ACC Response.
1143  */
1144 struct fc_els_rdf_resp {
1145     struct fc_els_ls_acc    acc_hdr;
1146     __be32          desc_list_len;  /* Length of response (in
1147                          * bytes). Excludes acc_hdr
1148                          * and desc_list_len fields.
1149                          */
1150     struct fc_els_lsri_desc lsri;
1151     struct fc_tlv_desc  desc[]; /* Supported Descriptor list */
1152 };
1153 
1154 
1155 /*
1156  * Diagnostic Capability Descriptors for EDC ELS
1157  */
1158 
1159 /*
1160  * Diagnostic: Link Fault Capability Descriptor
1161  */
1162 struct fc_diag_lnkflt_desc {
1163     __be32      desc_tag;   /* Descriptor Tag (0x0001000D) */
1164     __be32      desc_len;   /* Length of Descriptor (in bytes).
1165                      * Size of descriptor excluding
1166                      * desc_tag and desc_len fields.
1167                      * 12 bytes
1168                      */
1169     __be32      degrade_activate_threshold;
1170     __be32      degrade_deactivate_threshold;
1171     __be32      fec_degrade_interval;
1172 };
1173 
1174 enum fc_edc_cg_signal_cap_types {
1175     /* Note: Capability: bits 31:4 Rsvd; bits 3:0 are capabilities */
1176     EDC_CG_SIG_NOTSUPPORTED =   0x00, /* neither supported */
1177     EDC_CG_SIG_WARN_ONLY =      0x01,
1178     EDC_CG_SIG_WARN_ALARM =     0x02, /* both supported */
1179 };
1180 
1181 /*
1182  * Initializer useful for decoding table.
1183  * Please keep this in sync with the above definitions.
1184  */
1185 #define FC_EDC_CG_SIGNAL_CAP_TYPES_INIT {               \
1186     { EDC_CG_SIG_NOTSUPPORTED,  "Signaling Not Supported" },    \
1187     { EDC_CG_SIG_WARN_ONLY,     "Warning Signal" },     \
1188     { EDC_CG_SIG_WARN_ALARM,    "Warning and Alarm Signals" },  \
1189 }
1190 
1191 enum fc_diag_cg_sig_freq_types {
1192     EDC_CG_SIGFREQ_CNT_MIN =    1,  /* Min Frequency Count */
1193     EDC_CG_SIGFREQ_CNT_MAX =    999,    /* Max Frequency Count */
1194 
1195     EDC_CG_SIGFREQ_SEC =        0x1,    /* Units: seconds */
1196     EDC_CG_SIGFREQ_MSEC =       0x2,    /* Units: milliseconds */
1197 };
1198 
1199 struct fc_diag_cg_sig_freq {
1200     __be16      count;      /* Time between signals
1201                      * note: upper 6 bits rsvd
1202                      */
1203     __be16      units;      /* Time unit for count
1204                      * note: upper 12 bits rsvd
1205                      */
1206 };
1207 
1208 /*
1209  * Diagnostic: Congestion Signaling Capability Descriptor
1210  */
1211 struct fc_diag_cg_sig_desc {
1212     __be32      desc_tag;   /* Descriptor Tag (0x0001000F) */
1213     __be32      desc_len;   /* Length of Descriptor (in bytes).
1214                      * Size of descriptor excluding
1215                      * desc_tag and desc_len fields.
1216                      * 16 bytes
1217                      */
1218     __be32              xmt_signal_capability;
1219     struct fc_diag_cg_sig_freq  xmt_signal_frequency;
1220     __be32              rcv_signal_capability;
1221     struct fc_diag_cg_sig_freq  rcv_signal_frequency;
1222 };
1223 
1224 /*
1225  * ELS_EDC - Exchange Diagnostic Capabilities
1226  */
1227 struct fc_els_edc {
1228     __u8        edc_cmd;    /* command (0x17) */
1229     __u8        edc_zero[3];    /* specified as zero - part of cmd */
1230     __be32      desc_len;   /* Length of Descriptor List (in bytes).
1231                      * Size of ELS excluding edc_cmd,
1232                      * edc_zero and desc_len fields.
1233                      */
1234     struct fc_tlv_desc  desc[];
1235                     /* Diagnostic Descriptor list */
1236 };
1237 
1238 /*
1239  * ELS EDC LS_ACC Response.
1240  */
1241 struct fc_els_edc_resp {
1242     struct fc_els_ls_acc    acc_hdr;
1243     __be32          desc_list_len;  /* Length of response (in
1244                          * bytes). Excludes acc_hdr
1245                          * and desc_list_len fields.
1246                          */
1247     struct fc_els_lsri_desc lsri;
1248     struct fc_tlv_desc  desc[];
1249                     /* Supported Diagnostic Descriptor list */
1250 };
1251 
1252 
1253 #endif /* _FC_ELS_H_ */