linux/include/uapi/scsi/fc/fc_els.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
   2/*
   3 * Copyright(c) 2007 Intel Corporation. All rights reserved.
   4 *
   5 * This program is free software; you can redistribute it and/or modify it
   6 * under the terms and conditions of the GNU General Public License,
   7 * version 2, as published by the Free Software Foundation.
   8 *
   9 * This program is distributed in the hope it will be useful, but WITHOUT
  10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  12 * more details.
  13 *
  14 * You should have received a copy of the GNU General Public License along with
  15 * this program; if not, write to the Free Software Foundation, Inc.,
  16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  17 *
  18 * Maintained at www.Open-FCoE.org
  19 */
  20
  21#ifndef _FC_ELS_H_
  22#define _FC_ELS_H_
  23
  24#include <linux/types.h>
  25#include <asm/byteorder.h>
  26
  27/*
  28 * Fibre Channel Switch - Enhanced Link Services definitions.
  29 * From T11 FC-LS Rev 1.2 June 7, 2005.
  30 */
  31
  32/*
  33 * ELS Command codes - byte 0 of the frame payload
  34 */
  35enum fc_els_cmd {
  36        ELS_LS_RJT =    0x01,   /* ESL reject */
  37        ELS_LS_ACC =    0x02,   /* ESL Accept */
  38        ELS_PLOGI =     0x03,   /* N_Port login */
  39        ELS_FLOGI =     0x04,   /* F_Port login */
  40        ELS_LOGO =      0x05,   /* Logout */
  41        ELS_ABTX =      0x06,   /* Abort exchange - obsolete */
  42        ELS_RCS =       0x07,   /* read connection status */
  43        ELS_RES =       0x08,   /* read exchange status block */
  44        ELS_RSS =       0x09,   /* read sequence status block */
  45        ELS_RSI =       0x0a,   /* read sequence initiative */
  46        ELS_ESTS =      0x0b,   /* establish streaming */
  47        ELS_ESTC =      0x0c,   /* estimate credit */
  48        ELS_ADVC =      0x0d,   /* advise credit */
  49        ELS_RTV =       0x0e,   /* read timeout value */
  50        ELS_RLS =       0x0f,   /* read link error status block */
  51        ELS_ECHO =      0x10,   /* echo */
  52        ELS_TEST =      0x11,   /* test */
  53        ELS_RRQ =       0x12,   /* reinstate recovery qualifier */
  54        ELS_REC =       0x13,   /* read exchange concise */
  55        ELS_SRR =       0x14,   /* sequence retransmission request */
  56        ELS_FPIN =      0x16,   /* Fabric Performance Impact Notification */
  57        ELS_RDP =       0x18,   /* Read Diagnostic Parameters */
  58        ELS_RDF =       0x19,   /* Register Diagnostic Functions */
  59        ELS_PRLI =      0x20,   /* process login */
  60        ELS_PRLO =      0x21,   /* process logout */
  61        ELS_SCN =       0x22,   /* state change notification */
  62        ELS_TPLS =      0x23,   /* test process login state */
  63        ELS_TPRLO =     0x24,   /* third party process logout */
  64        ELS_LCLM =      0x25,   /* login control list mgmt (obs) */
  65        ELS_GAID =      0x30,   /* get alias_ID */
  66        ELS_FACT =      0x31,   /* fabric activate alias_id */
  67        ELS_FDACDT =    0x32,   /* fabric deactivate alias_id */
  68        ELS_NACT =      0x33,   /* N-port activate alias_id */
  69        ELS_NDACT =     0x34,   /* N-port deactivate alias_id */
  70        ELS_QOSR =      0x40,   /* quality of service request */
  71        ELS_RVCS =      0x41,   /* read virtual circuit status */
  72        ELS_PDISC =     0x50,   /* discover N_port service params */
  73        ELS_FDISC =     0x51,   /* discover F_port service params */
  74        ELS_ADISC =     0x52,   /* discover address */
  75        ELS_RNC =       0x53,   /* report node cap (obs) */
  76        ELS_FARP_REQ =  0x54,   /* FC ARP request */
  77        ELS_FARP_REPL = 0x55,   /* FC ARP reply */
  78        ELS_RPS =       0x56,   /* read port status block */
  79        ELS_RPL =       0x57,   /* read port list */
  80        ELS_RPBC =      0x58,   /* read port buffer condition */
  81        ELS_FAN =       0x60,   /* fabric address notification */
  82        ELS_RSCN =      0x61,   /* registered state change notification */
  83        ELS_SCR =       0x62,   /* state change registration */
  84        ELS_RNFT =      0x63,   /* report node FC-4 types */
  85        ELS_CSR =       0x68,   /* clock synch. request */
  86        ELS_CSU =       0x69,   /* clock synch. update */
  87        ELS_LINIT =     0x70,   /* loop initialize */
  88        ELS_LSTS =      0x72,   /* loop status */
  89        ELS_RNID =      0x78,   /* request node ID data */
  90        ELS_RLIR =      0x79,   /* registered link incident report */
  91        ELS_LIRR =      0x7a,   /* link incident record registration */
  92        ELS_SRL =       0x7b,   /* scan remote loop */
  93        ELS_SBRP =      0x7c,   /* set bit-error reporting params */
  94        ELS_RPSC =      0x7d,   /* report speed capabilities */
  95        ELS_QSA =       0x7e,   /* query security attributes */
  96        ELS_EVFP =      0x7f,   /* exchange virt. fabrics params */
  97        ELS_LKA =       0x80,   /* link keep-alive */
  98        ELS_AUTH_ELS =  0x90,   /* authentication ELS */
  99};
 100
 101/*
 102 * Initializer useful for decoding table.
 103 * Please keep this in sync with the above definitions.
 104 */
 105#define FC_ELS_CMDS_INIT {                      \
 106        [ELS_LS_RJT] =  "LS_RJT",               \
 107        [ELS_LS_ACC] =  "LS_ACC",               \
 108        [ELS_PLOGI] =   "PLOGI",                \
 109        [ELS_FLOGI] =   "FLOGI",                \
 110        [ELS_LOGO] =    "LOGO",                 \
 111        [ELS_ABTX] =    "ABTX",                 \
 112        [ELS_RCS] =     "RCS",                  \
 113        [ELS_RES] =     "RES",                  \
 114        [ELS_RSS] =     "RSS",                  \
 115        [ELS_RSI] =     "RSI",                  \
 116        [ELS_ESTS] =    "ESTS",                 \
 117        [ELS_ESTC] =    "ESTC",                 \
 118        [ELS_ADVC] =    "ADVC",                 \
 119        [ELS_RTV] =     "RTV",                  \
 120        [ELS_RLS] =     "RLS",                  \
 121        [ELS_ECHO] =    "ECHO",                 \
 122        [ELS_TEST] =    "TEST",                 \
 123        [ELS_RRQ] =     "RRQ",                  \
 124        [ELS_REC] =     "REC",                  \
 125        [ELS_SRR] =     "SRR",                  \
 126        [ELS_FPIN] =    "FPIN",                 \
 127        [ELS_RDP] =     "RDP",                  \
 128        [ELS_RDF] =     "RDF",                  \
 129        [ELS_PRLI] =    "PRLI",                 \
 130        [ELS_PRLO] =    "PRLO",                 \
 131        [ELS_SCN] =     "SCN",                  \
 132        [ELS_TPLS] =    "TPLS",                 \
 133        [ELS_TPRLO] =   "TPRLO",                \
 134        [ELS_LCLM] =    "LCLM",                 \
 135        [ELS_GAID] =    "GAID",                 \
 136        [ELS_FACT] =    "FACT",                 \
 137        [ELS_FDACDT] =  "FDACDT",               \
 138        [ELS_NACT] =    "NACT",                 \
 139        [ELS_NDACT] =   "NDACT",                \
 140        [ELS_QOSR] =    "QOSR",                 \
 141        [ELS_RVCS] =    "RVCS",                 \
 142        [ELS_PDISC] =   "PDISC",                \
 143        [ELS_FDISC] =   "FDISC",                \
 144        [ELS_ADISC] =   "ADISC",                \
 145        [ELS_RNC] =     "RNC",                  \
 146        [ELS_FARP_REQ] = "FARP_REQ",            \
 147        [ELS_FARP_REPL] =  "FARP_REPL",         \
 148        [ELS_RPS] =     "RPS",                  \
 149        [ELS_RPL] =     "RPL",                  \
 150        [ELS_RPBC] =    "RPBC",                 \
 151        [ELS_FAN] =     "FAN",                  \
 152        [ELS_RSCN] =    "RSCN",                 \
 153        [ELS_SCR] =     "SCR",                  \
 154        [ELS_RNFT] =    "RNFT",                 \
 155        [ELS_CSR] =     "CSR",                  \
 156        [ELS_CSU] =     "CSU",                  \
 157        [ELS_LINIT] =   "LINIT",                \
 158        [ELS_LSTS] =    "LSTS",                 \
 159        [ELS_RNID] =    "RNID",                 \
 160        [ELS_RLIR] =    "RLIR",                 \
 161        [ELS_LIRR] =    "LIRR",                 \
 162        [ELS_SRL] =     "SRL",                  \
 163        [ELS_SBRP] =    "SBRP",                 \
 164        [ELS_RPSC] =    "RPSC",                 \
 165        [ELS_QSA] =     "QSA",                  \
 166        [ELS_EVFP] =    "EVFP",                 \
 167        [ELS_LKA] =     "LKA",                  \
 168        [ELS_AUTH_ELS] = "AUTH_ELS",            \
 169}
 170
 171/*
 172 * LS_ACC payload.
 173 */
 174struct fc_els_ls_acc {
 175        __u8          la_cmd;           /* command code ELS_LS_ACC */
 176        __u8          la_resv[3];       /* reserved */
 177};
 178
 179/*
 180 * ELS reject payload.
 181 */
 182struct fc_els_ls_rjt {
 183        __u8    er_cmd;         /* command code ELS_LS_RJT */
 184        __u8    er_resv[4];     /* reserved must be zero */
 185        __u8    er_reason;      /* reason (enum fc_els_rjt_reason below) */
 186        __u8    er_explan;      /* explanation (enum fc_els_rjt_explan below) */
 187        __u8    er_vendor;      /* vendor specific code */
 188};
 189
 190/*
 191 * ELS reject reason codes (er_reason).
 192 */
 193enum fc_els_rjt_reason {
 194        ELS_RJT_NONE =          0,      /* no reject - not to be sent */
 195        ELS_RJT_INVAL =         0x01,   /* invalid ELS command code */
 196        ELS_RJT_LOGIC =         0x03,   /* logical error */
 197        ELS_RJT_BUSY =          0x05,   /* logical busy */
 198        ELS_RJT_PROT =          0x07,   /* protocol error */
 199        ELS_RJT_UNAB =          0x09,   /* unable to perform command request */
 200        ELS_RJT_UNSUP =         0x0b,   /* command not supported */
 201        ELS_RJT_INPROG =        0x0e,   /* command already in progress */
 202        ELS_RJT_FIP =           0x20,   /* FIP error */
 203        ELS_RJT_VENDOR =        0xff,   /* vendor specific error */
 204};
 205
 206
 207/*
 208 * reason code explanation (er_explan).
 209 */
 210enum fc_els_rjt_explan {
 211        ELS_EXPL_NONE =         0x00,   /* No additional explanation */
 212        ELS_EXPL_SPP_OPT_ERR =  0x01,   /* service parameter error - options */
 213        ELS_EXPL_SPP_ICTL_ERR = 0x03,   /* service parm error - initiator ctl */
 214        ELS_EXPL_AH =           0x11,   /* invalid association header */
 215        ELS_EXPL_AH_REQ =       0x13,   /* association_header required */
 216        ELS_EXPL_SID =          0x15,   /* invalid originator S_ID */
 217        ELS_EXPL_OXID_RXID =    0x17,   /* invalid OX_ID-RX_ID combination */
 218        ELS_EXPL_INPROG =       0x19,   /* Request already in progress */
 219        ELS_EXPL_PLOGI_REQD =   0x1e,   /* N_Port login required */
 220        ELS_EXPL_INSUF_RES =    0x29,   /* insufficient resources */
 221        ELS_EXPL_UNAB_DATA =    0x2a,   /* unable to supply requested data */
 222        ELS_EXPL_UNSUPR =       0x2c,   /* Request not supported */
 223        ELS_EXPL_INV_LEN =      0x2d,   /* Invalid payload length */
 224        ELS_EXPL_NOT_NEIGHBOR = 0x62,   /* VN2VN_Port not in neighbor set */
 225        /* TBD - above definitions incomplete */
 226};
 227
 228/*
 229 * Link Service TLV Descriptor Tag Values
 230 */
 231enum fc_ls_tlv_dtag {
 232        ELS_DTAG_LS_REQ_INFO =          0x00000001,
 233                /* Link Service Request Information Descriptor */
 234        ELS_DTAG_LNK_INTEGRITY =        0x00020001,
 235                /* Link Integrity Notification Descriptor */
 236        ELS_DTAG_DELIVERY =             0x00020002,
 237                /* Delivery Notification Descriptor */
 238        ELS_DTAG_PEER_CONGEST =         0x00020003,
 239                /* Peer Congestion Notification Descriptor */
 240        ELS_DTAG_CONGESTION =           0x00020004,
 241                /* Congestion Notification Descriptor */
 242        ELS_DTAG_FPIN_REGISTER =        0x00030001,
 243                /* FPIN Registration Descriptor */
 244};
 245
 246/*
 247 * Initializer useful for decoding table.
 248 * Please keep this in sync with the above definitions.
 249 */
 250#define FC_LS_TLV_DTAG_INIT {                                         \
 251        { ELS_DTAG_LS_REQ_INFO,         "Link Service Request Information" }, \
 252        { ELS_DTAG_LNK_INTEGRITY,       "Link Integrity Notification" },      \
 253        { ELS_DTAG_DELIVERY,            "Delivery Notification Present" },    \
 254        { ELS_DTAG_PEER_CONGEST,        "Peer Congestion Notification" },     \
 255        { ELS_DTAG_CONGESTION,          "Congestion Notification" },          \
 256        { ELS_DTAG_FPIN_REGISTER,       "FPIN Registration" },                \
 257}
 258
 259
 260/*
 261 * Generic Link Service TLV Descriptor format
 262 *
 263 * This structure, as it defines no payload, will also be referred to
 264 * as the "tlv header" - which contains the tag and len fields.
 265 */
 266struct fc_tlv_desc {
 267        __be32          desc_tag;       /* Notification Descriptor Tag */
 268        __be32          desc_len;       /* Length of Descriptor (in bytes).
 269                                         * Size of descriptor excluding
 270                                         * desc_tag and desc_len fields.
 271                                         */
 272        __u8            desc_value[0];  /* Descriptor Value */
 273};
 274
 275/* Descriptor tag and len fields are considered the mandatory header
 276 * for a descriptor
 277 */
 278#define FC_TLV_DESC_HDR_SZ      sizeof(struct fc_tlv_desc)
 279
 280/*
 281 * Macro, used when initializing payloads, to return the descriptor length.
 282 * Length is size of descriptor minus the tag and len fields.
 283 */
 284#define FC_TLV_DESC_LENGTH_FROM_SZ(desc)        \
 285                (sizeof(desc) - FC_TLV_DESC_HDR_SZ)
 286
 287/* Macro, used on received payloads, to return the descriptor length */
 288#define FC_TLV_DESC_SZ_FROM_LENGTH(tlv)         \
 289                (__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ)
 290
 291/*
 292 * This helper is used to walk descriptors in a descriptor list.
 293 * Given the address of the current descriptor, which minimally contains a
 294 * tag and len field, calculate the address of the next descriptor based
 295 * on the len field.
 296 */
 297static inline void *fc_tlv_next_desc(void *desc)
 298{
 299        struct fc_tlv_desc *tlv = desc;
 300
 301        return (desc + FC_TLV_DESC_SZ_FROM_LENGTH(tlv));
 302}
 303
 304
 305/*
 306 * Link Service Request Information Descriptor
 307 */
 308struct fc_els_lsri_desc {
 309        __be32          desc_tag;       /* descriptor tag (0x0000 0001) */
 310        __be32          desc_len;       /* Length of Descriptor (in bytes) (4).
 311                                         * Size of descriptor excluding
 312                                         * desc_tag and desc_len fields.
 313                                         */
 314        struct {
 315                __u8    cmd;            /* ELS cmd byte */
 316                __u8    bytes[3];       /* bytes 1..3 */
 317        } rqst_w0;                      /* Request word 0 */
 318};
 319
 320
 321/*
 322 * Common service parameters (N ports).
 323 */
 324struct fc_els_csp {
 325        __u8            sp_hi_ver;      /* highest version supported (obs.) */
 326        __u8            sp_lo_ver;      /* highest version supported (obs.) */
 327        __be16          sp_bb_cred;     /* buffer-to-buffer credits */
 328        __be16          sp_features;    /* common feature flags */
 329        __be16          sp_bb_data;     /* b-b state number and data field sz */
 330        union {
 331                struct {
 332                        __be16  _sp_tot_seq; /* total concurrent sequences */
 333                        __be16  _sp_rel_off; /* rel. offset by info cat */
 334                } sp_plogi;
 335                struct {
 336                        __be32  _sp_r_a_tov; /* resource alloc. timeout msec */
 337                } sp_flogi_acc;
 338        } sp_u;
 339        __be32          sp_e_d_tov;     /* error detect timeout value */
 340};
 341#define sp_tot_seq      sp_u.sp_plogi._sp_tot_seq
 342#define sp_rel_off      sp_u.sp_plogi._sp_rel_off
 343#define sp_r_a_tov      sp_u.sp_flogi_acc._sp_r_a_tov
 344
 345#define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */
 346
 347/*
 348 * Minimum and maximum values for max data field size in service parameters.
 349 */
 350#define FC_SP_MIN_MAX_PAYLOAD   FC_MIN_MAX_PAYLOAD
 351#define FC_SP_MAX_MAX_PAYLOAD   FC_MAX_PAYLOAD
 352
 353/*
 354 * sp_features
 355 */
 356#define FC_SP_FT_NPIV   0x8000  /* multiple N_Port_ID support (FLOGI) */
 357#define FC_SP_FT_CIRO   0x8000  /* continuously increasing rel off (PLOGI) */
 358#define FC_SP_FT_CLAD   0x8000  /* clean address (in FLOGI LS_ACC) */
 359#define FC_SP_FT_RAND   0x4000  /* random relative offset */
 360#define FC_SP_FT_VAL    0x2000  /* valid vendor version level */
 361#define FC_SP_FT_NPIV_ACC       0x2000  /* NPIV assignment (FLOGI LS_ACC) */
 362#define FC_SP_FT_FPORT  0x1000  /* F port (1) vs. N port (0) */
 363#define FC_SP_FT_ABB    0x0800  /* alternate BB_credit management */
 364#define FC_SP_FT_EDTR   0x0400  /* E_D_TOV Resolution is nanoseconds */
 365#define FC_SP_FT_MCAST  0x0200  /* multicast */
 366#define FC_SP_FT_BCAST  0x0100  /* broadcast */
 367#define FC_SP_FT_HUNT   0x0080  /* hunt group */
 368#define FC_SP_FT_SIMP   0x0040  /* dedicated simplex */
 369#define FC_SP_FT_SEC    0x0020  /* reserved for security */
 370#define FC_SP_FT_CSYN   0x0010  /* clock synch. supported */
 371#define FC_SP_FT_RTTOV  0x0008  /* R_T_TOV value 100 uS, else 100 mS */
 372#define FC_SP_FT_HALF   0x0004  /* dynamic half duplex */
 373#define FC_SP_FT_SEQC   0x0002  /* SEQ_CNT */
 374#define FC_SP_FT_PAYL   0x0001  /* FLOGI payload length 256, else 116 */
 375
 376/*
 377 * Class-specific service parameters.
 378 */
 379struct fc_els_cssp {
 380        __be16          cp_class;       /* class flags */
 381        __be16          cp_init;        /* initiator flags */
 382        __be16          cp_recip;       /* recipient flags */
 383        __be16          cp_rdfs;        /* receive data field size */
 384        __be16          cp_con_seq;     /* concurrent sequences */
 385        __be16          cp_ee_cred;     /* N-port end-to-end credit */
 386        __u8            cp_resv1;       /* reserved */
 387        __u8            cp_open_seq;    /* open sequences per exchange */
 388        __u8            _cp_resv2[2];   /* reserved */
 389};
 390
 391/*
 392 * cp_class flags.
 393 */
 394#define FC_CPC_VALID    0x8000          /* class valid */
 395#define FC_CPC_IMIX     0x4000          /* intermix mode */
 396#define FC_CPC_SEQ      0x0800          /* sequential delivery */
 397#define FC_CPC_CAMP     0x0200          /* camp-on */
 398#define FC_CPC_PRI      0x0080          /* priority */
 399
 400/*
 401 * cp_init flags.
 402 * (TBD: not all flags defined here).
 403 */
 404#define FC_CPI_CSYN     0x0010          /* clock synch. capable */
 405
 406/*
 407 * cp_recip flags.
 408 */
 409#define FC_CPR_CSYN     0x0008          /* clock synch. capable */
 410
 411/*
 412 * NFC_ELS_FLOGI: Fabric login request.
 413 * NFC_ELS_PLOGI: Port login request (same format).
 414 */
 415struct fc_els_flogi {
 416        __u8            fl_cmd;         /* command */
 417        __u8            _fl_resvd[3];   /* must be zero */
 418        struct fc_els_csp fl_csp;       /* common service parameters */
 419        __be64          fl_wwpn;        /* port name */
 420        __be64          fl_wwnn;        /* node name */
 421        struct fc_els_cssp fl_cssp[4];  /* class 1-4 service parameters */
 422        __u8            fl_vend[16];    /* vendor version level */
 423} __attribute__((__packed__));
 424
 425/*
 426 * Process login service parameter page.
 427 */
 428struct fc_els_spp {
 429        __u8            spp_type;       /* type code or common service params */
 430        __u8            spp_type_ext;   /* type code extension */
 431        __u8            spp_flags;
 432        __u8            _spp_resvd;
 433        __be32          spp_orig_pa;    /* originator process associator */
 434        __be32          spp_resp_pa;    /* responder process associator */
 435        __be32          spp_params;     /* service parameters */
 436};
 437
 438/*
 439 * spp_flags.
 440 */
 441#define FC_SPP_OPA_VAL      0x80        /* originator proc. assoc. valid */
 442#define FC_SPP_RPA_VAL      0x40        /* responder proc. assoc. valid */
 443#define FC_SPP_EST_IMG_PAIR 0x20        /* establish image pair */
 444#define FC_SPP_RESP_MASK    0x0f        /* mask for response code (below) */
 445
 446/*
 447 * SPP response code in spp_flags - lower 4 bits.
 448 */
 449enum fc_els_spp_resp {
 450        FC_SPP_RESP_ACK =       1,      /* request executed */
 451        FC_SPP_RESP_RES =       2,      /* unable due to lack of resources */
 452        FC_SPP_RESP_INIT =      3,      /* initialization not complete */
 453        FC_SPP_RESP_NO_PA =     4,      /* unknown process associator */
 454        FC_SPP_RESP_CONF =      5,      /* configuration precludes image pair */
 455        FC_SPP_RESP_COND =      6,      /* request completed conditionally */
 456        FC_SPP_RESP_MULT =      7,      /* unable to handle multiple SPPs */
 457        FC_SPP_RESP_INVL =      8,      /* SPP is invalid */
 458};
 459
 460/*
 461 * ELS_RRQ - Reinstate Recovery Qualifier
 462 */
 463struct fc_els_rrq {
 464        __u8            rrq_cmd;        /* command (0x12) */
 465        __u8            rrq_zero[3];    /* specified as zero - part of cmd */
 466        __u8            rrq_resvd;      /* reserved */
 467        __u8            rrq_s_id[3];    /* originator FID */
 468        __be16          rrq_ox_id;      /* originator exchange ID */
 469        __be16          rrq_rx_id;      /* responders exchange ID */
 470};
 471
 472/*
 473 * ELS_REC - Read exchange concise.
 474 */
 475struct fc_els_rec {
 476        __u8            rec_cmd;        /* command (0x13) */
 477        __u8            rec_zero[3];    /* specified as zero - part of cmd */
 478        __u8            rec_resvd;      /* reserved */
 479        __u8            rec_s_id[3];    /* originator FID */
 480        __be16          rec_ox_id;      /* originator exchange ID */
 481        __be16          rec_rx_id;      /* responders exchange ID */
 482};
 483
 484/*
 485 * ELS_REC LS_ACC payload.
 486 */
 487struct fc_els_rec_acc {
 488        __u8            reca_cmd;       /* accept (0x02) */
 489        __u8            reca_zero[3];   /* specified as zero - part of cmd */
 490        __be16          reca_ox_id;     /* originator exchange ID */
 491        __be16          reca_rx_id;     /* responders exchange ID */
 492        __u8            reca_resvd1;    /* reserved */
 493        __u8            reca_ofid[3];   /* originator FID */
 494        __u8            reca_resvd2;    /* reserved */
 495        __u8            reca_rfid[3];   /* responder FID */
 496        __be32          reca_fc4value;  /* FC4 value */
 497        __be32          reca_e_stat;    /* ESB (exchange status block) status */
 498};
 499
 500/*
 501 * ELS_PRLI - Process login request and response.
 502 */
 503struct fc_els_prli {
 504        __u8            prli_cmd;       /* command */
 505        __u8            prli_spp_len;   /* length of each serv. parm. page */
 506        __be16          prli_len;       /* length of entire payload */
 507        /* service parameter pages follow */
 508};
 509
 510/*
 511 * ELS_PRLO - Process logout request and response.
 512 */
 513struct fc_els_prlo {
 514        __u8            prlo_cmd;       /* command */
 515        __u8            prlo_obs;       /* obsolete, but shall be set to 10h */
 516        __be16          prlo_len;       /* payload length */
 517};
 518
 519/*
 520 * ELS_ADISC payload
 521 */
 522struct fc_els_adisc {
 523        __u8            adisc_cmd;
 524        __u8            adisc_resv[3];
 525        __u8            adisc_resv1;
 526        __u8            adisc_hard_addr[3];
 527        __be64          adisc_wwpn;
 528        __be64          adisc_wwnn;
 529        __u8            adisc_resv2;
 530        __u8            adisc_port_id[3];
 531} __attribute__((__packed__));
 532
 533/*
 534 * ELS_LOGO - process or fabric logout.
 535 */
 536struct fc_els_logo {
 537        __u8            fl_cmd;         /* command code */
 538        __u8            fl_zero[3];     /* specified as zero - part of cmd */
 539        __u8            fl_resvd;       /* reserved */
 540        __u8            fl_n_port_id[3];/* N port ID */
 541        __be64          fl_n_port_wwn;  /* port name */
 542};
 543
 544/*
 545 * ELS_RTV - read timeout value.
 546 */
 547struct fc_els_rtv {
 548        __u8            rtv_cmd;        /* command code 0x0e */
 549        __u8            rtv_zero[3];    /* specified as zero - part of cmd */
 550};
 551
 552/*
 553 * LS_ACC for ELS_RTV - read timeout value.
 554 */
 555struct fc_els_rtv_acc {
 556        __u8            rtv_cmd;        /* command code 0x02 */
 557        __u8            rtv_zero[3];    /* specified as zero - part of cmd */
 558        __be32          rtv_r_a_tov;    /* resource allocation timeout value */
 559        __be32          rtv_e_d_tov;    /* error detection timeout value */
 560        __be32          rtv_toq;        /* timeout qualifier (see below) */
 561};
 562
 563/*
 564 * rtv_toq bits.
 565 */
 566#define FC_ELS_RTV_EDRES (1 << 26)      /* E_D_TOV resolution is nS else mS */
 567#define FC_ELS_RTV_RTTOV (1 << 19)      /* R_T_TOV is 100 uS else 100 mS */
 568
 569/*
 570 * ELS_SCR - state change registration payload.
 571 */
 572struct fc_els_scr {
 573        __u8            scr_cmd;        /* command code */
 574        __u8            scr_resv[6];    /* reserved */
 575        __u8            scr_reg_func;   /* registration function (see below) */
 576};
 577
 578enum fc_els_scr_func {
 579        ELS_SCRF_FAB =  1,      /* fabric-detected registration */
 580        ELS_SCRF_NPORT = 2,     /* Nx_Port-detected registration */
 581        ELS_SCRF_FULL = 3,      /* full registration */
 582        ELS_SCRF_CLEAR = 255,   /* remove any current registrations */
 583};
 584
 585/*
 586 * ELS_RSCN - registered state change notification payload.
 587 */
 588struct fc_els_rscn {
 589        __u8            rscn_cmd;       /* RSCN opcode (0x61) */
 590        __u8            rscn_page_len;  /* page length (4) */
 591        __be16          rscn_plen;      /* payload length including this word */
 592
 593        /* followed by 4-byte generic affected Port_ID pages */
 594};
 595
 596struct fc_els_rscn_page {
 597        __u8            rscn_page_flags; /* event and address format */
 598        __u8            rscn_fid[3];    /* fabric ID */
 599};
 600
 601#define ELS_RSCN_EV_QUAL_BIT    2       /* shift count for event qualifier */
 602#define ELS_RSCN_EV_QUAL_MASK   0xf     /* mask for event qualifier */
 603#define ELS_RSCN_ADDR_FMT_BIT   0       /* shift count for address format */
 604#define ELS_RSCN_ADDR_FMT_MASK  0x3     /* mask for address format */
 605
 606enum fc_els_rscn_ev_qual {
 607        ELS_EV_QUAL_NONE = 0,           /* unspecified */
 608        ELS_EV_QUAL_NS_OBJ = 1,         /* changed name server object */
 609        ELS_EV_QUAL_PORT_ATTR = 2,      /* changed port attribute */
 610        ELS_EV_QUAL_SERV_OBJ = 3,       /* changed service object */
 611        ELS_EV_QUAL_SW_CONFIG = 4,      /* changed switch configuration */
 612        ELS_EV_QUAL_REM_OBJ = 5,        /* removed object */
 613};
 614
 615enum fc_els_rscn_addr_fmt {
 616        ELS_ADDR_FMT_PORT = 0,  /* rscn_fid is a port address */
 617        ELS_ADDR_FMT_AREA = 1,  /* rscn_fid is a area address */
 618        ELS_ADDR_FMT_DOM = 2,   /* rscn_fid is a domain address */
 619        ELS_ADDR_FMT_FAB = 3,   /* anything on fabric may have changed */
 620};
 621
 622/*
 623 * ELS_RNID - request Node ID.
 624 */
 625struct fc_els_rnid {
 626        __u8            rnid_cmd;       /* RNID opcode (0x78) */
 627        __u8            rnid_resv[3];   /* reserved */
 628        __u8            rnid_fmt;       /* data format */
 629        __u8            rnid_resv2[3];  /* reserved */
 630};
 631
 632/*
 633 * Node Identification Data formats (rnid_fmt)
 634 */
 635enum fc_els_rnid_fmt {
 636        ELS_RNIDF_NONE = 0,             /* no specific identification data */
 637        ELS_RNIDF_GEN = 0xdf,           /* general topology discovery format */
 638};
 639
 640/*
 641 * ELS_RNID response.
 642 */
 643struct fc_els_rnid_resp {
 644        __u8            rnid_cmd;       /* response code (LS_ACC) */
 645        __u8            rnid_resv[3];   /* reserved */
 646        __u8            rnid_fmt;       /* data format */
 647        __u8            rnid_cid_len;   /* common ID data length */
 648        __u8            rnid_resv2;     /* reserved */
 649        __u8            rnid_sid_len;   /* specific ID data length */
 650};
 651
 652struct fc_els_rnid_cid {
 653        __be64          rnid_wwpn;      /* N port name */
 654        __be64          rnid_wwnn;      /* node name */
 655};
 656
 657struct fc_els_rnid_gen {
 658        __u8            rnid_vend_id[16]; /* vendor-unique ID */
 659        __be32          rnid_atype;     /* associated type (see below) */
 660        __be32          rnid_phys_port; /* physical port number */
 661        __be32          rnid_att_nodes; /* number of attached nodes */
 662        __u8            rnid_node_mgmt; /* node management (see below) */
 663        __u8            rnid_ip_ver;    /* IP version (see below) */
 664        __be16          rnid_prot_port; /* UDP / TCP port number */
 665        __be32          rnid_ip_addr[4]; /* IP address */
 666        __u8            rnid_resvd[2];  /* reserved */
 667        __be16          rnid_vend_spec; /* vendor-specific field */
 668};
 669
 670enum fc_els_rnid_atype {
 671        ELS_RNIDA_UNK =         0x01,   /* unknown */
 672        ELS_RNIDA_OTHER =       0x02,   /* none of the following */
 673        ELS_RNIDA_HUB =         0x03,
 674        ELS_RNIDA_SWITCH =      0x04,
 675        ELS_RNIDA_GATEWAY =     0x05,
 676        ELS_RNIDA_CONV =        0x06,   /* Obsolete, do not use this value */
 677        ELS_RNIDA_HBA =         0x07,   /* Obsolete, do not use this value */
 678        ELS_RNIDA_PROXY =       0x08,   /* Obsolete, do not use this value */
 679        ELS_RNIDA_STORAGE =     0x09,
 680        ELS_RNIDA_HOST =        0x0a,
 681        ELS_RNIDA_SUBSYS =      0x0b,   /* storage subsystem (e.g., RAID) */
 682        ELS_RNIDA_ACCESS =      0x0e,   /* access device (e.g. media changer) */
 683        ELS_RNIDA_NAS =         0x11,   /* NAS server */
 684        ELS_RNIDA_BRIDGE =      0x12,   /* bridge */
 685        ELS_RNIDA_VIRT =        0x13,   /* virtualization device */
 686        ELS_RNIDA_MF =          0xff,   /* multifunction device (bits below) */
 687        ELS_RNIDA_MF_HUB =      1UL << 31,      /* hub */
 688        ELS_RNIDA_MF_SW =       1UL << 30,      /* switch */
 689        ELS_RNIDA_MF_GW =       1UL << 29,      /* gateway */
 690        ELS_RNIDA_MF_ST =       1UL << 28,      /* storage */
 691        ELS_RNIDA_MF_HOST =     1UL << 27,      /* host */
 692        ELS_RNIDA_MF_SUB =      1UL << 26,      /* storage subsystem */
 693        ELS_RNIDA_MF_ACC =      1UL << 25,      /* storage access dev */
 694        ELS_RNIDA_MF_WDM =      1UL << 24,      /* wavelength division mux */
 695        ELS_RNIDA_MF_NAS =      1UL << 23,      /* NAS server */
 696        ELS_RNIDA_MF_BR =       1UL << 22,      /* bridge */
 697        ELS_RNIDA_MF_VIRT =     1UL << 21,      /* virtualization device */
 698};
 699
 700enum fc_els_rnid_mgmt {
 701        ELS_RNIDM_SNMP =        0,
 702        ELS_RNIDM_TELNET =      1,
 703        ELS_RNIDM_HTTP =        2,
 704        ELS_RNIDM_HTTPS =       3,
 705        ELS_RNIDM_XML =         4,      /* HTTP + XML */
 706};
 707
 708enum fc_els_rnid_ipver {
 709        ELS_RNIDIP_NONE =       0,      /* no IP support or node mgmt. */
 710        ELS_RNIDIP_V4 =         1,      /* IPv4 */
 711        ELS_RNIDIP_V6 =         2,      /* IPv6 */
 712};
 713
 714/*
 715 * ELS RPL - Read Port List.
 716 */
 717struct fc_els_rpl {
 718        __u8            rpl_cmd;        /* command */
 719        __u8            rpl_resv[5];    /* reserved - must be zero */
 720        __be16          rpl_max_size;   /* maximum response size or zero */
 721        __u8            rpl_resv1;      /* reserved - must be zero */
 722        __u8            rpl_index[3];   /* starting index */
 723};
 724
 725/*
 726 * Port number block in RPL response.
 727 */
 728struct fc_els_pnb {
 729        __be32          pnb_phys_pn;    /* physical port number */
 730        __u8            pnb_resv;       /* reserved */
 731        __u8            pnb_port_id[3]; /* port ID */
 732        __be64          pnb_wwpn;       /* port name */
 733};
 734
 735/*
 736 * RPL LS_ACC response.
 737 */
 738struct fc_els_rpl_resp {
 739        __u8            rpl_cmd;        /* ELS_LS_ACC */
 740        __u8            rpl_resv1;      /* reserved - must be zero */
 741        __be16          rpl_plen;       /* payload length */
 742        __u8            rpl_resv2;      /* reserved - must be zero */
 743        __u8            rpl_llen[3];    /* list length */
 744        __u8            rpl_resv3;      /* reserved - must be zero */
 745        __u8            rpl_index[3];   /* starting index */
 746        struct fc_els_pnb rpl_pnb[1];   /* variable number of PNBs */
 747};
 748
 749/*
 750 * Link Error Status Block.
 751 */
 752struct fc_els_lesb {
 753        __be32          lesb_link_fail; /* link failure count */
 754        __be32          lesb_sync_loss; /* loss of synchronization count */
 755        __be32          lesb_sig_loss;  /* loss of signal count */
 756        __be32          lesb_prim_err;  /* primitive sequence error count */
 757        __be32          lesb_inv_word;  /* invalid transmission word count */
 758        __be32          lesb_inv_crc;   /* invalid CRC count */
 759};
 760
 761/*
 762 * ELS RPS - Read Port Status Block request.
 763 */
 764struct fc_els_rps {
 765        __u8            rps_cmd;        /* command */
 766        __u8            rps_resv[2];    /* reserved - must be zero */
 767        __u8            rps_flag;       /* flag - see below */
 768        __be64          rps_port_spec;  /* port selection */
 769};
 770
 771enum fc_els_rps_flag {
 772        FC_ELS_RPS_DID =        0x00,   /* port identified by D_ID of req. */
 773        FC_ELS_RPS_PPN =        0x01,   /* port_spec is physical port number */
 774        FC_ELS_RPS_WWPN =       0x02,   /* port_spec is port WWN */
 775};
 776
 777/*
 778 * ELS RPS LS_ACC response.
 779 */
 780struct fc_els_rps_resp {
 781        __u8            rps_cmd;        /* command - LS_ACC */
 782        __u8            rps_resv[2];    /* reserved - must be zero */
 783        __u8            rps_flag;       /* flag - see below */
 784        __u8            rps_resv2[2];   /* reserved */
 785        __be16          rps_status;     /* port status - see below */
 786        struct fc_els_lesb rps_lesb;    /* link error status block */
 787};
 788
 789enum fc_els_rps_resp_flag {
 790        FC_ELS_RPS_LPEV =       0x01,   /* L_port extension valid */
 791};
 792
 793enum fc_els_rps_resp_status {
 794        FC_ELS_RPS_PTP =        1 << 5, /* point-to-point connection */
 795        FC_ELS_RPS_LOOP =       1 << 4, /* loop mode */
 796        FC_ELS_RPS_FAB =        1 << 3, /* fabric present */
 797        FC_ELS_RPS_NO_SIG =     1 << 2, /* loss of signal */
 798        FC_ELS_RPS_NO_SYNC =    1 << 1, /* loss of synchronization */
 799        FC_ELS_RPS_RESET =      1 << 0, /* in link reset protocol */
 800};
 801
 802/*
 803 * ELS LIRR - Link Incident Record Registration request.
 804 */
 805struct fc_els_lirr {
 806        __u8            lirr_cmd;       /* command */
 807        __u8            lirr_resv[3];   /* reserved - must be zero */
 808        __u8            lirr_func;      /* registration function */
 809        __u8            lirr_fmt;       /* FC-4 type of RLIR requested */
 810        __u8            lirr_resv2[2];  /* reserved - must be zero */
 811};
 812
 813enum fc_els_lirr_func {
 814        ELS_LIRR_SET_COND =     0x01,   /* set - conditionally receive */
 815        ELS_LIRR_SET_UNCOND =   0x02,   /* set - unconditionally receive */
 816        ELS_LIRR_CLEAR =        0xff    /* clear registration */
 817};
 818
 819/*
 820 * ELS SRL - Scan Remote Loop request.
 821 */
 822struct fc_els_srl {
 823        __u8            srl_cmd;        /* command */
 824        __u8            srl_resv[3];    /* reserved - must be zero */
 825        __u8            srl_flag;       /* flag - see below */
 826        __u8            srl_flag_param[3];      /* flag parameter */
 827};
 828
 829enum fc_els_srl_flag {
 830        FC_ELS_SRL_ALL =        0x00,   /* scan all FL ports */
 831        FC_ELS_SRL_ONE =        0x01,   /* scan specified loop */
 832        FC_ELS_SRL_EN_PER =     0x02,   /* enable periodic scanning (param) */
 833        FC_ELS_SRL_DIS_PER =    0x03,   /* disable periodic scanning */
 834};
 835
 836/*
 837 * ELS RLS - Read Link Error Status Block request.
 838 */
 839struct fc_els_rls {
 840        __u8            rls_cmd;        /* command */
 841        __u8            rls_resv[4];    /* reserved - must be zero */
 842        __u8            rls_port_id[3]; /* port ID */
 843};
 844
 845/*
 846 * ELS RLS LS_ACC Response.
 847 */
 848struct fc_els_rls_resp {
 849        __u8            rls_cmd;        /* ELS_LS_ACC */
 850        __u8            rls_resv[3];    /* reserved - must be zero */
 851        struct fc_els_lesb rls_lesb;    /* link error status block */
 852};
 853
 854/*
 855 * ELS RLIR - Registered Link Incident Report.
 856 * This is followed by the CLIR and the CLID, described below.
 857 */
 858struct fc_els_rlir {
 859        __u8            rlir_cmd;       /* command */
 860        __u8            rlir_resv[3];   /* reserved - must be zero */
 861        __u8            rlir_fmt;       /* format (FC4-type if type specific) */
 862        __u8            rlir_clr_len;   /* common link incident record length */
 863        __u8            rlir_cld_len;   /* common link incident desc. length */
 864        __u8            rlir_slr_len;   /* spec. link incident record length */
 865};
 866
 867/*
 868 * CLIR - Common Link Incident Record Data. - Sent via RLIR.
 869 */
 870struct fc_els_clir {
 871        __be64          clir_wwpn;      /* incident port name */
 872        __be64          clir_wwnn;      /* incident port node name */
 873        __u8            clir_port_type; /* incident port type */
 874        __u8            clir_port_id[3];        /* incident port ID */
 875
 876        __be64          clir_conn_wwpn; /* connected port name */
 877        __be64          clir_conn_wwnn; /* connected node name */
 878        __be64          clir_fab_name;  /* fabric name */
 879        __be32          clir_phys_port; /* physical port number */
 880        __be32          clir_trans_id;  /* transaction ID */
 881        __u8            clir_resv[3];   /* reserved */
 882        __u8            clir_ts_fmt;    /* time stamp format */
 883        __be64          clir_timestamp; /* time stamp */
 884};
 885
 886/*
 887 * CLIR clir_ts_fmt - time stamp format values.
 888 */
 889enum fc_els_clir_ts_fmt {
 890        ELS_CLIR_TS_UNKNOWN =   0,      /* time stamp field unknown */
 891        ELS_CLIR_TS_SEC_FRAC =  1,      /* time in seconds and fractions */
 892        ELS_CLIR_TS_CSU =       2,      /* time in clock synch update format */
 893};
 894
 895/*
 896 * Common Link Incident Descriptor - sent via RLIR.
 897 */
 898struct fc_els_clid {
 899        __u8            clid_iq;        /* incident qualifier flags */
 900        __u8            clid_ic;        /* incident code */
 901        __be16          clid_epai;      /* domain/area of ISL */
 902};
 903
 904/*
 905 * CLID incident qualifier flags.
 906 */
 907enum fc_els_clid_iq {
 908        ELS_CLID_SWITCH =       0x20,   /* incident port is a switch node */
 909        ELS_CLID_E_PORT =       0x10,   /* incident is an ISL (E) port */
 910        ELS_CLID_SEV_MASK =     0x0c,   /* severity 2-bit field mask */
 911        ELS_CLID_SEV_INFO =     0x00,   /* report is informational */
 912        ELS_CLID_SEV_INOP =     0x08,   /* link not operational */
 913        ELS_CLID_SEV_DEG =      0x04,   /* link degraded but operational */
 914        ELS_CLID_LASER =        0x02,   /* subassembly is a laser */
 915        ELS_CLID_FRU =          0x01,   /* format can identify a FRU */
 916};
 917
 918/*
 919 * CLID incident code.
 920 */
 921enum fc_els_clid_ic {
 922        ELS_CLID_IC_IMPL =      1,      /* implicit incident */
 923        ELS_CLID_IC_BER =       2,      /* bit-error-rate threshold exceeded */
 924        ELS_CLID_IC_LOS =       3,      /* loss of synch or signal */
 925        ELS_CLID_IC_NOS =       4,      /* non-operational primitive sequence */
 926        ELS_CLID_IC_PST =       5,      /* primitive sequence timeout */
 927        ELS_CLID_IC_INVAL =     6,      /* invalid primitive sequence */
 928        ELS_CLID_IC_LOOP_TO =   7,      /* loop initialization time out */
 929        ELS_CLID_IC_LIP =       8,      /* receiving LIP */
 930};
 931
 932/*
 933 * Link Integrity event types
 934 */
 935enum fc_fpin_li_event_types {
 936        FPIN_LI_UNKNOWN =               0x0,
 937        FPIN_LI_LINK_FAILURE =          0x1,
 938        FPIN_LI_LOSS_OF_SYNC =          0x2,
 939        FPIN_LI_LOSS_OF_SIG =           0x3,
 940        FPIN_LI_PRIM_SEQ_ERR =          0x4,
 941        FPIN_LI_INVALID_TX_WD =         0x5,
 942        FPIN_LI_INVALID_CRC =           0x6,
 943        FPIN_LI_DEVICE_SPEC =           0xF,
 944};
 945
 946/*
 947 * Initializer useful for decoding table.
 948 * Please keep this in sync with the above definitions.
 949 */
 950#define FC_FPIN_LI_EVT_TYPES_INIT {                                     \
 951        { FPIN_LI_UNKNOWN,              "Unknown" },                    \
 952        { FPIN_LI_LINK_FAILURE,         "Link Failure" },               \
 953        { FPIN_LI_LOSS_OF_SYNC,         "Loss of Synchronization" },    \
 954        { FPIN_LI_LOSS_OF_SIG,          "Loss of Signal" },             \
 955        { FPIN_LI_PRIM_SEQ_ERR,         "Primitive Sequence Protocol Error" }, \
 956        { FPIN_LI_INVALID_TX_WD,        "Invalid Transmission Word" },  \
 957        { FPIN_LI_INVALID_CRC,          "Invalid CRC" },                \
 958        { FPIN_LI_DEVICE_SPEC,          "Device Specific" },            \
 959}
 960
 961/*
 962 * Delivery event types
 963 */
 964enum fc_fpin_deli_event_types {
 965        FPIN_DELI_UNKNOWN =             0x0,
 966        FPIN_DELI_TIMEOUT =             0x1,
 967        FPIN_DELI_UNABLE_TO_ROUTE =     0x2,
 968        FPIN_DELI_DEVICE_SPEC =         0xF,
 969};
 970
 971/*
 972 * Initializer useful for decoding table.
 973 * Please keep this in sync with the above definitions.
 974 */
 975#define FC_FPIN_DELI_EVT_TYPES_INIT {                                   \
 976        { FPIN_DELI_UNKNOWN,            "Unknown" },                    \
 977        { FPIN_DELI_TIMEOUT,            "Timeout" },                    \
 978        { FPIN_DELI_UNABLE_TO_ROUTE,    "Unable to Route" },            \
 979        { FPIN_DELI_DEVICE_SPEC,        "Device Specific" },            \
 980}
 981
 982/*
 983 * Congestion event types
 984 */
 985enum fc_fpin_congn_event_types {
 986        FPIN_CONGN_CLEAR =              0x0,
 987        FPIN_CONGN_LOST_CREDIT =        0x1,
 988        FPIN_CONGN_CREDIT_STALL =       0x2,
 989        FPIN_CONGN_OVERSUBSCRIPTION =   0x3,
 990        FPIN_CONGN_DEVICE_SPEC =        0xF,
 991};
 992
 993/*
 994 * Initializer useful for decoding table.
 995 * Please keep this in sync with the above definitions.
 996 */
 997#define FC_FPIN_CONGN_EVT_TYPES_INIT {                                  \
 998        { FPIN_CONGN_CLEAR,             "Clear" },                      \
 999        { FPIN_CONGN_LOST_CREDIT,       "Lost Credit" },                \
