cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

fc_els.h (38930B)


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