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