1000        { FPIN_CONGN_CREDIT_STALL,      "Credit Stall" },               \
1001        { FPIN_CONGN_OVERSUBSCRIPTION,  "Oversubscription" },           \
1002        { FPIN_CONGN_DEVICE_SPEC,       "Device Specific" },            \
1003}
1004
1005enum fc_fpin_congn_severity_types {
1006        FPIN_CONGN_SEVERITY_WARNING =   0xF1,
1007        FPIN_CONGN_SEVERITY_ERROR =     0xF7,
1008};
1009
1010/*
1011 * Link Integrity Notification Descriptor
1012 */
1013struct fc_fn_li_desc {
1014        __be32          desc_tag;       /* Descriptor Tag (0x00020001) */
1015        __be32          desc_len;       /* Length of Descriptor (in bytes).
1016                                         * Size of descriptor excluding
1017                                         * desc_tag and desc_len fields.
1018                                         */
1019        __be64          detecting_wwpn; /* Port Name that detected event */
1020        __be64          attached_wwpn;  /* Port Name of device attached to
1021                                         * detecting Port Name
1022                                         */
1023        __be16          event_type;     /* see enum fc_fpin_li_event_types */
1024        __be16          event_modifier; /* Implementation specific value
1025                                         * describing the event type
1026                                         */
1027        __be32          event_threshold;/* duration in ms of the link
1028                                         * integrity detection cycle
1029                                         */
1030        __be32          event_count;    /* minimum number of event
1031                                         * occurrences during the event
1032                                         * threshold to caause the LI event
1033                                         */
1034        __be32          pname_count;    /* number of portname_list elements */
1035        __be64          pname_list[0];  /* list of N_Port_Names accessible
1036                                         * through the attached port
1037                                         */
1038};
1039
1040/*
1041 * Delivery Notification Descriptor
1042 */
1043struct fc_fn_deli_desc {
1044        __be32          desc_tag;       /* Descriptor Tag (0x00020002) */
1045        __be32          desc_len;       /* Length of Descriptor (in bytes).
1046                                         * Size of descriptor excluding
1047                                         * desc_tag and desc_len fields.
1048                                         */
1049        __be64          detecting_wwpn; /* Port Name that detected event */
1050        __be64          attached_wwpn;  /* Port Name of device attached to
1051                                         * detecting Port Name
1052                                         */
1053        __be32          deli_reason_code;/* see enum fc_fpin_deli_event_types */
1054};
1055
1056/*
1057 * Peer Congestion Notification Descriptor
1058 */
1059struct fc_fn_peer_congn_desc {
1060        __be32          desc_tag;       /* Descriptor Tag (0x00020003) */
1061        __be32          desc_len;       /* Length of Descriptor (in bytes).
1062                                         * Size of descriptor excluding
1063                                         * desc_tag and desc_len fields.
1064                                         */
1065        __be64          detecting_wwpn; /* Port Name that detected event */
1066        __be64          attached_wwpn;  /* Port Name of device attached to
1067                                         * detecting Port Name
1068                                         */
1069        __be16          event_type;     /* see enum fc_fpin_congn_event_types */
1070        __be16          event_modifier; /* Implementation specific value
1071                                         * describing the event type
1072                                         */
1073        __be32          event_period;   /* duration (ms) of the detected
1074                                         * congestion event
1075                                         */
1076        __be32          pname_count;    /* number of portname_list elements */
1077        __be64          pname_list[0];  /* list of N_Port_Names accessible
1078                                         * through the attached port
1079                                         */
1080};
1081
1082/*
1083 * Congestion Notification Descriptor
1084 */
1085struct fc_fn_congn_desc {
1086        __be32          desc_tag;       /* Descriptor Tag (0x00020004) */
1087        __be32          desc_len;       /* Length of Descriptor (in bytes).
1088                                         * Size of descriptor excluding
1089                                         * desc_tag and desc_len fields.
1090                                         */
1091        __be16          event_type;     /* see enum fc_fpin_congn_event_types */
1092        __be16          event_modifier; /* Implementation specific value
1093                                         * describing the event type
1094                                         */
1095        __be32          event_period;   /* duration (ms) of the detected
1096                                         * congestion event
1097                                         */
1098        __u8            severity;       /* command */
1099        __u8            resv[3];        /* reserved - must be zero */
1100};
1101
1102/*
1103 * ELS_FPIN - Fabric Performance Impact Notification
1104 */
1105struct fc_els_fpin {
1106        __u8            fpin_cmd;       /* command (0x16) */
1107        __u8            fpin_zero[3];   /* specified as zero - part of cmd */
1108        __be32          desc_len;       /* Length of Descriptor List (in bytes).
1109                                         * Size of ELS excluding fpin_cmd,
1110                                         * fpin_zero and desc_len fields.
1111                                         */
1112        struct fc_tlv_desc      fpin_desc[0];   /* Descriptor list */
1113};
1114
1115/* Diagnostic Function Descriptor - FPIN Registration */
1116struct fc_df_desc_fpin_reg {
1117        __be32          desc_tag;       /* FPIN Registration (0x00030001) */
1118        __be32          desc_len;       /* Length of Descriptor (in bytes).
1119                                         * Size of descriptor excluding
1120                                         * desc_tag and desc_len fields.
1121                                         */
1122        __be32          count;          /* Number of desc_tags elements */
1123        __be32          desc_tags[0];   /* Array of Descriptor Tags.
1124                                         * Each tag indicates a function
1125                                         * supported by the N_Port (request)
1126                                         * or by the  N_Port and Fabric
1127                                         * Controller (reply; may be a subset
1128                                         * of the request).
1129                                         * See ELS_FN_DTAG_xxx for tag values.
1130                                         */
1131};
1132
1133/*
1134 * ELS_RDF - Register Diagnostic Functions
1135 */
1136struct fc_els_rdf {
1137        __u8            fpin_cmd;       /* command (0x19) */
1138        __u8            fpin_zero[3];   /* specified as zero - part of cmd */
1139        __be32          desc_len;       /* Length of Descriptor List (in bytes).
1140                                         * Size of ELS excluding fpin_cmd,
1141                                         * fpin_zero and desc_len fields.
1142                                         */
1143        struct fc_tlv_desc      desc[0];        /* Descriptor list */
1144};
1145
1146/*
1147 * ELS RDF LS_ACC Response.
1148 */
1149struct fc_els_rdf_resp {
1150        struct fc_els_ls_acc    acc_hdr;
1151        __be32                  desc_list_len;  /* Length of response (in
1152                                                 * bytes). Excludes acc_hdr
1153                                                 * and desc_list_len fields.
1154                                                 */
1155        struct fc_els_lsri_desc lsri;
1156        struct fc_tlv_desc      desc[0];        /* Supported Descriptor list */
1157};
1158
1159
1160#endif /* _FC_ELS_H_ */
1161