xref: /linux/include/uapi/scsi/fc/fc_els.h (revision 94dfc73e7cf4a31da66b8843f0b9283ddd6b8381)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2cf028200SDavid Howells /*
3cf028200SDavid Howells  * Copyright(c) 2007 Intel Corporation. All rights reserved.
4cf028200SDavid Howells  *
5cf028200SDavid Howells  * Maintained at www.Open-FCoE.org
6cf028200SDavid Howells  */
7cf028200SDavid Howells 
8cf028200SDavid Howells #ifndef _FC_ELS_H_
9cf028200SDavid Howells #define	_FC_ELS_H_
10cf028200SDavid Howells 
11cf028200SDavid Howells #include <linux/types.h>
1273ec6d27SJames Smart #include <asm/byteorder.h>
13cf028200SDavid Howells 
14cf028200SDavid Howells /*
15cf028200SDavid Howells  * Fibre Channel Switch - Enhanced Link Services definitions.
16cf028200SDavid Howells  * From T11 FC-LS Rev 1.2 June 7, 2005.
17cf028200SDavid Howells  */
18cf028200SDavid Howells 
19cf028200SDavid Howells /*
20cf028200SDavid Howells  * ELS Command codes - byte 0 of the frame payload
21cf028200SDavid Howells  */
22cf028200SDavid Howells enum fc_els_cmd {
23cf028200SDavid Howells 	ELS_LS_RJT =	0x01,	/* ESL reject */
24cf028200SDavid Howells 	ELS_LS_ACC =	0x02,	/* ESL Accept */
25cf028200SDavid Howells 	ELS_PLOGI =	0x03,	/* N_Port login */
26cf028200SDavid Howells 	ELS_FLOGI =	0x04,	/* F_Port login */
27cf028200SDavid Howells 	ELS_LOGO =	0x05,	/* Logout */
28cf028200SDavid Howells 	ELS_ABTX =	0x06,	/* Abort exchange - obsolete */
29cf028200SDavid Howells 	ELS_RCS =	0x07,	/* read connection status */
30cf028200SDavid Howells 	ELS_RES =	0x08,	/* read exchange status block */
31cf028200SDavid Howells 	ELS_RSS =	0x09,	/* read sequence status block */
32cf028200SDavid Howells 	ELS_RSI =	0x0a,	/* read sequence initiative */
33cf028200SDavid Howells 	ELS_ESTS =	0x0b,	/* establish streaming */
34cf028200SDavid Howells 	ELS_ESTC =	0x0c,	/* estimate credit */
35cf028200SDavid Howells 	ELS_ADVC =	0x0d,	/* advise credit */
36cf028200SDavid Howells 	ELS_RTV =	0x0e,	/* read timeout value */
37cf028200SDavid Howells 	ELS_RLS =	0x0f,	/* read link error status block */
38cf028200SDavid Howells 	ELS_ECHO =	0x10,	/* echo */
39cf028200SDavid Howells 	ELS_TEST =	0x11,	/* test */
40cf028200SDavid Howells 	ELS_RRQ =	0x12,	/* reinstate recovery qualifier */
41cf028200SDavid Howells 	ELS_REC =	0x13,	/* read exchange concise */
42cf028200SDavid Howells 	ELS_SRR =	0x14,	/* sequence retransmission request */
43a7dff3adSJames Smart 	ELS_FPIN =	0x16,	/* Fabric Performance Impact Notification */
4454404d35SJames Smart 	ELS_EDC =	0x17,	/* Exchange Diagnostic Capabilities */
4562e9dd17SShyam Sundar 	ELS_RDP =	0x18,	/* Read Diagnostic Parameters */
4673ec6d27SJames Smart 	ELS_RDF =	0x19,	/* Register Diagnostic Functions */
47cf028200SDavid Howells 	ELS_PRLI =	0x20,	/* process login */
48cf028200SDavid Howells 	ELS_PRLO =	0x21,	/* process logout */
49cf028200SDavid Howells 	ELS_SCN =	0x22,	/* state change notification */
50cf028200SDavid Howells 	ELS_TPLS =	0x23,	/* test process login state */
51cf028200SDavid Howells 	ELS_TPRLO =	0x24,	/* third party process logout */
52cf028200SDavid Howells 	ELS_LCLM =	0x25,	/* login control list mgmt (obs) */
53cf028200SDavid Howells 	ELS_GAID =	0x30,	/* get alias_ID */
54cf028200SDavid Howells 	ELS_FACT =	0x31,	/* fabric activate alias_id */
55cf028200SDavid Howells 	ELS_FDACDT =	0x32,	/* fabric deactivate alias_id */
56cf028200SDavid Howells 	ELS_NACT =	0x33,	/* N-port activate alias_id */
57cf028200SDavid Howells 	ELS_NDACT =	0x34,	/* N-port deactivate alias_id */
58cf028200SDavid Howells 	ELS_QOSR =	0x40,	/* quality of service request */
59cf028200SDavid Howells 	ELS_RVCS =	0x41,	/* read virtual circuit status */
60cf028200SDavid Howells 	ELS_PDISC =	0x50,	/* discover N_port service params */
61cf028200SDavid Howells 	ELS_FDISC =	0x51,	/* discover F_port service params */
62cf028200SDavid Howells 	ELS_ADISC =	0x52,	/* discover address */
63cf028200SDavid Howells 	ELS_RNC =	0x53,	/* report node cap (obs) */
64cf028200SDavid Howells 	ELS_FARP_REQ =	0x54,	/* FC ARP request */
65cf028200SDavid Howells 	ELS_FARP_REPL =	0x55,	/* FC ARP reply */
66cf028200SDavid Howells 	ELS_RPS =	0x56,	/* read port status block */
67cf028200SDavid Howells 	ELS_RPL =	0x57,	/* read port list */
68cf028200SDavid Howells 	ELS_RPBC =	0x58,	/* read port buffer condition */
69cf028200SDavid Howells 	ELS_FAN =	0x60,	/* fabric address notification */
70cf028200SDavid Howells 	ELS_RSCN =	0x61,	/* registered state change notification */
71cf028200SDavid Howells 	ELS_SCR =	0x62,	/* state change registration */
72cf028200SDavid Howells 	ELS_RNFT =	0x63,	/* report node FC-4 types */
73cf028200SDavid Howells 	ELS_CSR =	0x68,	/* clock synch. request */
74cf028200SDavid Howells 	ELS_CSU =	0x69,	/* clock synch. update */
75cf028200SDavid Howells 	ELS_LINIT =	0x70,	/* loop initialize */
76cf028200SDavid Howells 	ELS_LSTS =	0x72,	/* loop status */
77cf028200SDavid Howells 	ELS_RNID =	0x78,	/* request node ID data */
78cf028200SDavid Howells 	ELS_RLIR =	0x79,	/* registered link incident report */
79cf028200SDavid Howells 	ELS_LIRR =	0x7a,	/* link incident record registration */
80cf028200SDavid Howells 	ELS_SRL =	0x7b,	/* scan remote loop */
81cf028200SDavid Howells 	ELS_SBRP =	0x7c,	/* set bit-error reporting params */
82cf028200SDavid Howells 	ELS_RPSC =	0x7d,	/* report speed capabilities */
83cf028200SDavid Howells 	ELS_QSA =	0x7e,	/* query security attributes */
84cf028200SDavid Howells 	ELS_EVFP =	0x7f,	/* exchange virt. fabrics params */
85cf028200SDavid Howells 	ELS_LKA =	0x80,	/* link keep-alive */
86cf028200SDavid Howells 	ELS_AUTH_ELS =	0x90,	/* authentication ELS */
87cf028200SDavid Howells };
88cf028200SDavid Howells 
89cf028200SDavid Howells /*
90cf028200SDavid Howells  * Initializer useful for decoding table.
91cf028200SDavid Howells  * Please keep this in sync with the above definitions.
92cf028200SDavid Howells  */
93cf028200SDavid Howells #define	FC_ELS_CMDS_INIT {			\
94cf028200SDavid Howells 	[ELS_LS_RJT] =	"LS_RJT",		\
95cf028200SDavid Howells 	[ELS_LS_ACC] =	"LS_ACC",		\
96cf028200SDavid Howells 	[ELS_PLOGI] =	"PLOGI",		\
97cf028200SDavid Howells 	[ELS_FLOGI] =	"FLOGI",		\
98cf028200SDavid Howells 	[ELS_LOGO] =	"LOGO",			\
99cf028200SDavid Howells 	[ELS_ABTX] =	"ABTX",			\
100cf028200SDavid Howells 	[ELS_RCS] =	"RCS",			\
101cf028200SDavid Howells 	[ELS_RES] =	"RES",			\
102cf028200SDavid Howells 	[ELS_RSS] =	"RSS",			\
103cf028200SDavid Howells 	[ELS_RSI] =	"RSI",			\
104cf028200SDavid Howells 	[ELS_ESTS] =	"ESTS",			\
105cf028200SDavid Howells 	[ELS_ESTC] =	"ESTC",			\
106cf028200SDavid Howells 	[ELS_ADVC] =	"ADVC",			\
107cf028200SDavid Howells 	[ELS_RTV] =	"RTV",			\
108cf028200SDavid Howells 	[ELS_RLS] =	"RLS",			\
109cf028200SDavid Howells 	[ELS_ECHO] =	"ECHO",			\
110cf028200SDavid Howells 	[ELS_TEST] =	"TEST",			\
111cf028200SDavid Howells 	[ELS_RRQ] =	"RRQ",			\
112cf028200SDavid Howells 	[ELS_REC] =	"REC",			\
113cf028200SDavid Howells 	[ELS_SRR] =	"SRR",			\
114a7dff3adSJames Smart 	[ELS_FPIN] =	"FPIN",			\
11554404d35SJames Smart 	[ELS_EDC] =	"EDC",			\
11662e9dd17SShyam Sundar 	[ELS_RDP] =	"RDP",			\
11773ec6d27SJames Smart 	[ELS_RDF] =	"RDF",			\
118cf028200SDavid Howells 	[ELS_PRLI] =	"PRLI",			\
119cf028200SDavid Howells 	[ELS_PRLO] =	"PRLO",			\
120cf028200SDavid Howells 	[ELS_SCN] =	"SCN",			\
121cf028200SDavid Howells 	[ELS_TPLS] =	"TPLS",			\
122cf028200SDavid Howells 	[ELS_TPRLO] =	"TPRLO",		\
123cf028200SDavid Howells 	[ELS_LCLM] =	"LCLM",			\
124cf028200SDavid Howells 	[ELS_GAID] =	"GAID",			\
125cf028200SDavid Howells 	[ELS_FACT] =	"FACT",			\
126cf028200SDavid Howells 	[ELS_FDACDT] =	"FDACDT",		\
127cf028200SDavid Howells 	[ELS_NACT] =	"NACT",			\
128cf028200SDavid Howells 	[ELS_NDACT] =	"NDACT",		\
129cf028200SDavid Howells 	[ELS_QOSR] =	"QOSR",			\
130cf028200SDavid Howells 	[ELS_RVCS] =	"RVCS",			\
131cf028200SDavid Howells 	[ELS_PDISC] =	"PDISC",		\
132cf028200SDavid Howells 	[ELS_FDISC] =	"FDISC",		\
133cf028200SDavid Howells 	[ELS_ADISC] =	"ADISC",		\
134cf028200SDavid Howells 	[ELS_RNC] =	"RNC",			\
135cf028200SDavid Howells 	[ELS_FARP_REQ] = "FARP_REQ",		\
136cf028200SDavid Howells 	[ELS_FARP_REPL] =  "FARP_REPL",		\
137cf028200SDavid Howells 	[ELS_RPS] =	"RPS",			\
138cf028200SDavid Howells 	[ELS_RPL] =	"RPL",			\
139cf028200SDavid Howells 	[ELS_RPBC] =	"RPBC",			\
140cf028200SDavid Howells 	[ELS_FAN] =	"FAN",			\
141cf028200SDavid Howells 	[ELS_RSCN] =	"RSCN",			\
142cf028200SDavid Howells 	[ELS_SCR] =	"SCR",			\
143cf028200SDavid Howells 	[ELS_RNFT] =	"RNFT",			\
144cf028200SDavid Howells 	[ELS_CSR] =	"CSR",			\
145cf028200SDavid Howells 	[ELS_CSU] =	"CSU",			\
146cf028200SDavid Howells 	[ELS_LINIT] =	"LINIT",		\
147cf028200SDavid Howells 	[ELS_LSTS] =	"LSTS",			\
148cf028200SDavid Howells 	[ELS_RNID] =	"RNID",			\
149cf028200SDavid Howells 	[ELS_RLIR] =	"RLIR",			\
150cf028200SDavid Howells 	[ELS_LIRR] =	"LIRR",			\
151cf028200SDavid Howells 	[ELS_SRL] =	"SRL",			\
152cf028200SDavid Howells 	[ELS_SBRP] =	"SBRP",			\
153cf028200SDavid Howells 	[ELS_RPSC] =	"RPSC",			\
154cf028200SDavid Howells 	[ELS_QSA] =	"QSA",			\
155cf028200SDavid Howells 	[ELS_EVFP] =	"EVFP",			\
156cf028200SDavid Howells 	[ELS_LKA] =	"LKA",			\
157cf028200SDavid Howells 	[ELS_AUTH_ELS] = "AUTH_ELS",		\
158cf028200SDavid Howells }
159cf028200SDavid Howells 
160cf028200SDavid Howells /*
161cf028200SDavid Howells  * LS_ACC payload.
162cf028200SDavid Howells  */
163cf028200SDavid Howells struct fc_els_ls_acc {
164cf028200SDavid Howells 	__u8          la_cmd;		/* command code ELS_LS_ACC */
165cf028200SDavid Howells 	__u8          la_resv[3];	/* reserved */
166cf028200SDavid Howells };
167cf028200SDavid Howells 
168cf028200SDavid Howells /*
169cf028200SDavid Howells  * ELS reject payload.
170cf028200SDavid Howells  */
171cf028200SDavid Howells struct fc_els_ls_rjt {
172cf028200SDavid Howells 	__u8	er_cmd;		/* command code ELS_LS_RJT */
173cf028200SDavid Howells 	__u8	er_resv[4];	/* reserved must be zero */
174cf028200SDavid Howells 	__u8	er_reason;	/* reason (enum fc_els_rjt_reason below) */
175cf028200SDavid Howells 	__u8	er_explan;	/* explanation (enum fc_els_rjt_explan below) */
176cf028200SDavid Howells 	__u8	er_vendor;	/* vendor specific code */
177cf028200SDavid Howells };
178cf028200SDavid Howells 
179cf028200SDavid Howells /*
180cf028200SDavid Howells  * ELS reject reason codes (er_reason).
181cf028200SDavid Howells  */
182cf028200SDavid Howells enum fc_els_rjt_reason {
183cf028200SDavid Howells 	ELS_RJT_NONE =		0,	/* no reject - not to be sent */
184cf028200SDavid Howells 	ELS_RJT_INVAL =		0x01,	/* invalid ELS command code */
185cf028200SDavid Howells 	ELS_RJT_LOGIC =		0x03,	/* logical error */
186cf028200SDavid Howells 	ELS_RJT_BUSY =		0x05,	/* logical busy */
187cf028200SDavid Howells 	ELS_RJT_PROT =		0x07,	/* protocol error */
188cf028200SDavid Howells 	ELS_RJT_UNAB =		0x09,	/* unable to perform command request */
189cf028200SDavid Howells 	ELS_RJT_UNSUP =		0x0b,	/* command not supported */
190cf028200SDavid Howells 	ELS_RJT_INPROG =	0x0e,	/* command already in progress */
191cf028200SDavid Howells 	ELS_RJT_FIP =		0x20,	/* FIP error */
192cf028200SDavid Howells 	ELS_RJT_VENDOR =	0xff,	/* vendor specific error */
193cf028200SDavid Howells };
194cf028200SDavid Howells 
195cf028200SDavid Howells 
196cf028200SDavid Howells /*
197cf028200SDavid Howells  * reason code explanation (er_explan).
198cf028200SDavid Howells  */
199cf028200SDavid Howells enum fc_els_rjt_explan {
200cf028200SDavid Howells 	ELS_EXPL_NONE =		0x00,	/* No additional explanation */
201cf028200SDavid Howells 	ELS_EXPL_SPP_OPT_ERR =	0x01,	/* service parameter error - options */
202cf028200SDavid Howells 	ELS_EXPL_SPP_ICTL_ERR =	0x03,	/* service parm error - initiator ctl */
203cf028200SDavid Howells 	ELS_EXPL_AH =		0x11,	/* invalid association header */
204cf028200SDavid Howells 	ELS_EXPL_AH_REQ =	0x13,	/* association_header required */
205cf028200SDavid Howells 	ELS_EXPL_SID =		0x15,	/* invalid originator S_ID */
206cf028200SDavid Howells 	ELS_EXPL_OXID_RXID =	0x17,	/* invalid OX_ID-RX_ID combination */
207cf028200SDavid Howells 	ELS_EXPL_INPROG =	0x19,	/* Request already in progress */
208cf028200SDavid Howells 	ELS_EXPL_PLOGI_REQD =	0x1e,	/* N_Port login required */
209cf028200SDavid Howells 	ELS_EXPL_INSUF_RES =	0x29,	/* insufficient resources */
210cf028200SDavid Howells 	ELS_EXPL_UNAB_DATA =	0x2a,	/* unable to supply requested data */
211cf028200SDavid Howells 	ELS_EXPL_UNSUPR =	0x2c,	/* Request not supported */
212cf028200SDavid Howells 	ELS_EXPL_INV_LEN =	0x2d,	/* Invalid payload length */
213cf028200SDavid Howells 	ELS_EXPL_NOT_NEIGHBOR = 0x62,	/* VN2VN_Port not in neighbor set */
214cf028200SDavid Howells 	/* TBD - above definitions incomplete */
215cf028200SDavid Howells };
216cf028200SDavid Howells 
217cf028200SDavid Howells /*
21873ec6d27SJames Smart  * Link Service TLV Descriptor Tag Values
21973ec6d27SJames Smart  */
22073ec6d27SJames Smart enum fc_ls_tlv_dtag {
22173ec6d27SJames Smart 	ELS_DTAG_LS_REQ_INFO =		0x00000001,
22273ec6d27SJames Smart 		/* Link Service Request Information Descriptor */
22354404d35SJames Smart 	ELS_DTAG_LNK_FAULT_CAP =	0x0001000D,
22454404d35SJames Smart 		/* Link Fault Capability Descriptor */
22554404d35SJames Smart 	ELS_DTAG_CG_SIGNAL_CAP =	0x0001000F,
22654404d35SJames Smart 		/* Congestion Signaling Capability Descriptor */
22773ec6d27SJames Smart 	ELS_DTAG_LNK_INTEGRITY =	0x00020001,
22873ec6d27SJames Smart 		/* Link Integrity Notification Descriptor */
22973ec6d27SJames Smart 	ELS_DTAG_DELIVERY =		0x00020002,
23073ec6d27SJames Smart 		/* Delivery Notification Descriptor */
23173ec6d27SJames Smart 	ELS_DTAG_PEER_CONGEST =		0x00020003,
23273ec6d27SJames Smart 		/* Peer Congestion Notification Descriptor */
23373ec6d27SJames Smart 	ELS_DTAG_CONGESTION =		0x00020004,
23473ec6d27SJames Smart 		/* Congestion Notification Descriptor */
23573ec6d27SJames Smart 	ELS_DTAG_FPIN_REGISTER =	0x00030001,
23673ec6d27SJames Smart 		/* FPIN Registration Descriptor */
23773ec6d27SJames Smart };
23873ec6d27SJames Smart 
23973ec6d27SJames Smart /*
24073ec6d27SJames Smart  * Initializer useful for decoding table.
24173ec6d27SJames Smart  * Please keep this in sync with the above definitions.
24273ec6d27SJames Smart  */
24373ec6d27SJames Smart #define FC_LS_TLV_DTAG_INIT {					      \
24473ec6d27SJames Smart 	{ ELS_DTAG_LS_REQ_INFO,		"Link Service Request Information" }, \
24554404d35SJames Smart 	{ ELS_DTAG_LNK_FAULT_CAP,	"Link Fault Capability" },	      \
24654404d35SJames Smart 	{ ELS_DTAG_CG_SIGNAL_CAP,	"Congestion Signaling Capability" },  \
24773ec6d27SJames Smart 	{ ELS_DTAG_LNK_INTEGRITY,	"Link Integrity Notification" },      \
24873ec6d27SJames Smart 	{ ELS_DTAG_DELIVERY,		"Delivery Notification Present" },    \
24973ec6d27SJames Smart 	{ ELS_DTAG_PEER_CONGEST,	"Peer Congestion Notification" },     \
25073ec6d27SJames Smart 	{ ELS_DTAG_CONGESTION,		"Congestion Notification" },	      \
25173ec6d27SJames Smart 	{ ELS_DTAG_FPIN_REGISTER,	"FPIN Registration" },		      \
25273ec6d27SJames Smart }
25373ec6d27SJames Smart 
25473ec6d27SJames Smart 
25573ec6d27SJames Smart /*
25673ec6d27SJames Smart  * Generic Link Service TLV Descriptor format
25773ec6d27SJames Smart  *
25873ec6d27SJames Smart  * This structure, as it defines no payload, will also be referred to
25973ec6d27SJames Smart  * as the "tlv header" - which contains the tag and len fields.
26073ec6d27SJames Smart  */
26173ec6d27SJames Smart struct fc_tlv_desc {
26273ec6d27SJames Smart 	__be32		desc_tag;	/* Notification Descriptor Tag */
26373ec6d27SJames Smart 	__be32		desc_len;	/* Length of Descriptor (in bytes).
26473ec6d27SJames Smart 					 * Size of descriptor excluding
26573ec6d27SJames Smart 					 * desc_tag and desc_len fields.
26673ec6d27SJames Smart 					 */
267*94dfc73eSGustavo A. R. Silva 	__u8		desc_value[];  /* Descriptor Value */
26873ec6d27SJames Smart };
26973ec6d27SJames Smart 
27073ec6d27SJames Smart /* Descriptor tag and len fields are considered the mandatory header
27173ec6d27SJames Smart  * for a descriptor
27273ec6d27SJames Smart  */
27373ec6d27SJames Smart #define FC_TLV_DESC_HDR_SZ	sizeof(struct fc_tlv_desc)
27473ec6d27SJames Smart 
27573ec6d27SJames Smart /*
27673ec6d27SJames Smart  * Macro, used when initializing payloads, to return the descriptor length.
27773ec6d27SJames Smart  * Length is size of descriptor minus the tag and len fields.
27873ec6d27SJames Smart  */
27973ec6d27SJames Smart #define FC_TLV_DESC_LENGTH_FROM_SZ(desc)	\
28073ec6d27SJames Smart 		(sizeof(desc) - FC_TLV_DESC_HDR_SZ)
28173ec6d27SJames Smart 
28273ec6d27SJames Smart /* Macro, used on received payloads, to return the descriptor length */
28373ec6d27SJames Smart #define FC_TLV_DESC_SZ_FROM_LENGTH(tlv)		\
28473ec6d27SJames Smart 		(__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ)
28573ec6d27SJames Smart 
28673ec6d27SJames Smart /*
28773ec6d27SJames Smart  * This helper is used to walk descriptors in a descriptor list.
28873ec6d27SJames Smart  * Given the address of the current descriptor, which minimally contains a
28973ec6d27SJames Smart  * tag and len field, calculate the address of the next descriptor based
29073ec6d27SJames Smart  * on the len field.
29173ec6d27SJames Smart  */
29273ec6d27SJames Smart static inline void *fc_tlv_next_desc(void *desc)
29373ec6d27SJames Smart {
29473ec6d27SJames Smart 	struct fc_tlv_desc *tlv = desc;
29573ec6d27SJames Smart 
29673ec6d27SJames Smart 	return (desc + FC_TLV_DESC_SZ_FROM_LENGTH(tlv));
29773ec6d27SJames Smart }
29873ec6d27SJames Smart 
29973ec6d27SJames Smart 
30073ec6d27SJames Smart /*
30173ec6d27SJames Smart  * Link Service Request Information Descriptor
30273ec6d27SJames Smart  */
30373ec6d27SJames Smart struct fc_els_lsri_desc {
30473ec6d27SJames Smart 	__be32		desc_tag;	/* descriptor tag (0x0000 0001) */
30573ec6d27SJames Smart 	__be32		desc_len;	/* Length of Descriptor (in bytes) (4).
30673ec6d27SJames Smart 					 * Size of descriptor excluding
30773ec6d27SJames Smart 					 * desc_tag and desc_len fields.
30873ec6d27SJames Smart 					 */
30973ec6d27SJames Smart 	struct {
31073ec6d27SJames Smart 		__u8	cmd;		/* ELS cmd byte */
31173ec6d27SJames Smart 		__u8	bytes[3];	/* bytes 1..3 */
31273ec6d27SJames Smart 	} rqst_w0;			/* Request word 0 */
31373ec6d27SJames Smart };
31473ec6d27SJames Smart 
31573ec6d27SJames Smart 
31673ec6d27SJames Smart /*
317cf028200SDavid Howells  * Common service parameters (N ports).
318cf028200SDavid Howells  */
319cf028200SDavid Howells struct fc_els_csp {
320cf028200SDavid Howells 	__u8		sp_hi_ver;	/* highest version supported (obs.) */
321cf028200SDavid Howells 	__u8		sp_lo_ver;	/* highest version supported (obs.) */
322cf028200SDavid Howells 	__be16		sp_bb_cred;	/* buffer-to-buffer credits */
323cf028200SDavid Howells 	__be16		sp_features;	/* common feature flags */
324cf028200SDavid Howells 	__be16		sp_bb_data;	/* b-b state number and data field sz */
325cf028200SDavid Howells 	union {
326cf028200SDavid Howells 		struct {
327cf028200SDavid Howells 			__be16	_sp_tot_seq; /* total concurrent sequences */
328cf028200SDavid Howells 			__be16	_sp_rel_off; /* rel. offset by info cat */
329cf028200SDavid Howells 		} sp_plogi;
330cf028200SDavid Howells 		struct {
331cf028200SDavid Howells 			__be32	_sp_r_a_tov; /* resource alloc. timeout msec */
332cf028200SDavid Howells 		} sp_flogi_acc;
333cf028200SDavid Howells 	} sp_u;
334cf028200SDavid Howells 	__be32		sp_e_d_tov;	/* error detect timeout value */
335cf028200SDavid Howells };
336cf028200SDavid Howells #define	sp_tot_seq	sp_u.sp_plogi._sp_tot_seq
337cf028200SDavid Howells #define	sp_rel_off	sp_u.sp_plogi._sp_rel_off
338cf028200SDavid Howells #define	sp_r_a_tov	sp_u.sp_flogi_acc._sp_r_a_tov
339cf028200SDavid Howells 
340cf028200SDavid Howells #define	FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */
341cf028200SDavid Howells 
342cf028200SDavid Howells /*
343cf028200SDavid Howells  * Minimum and maximum values for max data field size in service parameters.
344cf028200SDavid Howells  */
345cf028200SDavid Howells #define	FC_SP_MIN_MAX_PAYLOAD	FC_MIN_MAX_PAYLOAD
346cf028200SDavid Howells #define	FC_SP_MAX_MAX_PAYLOAD	FC_MAX_PAYLOAD
347cf028200SDavid Howells 
348cf028200SDavid Howells /*
349cf028200SDavid Howells  * sp_features
350cf028200SDavid Howells  */
351cf028200SDavid Howells #define	FC_SP_FT_NPIV	0x8000	/* multiple N_Port_ID support (FLOGI) */
352cf028200SDavid Howells #define	FC_SP_FT_CIRO	0x8000	/* continuously increasing rel off (PLOGI) */
353cf028200SDavid Howells #define	FC_SP_FT_CLAD	0x8000	/* clean address (in FLOGI LS_ACC) */
354cf028200SDavid Howells #define	FC_SP_FT_RAND	0x4000	/* random relative offset */
355cf028200SDavid Howells #define	FC_SP_FT_VAL	0x2000	/* valid vendor version level */
356cf028200SDavid Howells #define	FC_SP_FT_NPIV_ACC	0x2000	/* NPIV assignment (FLOGI LS_ACC) */
357cf028200SDavid Howells #define	FC_SP_FT_FPORT	0x1000	/* F port (1) vs. N port (0) */
358cf028200SDavid Howells #define	FC_SP_FT_ABB	0x0800	/* alternate BB_credit management */
359cf028200SDavid Howells #define	FC_SP_FT_EDTR	0x0400	/* E_D_TOV Resolution is nanoseconds */
360cf028200SDavid Howells #define	FC_SP_FT_MCAST	0x0200	/* multicast */
361cf028200SDavid Howells #define	FC_SP_FT_BCAST	0x0100	/* broadcast */
362cf028200SDavid Howells #define	FC_SP_FT_HUNT	0x0080	/* hunt group */
363cf028200SDavid Howells #define	FC_SP_FT_SIMP	0x0040	/* dedicated simplex */
364cf028200SDavid Howells #define	FC_SP_FT_SEC	0x0020	/* reserved for security */
365cf028200SDavid Howells #define	FC_SP_FT_CSYN	0x0010	/* clock synch. supported */
366cf028200SDavid Howells #define	FC_SP_FT_RTTOV	0x0008	/* R_T_TOV value 100 uS, else 100 mS */
367cf028200SDavid Howells #define	FC_SP_FT_HALF	0x0004	/* dynamic half duplex */
368cf028200SDavid Howells #define	FC_SP_FT_SEQC	0x0002	/* SEQ_CNT */
369cf028200SDavid Howells #define	FC_SP_FT_PAYL	0x0001	/* FLOGI payload length 256, else 116 */
370cf028200SDavid Howells 
371cf028200SDavid Howells /*
372cf028200SDavid Howells  * Class-specific service parameters.
373cf028200SDavid Howells  */
374cf028200SDavid Howells struct fc_els_cssp {
375cf028200SDavid Howells 	__be16		cp_class;	/* class flags */
376cf028200SDavid Howells 	__be16		cp_init;	/* initiator flags */
377cf028200SDavid Howells 	__be16		cp_recip;	/* recipient flags */
378cf028200SDavid Howells 	__be16		cp_rdfs;	/* receive data field size */
379cf028200SDavid Howells 	__be16		cp_con_seq;	/* concurrent sequences */
380cf028200SDavid Howells 	__be16		cp_ee_cred;	/* N-port end-to-end credit */
381cf028200SDavid Howells 	__u8		cp_resv1;	/* reserved */
382cf028200SDavid Howells 	__u8		cp_open_seq;	/* open sequences per exchange */
383cf028200SDavid Howells 	__u8		_cp_resv2[2];	/* reserved */
384cf028200SDavid Howells };
385cf028200SDavid Howells 
386cf028200SDavid Howells /*
387cf028200SDavid Howells  * cp_class flags.
388cf028200SDavid Howells  */
389cf028200SDavid Howells #define	FC_CPC_VALID	0x8000		/* class valid */
390cf028200SDavid Howells #define	FC_CPC_IMIX	0x4000		/* intermix mode */
391cf028200SDavid Howells #define	FC_CPC_SEQ	0x0800		/* sequential delivery */
392cf028200SDavid Howells #define	FC_CPC_CAMP	0x0200		/* camp-on */
393cf028200SDavid Howells #define	FC_CPC_PRI	0x0080		/* priority */
394cf028200SDavid Howells 
395cf028200SDavid Howells /*
396cf028200SDavid Howells  * cp_init flags.
397cf028200SDavid Howells  * (TBD: not all flags defined here).
398cf028200SDavid Howells  */
399cf028200SDavid Howells #define	FC_CPI_CSYN	0x0010		/* clock synch. capable */
400cf028200SDavid Howells 
401cf028200SDavid Howells /*
402cf028200SDavid Howells  * cp_recip flags.
403cf028200SDavid Howells  */
404cf028200SDavid Howells #define	FC_CPR_CSYN	0x0008		/* clock synch. capable */
405cf028200SDavid Howells 
406cf028200SDavid Howells /*
407cf028200SDavid Howells  * NFC_ELS_FLOGI: Fabric login request.
408cf028200SDavid Howells  * NFC_ELS_PLOGI: Port login request (same format).
409cf028200SDavid Howells  */
410cf028200SDavid Howells struct fc_els_flogi {
411cf028200SDavid Howells 	__u8		fl_cmd;		/* command */
412cf028200SDavid Howells 	__u8		_fl_resvd[3];	/* must be zero */
413cf028200SDavid Howells 	struct fc_els_csp fl_csp;	/* common service parameters */
414cf028200SDavid Howells 	__be64		fl_wwpn;	/* port name */
415cf028200SDavid Howells 	__be64		fl_wwnn;	/* node name */
416cf028200SDavid Howells 	struct fc_els_cssp fl_cssp[4];	/* class 1-4 service parameters */
417cf028200SDavid Howells 	__u8		fl_vend[16];	/* vendor version level */
418cf028200SDavid Howells } __attribute__((__packed__));
419cf028200SDavid Howells 
420cf028200SDavid Howells /*
421cf028200SDavid Howells  * Process login service parameter page.
422cf028200SDavid Howells  */
423cf028200SDavid Howells struct fc_els_spp {
424cf028200SDavid Howells 	__u8		spp_type;	/* type code or common service params */
425cf028200SDavid Howells 	__u8		spp_type_ext;	/* type code extension */
426cf028200SDavid Howells 	__u8		spp_flags;
427cf028200SDavid Howells 	__u8		_spp_resvd;
428cf028200SDavid Howells 	__be32		spp_orig_pa;	/* originator process associator */
429cf028200SDavid Howells 	__be32		spp_resp_pa;	/* responder process associator */
430cf028200SDavid Howells 	__be32		spp_params;	/* service parameters */
431cf028200SDavid Howells };
432cf028200SDavid Howells 
433cf028200SDavid Howells /*
434cf028200SDavid Howells  * spp_flags.
435cf028200SDavid Howells  */
436cf028200SDavid Howells #define	FC_SPP_OPA_VAL	    0x80	/* originator proc. assoc. valid */
437cf028200SDavid Howells #define	FC_SPP_RPA_VAL	    0x40	/* responder proc. assoc. valid */
438cf028200SDavid Howells #define	FC_SPP_EST_IMG_PAIR 0x20	/* establish image pair */
439cf028200SDavid Howells #define	FC_SPP_RESP_MASK    0x0f	/* mask for response code (below) */
440cf028200SDavid Howells 
441cf028200SDavid Howells /*
442cf028200SDavid Howells  * SPP response code in spp_flags - lower 4 bits.
443cf028200SDavid Howells  */
444cf028200SDavid Howells enum fc_els_spp_resp {
445cf028200SDavid Howells 	FC_SPP_RESP_ACK	=	1,	/* request executed */
446cf028200SDavid Howells 	FC_SPP_RESP_RES =	2,	/* unable due to lack of resources */
447cf028200SDavid Howells 	FC_SPP_RESP_INIT =	3,	/* initialization not complete */
448cf028200SDavid Howells 	FC_SPP_RESP_NO_PA = 	4,	/* unknown process associator */
449cf028200SDavid Howells 	FC_SPP_RESP_CONF = 	5,	/* configuration precludes image pair */
450cf028200SDavid Howells 	FC_SPP_RESP_COND = 	6,	/* request completed conditionally */
451cf028200SDavid Howells 	FC_SPP_RESP_MULT = 	7,	/* unable to handle multiple SPPs */
452cf028200SDavid Howells 	FC_SPP_RESP_INVL = 	8,	/* SPP is invalid */
453cf028200SDavid Howells };
454cf028200SDavid Howells 
455cf028200SDavid Howells /*
456cf028200SDavid Howells  * ELS_RRQ - Reinstate Recovery Qualifier
457cf028200SDavid Howells  */
458cf028200SDavid Howells struct fc_els_rrq {
459cf028200SDavid Howells 	__u8		rrq_cmd;	/* command (0x12) */
460cf028200SDavid Howells 	__u8		rrq_zero[3];	/* specified as zero - part of cmd */
461cf028200SDavid Howells 	__u8		rrq_resvd;	/* reserved */
462cf028200SDavid Howells 	__u8		rrq_s_id[3];	/* originator FID */
463cf028200SDavid Howells 	__be16		rrq_ox_id;	/* originator exchange ID */
464cf028200SDavid Howells 	__be16		rrq_rx_id;	/* responders exchange ID */
465cf028200SDavid Howells };
466cf028200SDavid Howells 
467cf028200SDavid Howells /*
468cf028200SDavid Howells  * ELS_REC - Read exchange concise.
469cf028200SDavid Howells  */
470cf028200SDavid Howells struct fc_els_rec {
471cf028200SDavid Howells 	__u8		rec_cmd;	/* command (0x13) */
472cf028200SDavid Howells 	__u8		rec_zero[3];	/* specified as zero - part of cmd */
473cf028200SDavid Howells 	__u8		rec_resvd;	/* reserved */
474cf028200SDavid Howells 	__u8		rec_s_id[3];	/* originator FID */
475cf028200SDavid Howells 	__be16		rec_ox_id;	/* originator exchange ID */
476cf028200SDavid Howells 	__be16		rec_rx_id;	/* responders exchange ID */
477cf028200SDavid Howells };
478cf028200SDavid Howells 
479cf028200SDavid Howells /*
480cf028200SDavid Howells  * ELS_REC LS_ACC payload.
481cf028200SDavid Howells  */
482cf028200SDavid Howells struct fc_els_rec_acc {
483cf028200SDavid Howells 	__u8		reca_cmd;	/* accept (0x02) */
484cf028200SDavid Howells 	__u8		reca_zero[3];	/* specified as zero - part of cmd */
485cf028200SDavid Howells 	__be16		reca_ox_id;	/* originator exchange ID */
486cf028200SDavid Howells 	__be16		reca_rx_id;	/* responders exchange ID */
487cf028200SDavid Howells 	__u8		reca_resvd1;	/* reserved */
488cf028200SDavid Howells 	__u8		reca_ofid[3];	/* originator FID */
489cf028200SDavid Howells 	__u8		reca_resvd2;	/* reserved */
490cf028200SDavid Howells 	__u8		reca_rfid[3];	/* responder FID */
491cf028200SDavid Howells 	__be32		reca_fc4value;	/* FC4 value */
492cf028200SDavid Howells 	__be32		reca_e_stat;	/* ESB (exchange status block) status */
493cf028200SDavid Howells };
494cf028200SDavid Howells 
495cf028200SDavid Howells /*
496cf028200SDavid Howells  * ELS_PRLI - Process login request and response.
497cf028200SDavid Howells  */
498cf028200SDavid Howells struct fc_els_prli {
499cf028200SDavid Howells 	__u8		prli_cmd;	/* command */
500cf028200SDavid Howells 	__u8		prli_spp_len;	/* length of each serv. parm. page */
501cf028200SDavid Howells 	__be16		prli_len;	/* length of entire payload */
502cf028200SDavid Howells 	/* service parameter pages follow */
503cf028200SDavid Howells };
504cf028200SDavid Howells 
505cf028200SDavid Howells /*
506cf028200SDavid Howells  * ELS_PRLO - Process logout request and response.
507cf028200SDavid Howells  */
508cf028200SDavid Howells struct fc_els_prlo {
509cf028200SDavid Howells 	__u8            prlo_cmd;       /* command */
510cf028200SDavid Howells 	__u8            prlo_obs;       /* obsolete, but shall be set to 10h */
511cf028200SDavid Howells 	__be16          prlo_len;       /* payload length */
512cf028200SDavid Howells };
513cf028200SDavid Howells 
514cf028200SDavid Howells /*
515cf028200SDavid Howells  * ELS_ADISC payload
516cf028200SDavid Howells  */
517cf028200SDavid Howells struct fc_els_adisc {
518cf028200SDavid Howells 	__u8		adisc_cmd;
519cf028200SDavid Howells 	__u8		adisc_resv[3];
520cf028200SDavid Howells 	__u8            adisc_resv1;
521cf028200SDavid Howells 	__u8            adisc_hard_addr[3];
522cf028200SDavid Howells 	__be64          adisc_wwpn;
523cf028200SDavid Howells 	__be64          adisc_wwnn;
524cf028200SDavid Howells 	__u8            adisc_resv2;
525cf028200SDavid Howells 	__u8            adisc_port_id[3];
526cf028200SDavid Howells } __attribute__((__packed__));
527cf028200SDavid Howells 
528cf028200SDavid Howells /*
529cf028200SDavid Howells  * ELS_LOGO - process or fabric logout.
530cf028200SDavid Howells  */
531cf028200SDavid Howells struct fc_els_logo {
532cf028200SDavid Howells 	__u8		fl_cmd;		/* command code */
533cf028200SDavid Howells 	__u8		fl_zero[3];	/* specified as zero - part of cmd */
534cf028200SDavid Howells 	__u8		fl_resvd;	/* reserved */
535cf028200SDavid Howells 	__u8		fl_n_port_id[3];/* N port ID */
536cf028200SDavid Howells 	__be64		fl_n_port_wwn;	/* port name */
537cf028200SDavid Howells };
538cf028200SDavid Howells 
539cf028200SDavid Howells /*
540cf028200SDavid Howells  * ELS_RTV - read timeout value.
541cf028200SDavid Howells  */
542cf028200SDavid Howells struct fc_els_rtv {
543cf028200SDavid Howells 	__u8		rtv_cmd;	/* command code 0x0e */
544cf028200SDavid Howells 	__u8		rtv_zero[3];	/* specified as zero - part of cmd */
545cf028200SDavid Howells };
546cf028200SDavid Howells 
547cf028200SDavid Howells /*
548cf028200SDavid Howells  * LS_ACC for ELS_RTV - read timeout value.
549cf028200SDavid Howells  */
550cf028200SDavid Howells struct fc_els_rtv_acc {
551cf028200SDavid Howells 	__u8		rtv_cmd;	/* command code 0x02 */
552cf028200SDavid Howells 	__u8		rtv_zero[3];	/* specified as zero - part of cmd */
553cf028200SDavid Howells 	__be32		rtv_r_a_tov;	/* resource allocation timeout value */
554cf028200SDavid Howells 	__be32		rtv_e_d_tov;	/* error detection timeout value */
555cf028200SDavid Howells 	__be32		rtv_toq;	/* timeout qualifier (see below) */
556cf028200SDavid Howells };
557cf028200SDavid Howells 
558cf028200SDavid Howells /*
559cf028200SDavid Howells  * rtv_toq bits.
560cf028200SDavid Howells  */
561cf028200SDavid Howells #define	FC_ELS_RTV_EDRES (1 << 26)	/* E_D_TOV resolution is nS else mS */
562cf028200SDavid Howells #define	FC_ELS_RTV_RTTOV (1 << 19)	/* R_T_TOV is 100 uS else 100 mS */
563cf028200SDavid Howells 
564cf028200SDavid Howells /*
565cf028200SDavid Howells  * ELS_SCR - state change registration payload.
566cf028200SDavid Howells  */
567cf028200SDavid Howells struct fc_els_scr {
568cf028200SDavid Howells 	__u8		scr_cmd;	/* command code */
569cf028200SDavid Howells 	__u8		scr_resv[6];	/* reserved */
570cf028200SDavid Howells 	__u8		scr_reg_func;	/* registration function (see below) */
571cf028200SDavid Howells };
572cf028200SDavid Howells 
573cf028200SDavid Howells enum fc_els_scr_func {
574cf028200SDavid Howells 	ELS_SCRF_FAB =	1,	/* fabric-detected registration */
575cf028200SDavid Howells 	ELS_SCRF_NPORT = 2,	/* Nx_Port-detected registration */
576cf028200SDavid Howells 	ELS_SCRF_FULL =	3,	/* full registration */
577cf028200SDavid Howells 	ELS_SCRF_CLEAR = 255,	/* remove any current registrations */
578cf028200SDavid Howells };
579cf028200SDavid Howells 
580cf028200SDavid Howells /*
581cf028200SDavid Howells  * ELS_RSCN - registered state change notification payload.
582cf028200SDavid Howells  */
583cf028200SDavid Howells struct fc_els_rscn {
584cf028200SDavid Howells 	__u8		rscn_cmd;	/* RSCN opcode (0x61) */
585cf028200SDavid Howells 	__u8		rscn_page_len;	/* page length (4) */
586cf028200SDavid Howells 	__be16		rscn_plen;	/* payload length including this word */
587cf028200SDavid Howells 
588cf028200SDavid Howells 	/* followed by 4-byte generic affected Port_ID pages */
589cf028200SDavid Howells };
590cf028200SDavid Howells 
591cf028200SDavid Howells struct fc_els_rscn_page {
592cf028200SDavid Howells 	__u8		rscn_page_flags; /* event and address format */
593cf028200SDavid Howells 	__u8		rscn_fid[3];	/* fabric ID */
594cf028200SDavid Howells };
595cf028200SDavid Howells 
596cf028200SDavid Howells #define	ELS_RSCN_EV_QUAL_BIT	2	/* shift count for event qualifier */
597cf028200SDavid Howells #define	ELS_RSCN_EV_QUAL_MASK	0xf	/* mask for event qualifier */
598cf028200SDavid Howells #define	ELS_RSCN_ADDR_FMT_BIT	0	/* shift count for address format */
599cf028200SDavid Howells #define	ELS_RSCN_ADDR_FMT_MASK	0x3	/* mask for address format */
600cf028200SDavid Howells 
601cf028200SDavid Howells enum fc_els_rscn_ev_qual {
602cf028200SDavid Howells 	ELS_EV_QUAL_NONE = 0,		/* unspecified */
603cf028200SDavid Howells 	ELS_EV_QUAL_NS_OBJ = 1,		/* changed name server object */
604cf028200SDavid Howells 	ELS_EV_QUAL_PORT_ATTR = 2,	/* changed port attribute */
605cf028200SDavid Howells 	ELS_EV_QUAL_SERV_OBJ = 3,	/* changed service object */
606cf028200SDavid Howells 	ELS_EV_QUAL_SW_CONFIG = 4,	/* changed switch configuration */
607cf028200SDavid Howells 	ELS_EV_QUAL_REM_OBJ = 5,	/* removed object */
608cf028200SDavid Howells };
609cf028200SDavid Howells 
610cf028200SDavid Howells enum fc_els_rscn_addr_fmt {
611cf028200SDavid Howells 	ELS_ADDR_FMT_PORT = 0,	/* rscn_fid is a port address */
612cf028200SDavid Howells 	ELS_ADDR_FMT_AREA = 1,	/* rscn_fid is a area address */
613cf028200SDavid Howells 	ELS_ADDR_FMT_DOM = 2,	/* rscn_fid is a domain address */
614cf028200SDavid Howells 	ELS_ADDR_FMT_FAB = 3,	/* anything on fabric may have changed */
615cf028200SDavid Howells };
616cf028200SDavid Howells 
617cf028200SDavid Howells /*
618cf028200SDavid Howells  * ELS_RNID - request Node ID.
619cf028200SDavid Howells  */
620cf028200SDavid Howells struct fc_els_rnid {
621cf028200SDavid Howells 	__u8		rnid_cmd;	/* RNID opcode (0x78) */
622cf028200SDavid Howells 	__u8		rnid_resv[3];	/* reserved */
623cf028200SDavid Howells 	__u8		rnid_fmt;	/* data format */
624cf028200SDavid Howells 	__u8		rnid_resv2[3];	/* reserved */
625cf028200SDavid Howells };
626cf028200SDavid Howells 
627cf028200SDavid Howells /*
628cf028200SDavid Howells  * Node Identification Data formats (rnid_fmt)
629cf028200SDavid Howells  */
630cf028200SDavid Howells enum fc_els_rnid_fmt {
631cf028200SDavid Howells 	ELS_RNIDF_NONE = 0,		/* no specific identification data */
632cf028200SDavid Howells 	ELS_RNIDF_GEN = 0xdf,		/* general topology discovery format */
633cf028200SDavid Howells };
634cf028200SDavid Howells 
635cf028200SDavid Howells /*
636cf028200SDavid Howells  * ELS_RNID response.
637cf028200SDavid Howells  */
638cf028200SDavid Howells struct fc_els_rnid_resp {
639cf028200SDavid Howells 	__u8		rnid_cmd;	/* response code (LS_ACC) */
640cf028200SDavid Howells 	__u8		rnid_resv[3];	/* reserved */
641cf028200SDavid Howells 	__u8		rnid_fmt;	/* data format */
642cf028200SDavid Howells 	__u8		rnid_cid_len;	/* common ID data length */
643cf028200SDavid Howells 	__u8		rnid_resv2;	/* reserved */
644cf028200SDavid Howells 	__u8		rnid_sid_len;	/* specific ID data length */
645cf028200SDavid Howells };
646cf028200SDavid Howells 
647cf028200SDavid Howells struct fc_els_rnid_cid {
648cf028200SDavid Howells 	__be64		rnid_wwpn;	/* N port name */
649cf028200SDavid Howells 	__be64		rnid_wwnn;	/* node name */
650cf028200SDavid Howells };
651cf028200SDavid Howells 
652cf028200SDavid Howells struct fc_els_rnid_gen {
653cf028200SDavid Howells 	__u8		rnid_vend_id[16]; /* vendor-unique ID */
654cf028200SDavid Howells 	__be32		rnid_atype;	/* associated type (see below) */
655cf028200SDavid Howells 	__be32		rnid_phys_port;	/* physical port number */
656cf028200SDavid Howells 	__be32		rnid_att_nodes;	/* number of attached nodes */
657cf028200SDavid Howells 	__u8		rnid_node_mgmt;	/* node management (see below) */
658cf028200SDavid Howells 	__u8		rnid_ip_ver;	/* IP version (see below) */
659cf028200SDavid Howells 	__be16		rnid_prot_port;	/* UDP / TCP port number */
660cf028200SDavid Howells 	__be32		rnid_ip_addr[4]; /* IP address */
661cf028200SDavid Howells 	__u8		rnid_resvd[2];	/* reserved */
662cf028200SDavid Howells 	__be16		rnid_vend_spec;	/* vendor-specific field */
663cf028200SDavid Howells };
664cf028200SDavid Howells 
665cf028200SDavid Howells enum fc_els_rnid_atype {
666cf028200SDavid Howells 	ELS_RNIDA_UNK =		0x01,	/* unknown */
667cf028200SDavid Howells 	ELS_RNIDA_OTHER =	0x02,	/* none of the following */
668cf028200SDavid Howells 	ELS_RNIDA_HUB =		0x03,
669cf028200SDavid Howells 	ELS_RNIDA_SWITCH =	0x04,
670cf028200SDavid Howells 	ELS_RNIDA_GATEWAY =	0x05,
671cf028200SDavid Howells 	ELS_RNIDA_CONV =	0x06,   /* Obsolete, do not use this value */
672cf028200SDavid Howells 	ELS_RNIDA_HBA =	        0x07,   /* Obsolete, do not use this value */
673cf028200SDavid Howells 	ELS_RNIDA_PROXY =       0x08,   /* Obsolete, do not use this value */
674cf028200SDavid Howells 	ELS_RNIDA_STORAGE =	0x09,
675cf028200SDavid Howells 	ELS_RNIDA_HOST =	0x0a,
676cf028200SDavid Howells 	ELS_RNIDA_SUBSYS =	0x0b,	/* storage subsystem (e.g., RAID) */
677cf028200SDavid Howells 	ELS_RNIDA_ACCESS =	0x0e,	/* access device (e.g. media changer) */
678cf028200SDavid Howells 	ELS_RNIDA_NAS =		0x11,	/* NAS server */
679cf028200SDavid Howells 	ELS_RNIDA_BRIDGE =	0x12,	/* bridge */
680cf028200SDavid Howells 	ELS_RNIDA_VIRT =	0x13,	/* virtualization device */
681cf028200SDavid Howells 	ELS_RNIDA_MF =		0xff,	/* multifunction device (bits below) */
682cf028200SDavid Howells 	ELS_RNIDA_MF_HUB =	1UL << 31, 	/* hub */
683cf028200SDavid Howells 	ELS_RNIDA_MF_SW =	1UL << 30, 	/* switch */
684cf028200SDavid Howells 	ELS_RNIDA_MF_GW =	1UL << 29,	/* gateway */
685cf028200SDavid Howells 	ELS_RNIDA_MF_ST =	1UL << 28,	/* storage */
686cf028200SDavid Howells 	ELS_RNIDA_MF_HOST =	1UL << 27,	/* host */
687cf028200SDavid Howells 	ELS_RNIDA_MF_SUB =	1UL << 26,	/* storage subsystem */
688cf028200SDavid Howells 	ELS_RNIDA_MF_ACC =	1UL << 25,	/* storage access dev */
689cf028200SDavid Howells 	ELS_RNIDA_MF_WDM =	1UL << 24,	/* wavelength division mux */
690cf028200SDavid Howells 	ELS_RNIDA_MF_NAS =	1UL << 23,	/* NAS server */
691cf028200SDavid Howells 	ELS_RNIDA_MF_BR =	1UL << 22,	/* bridge */
692cf028200SDavid Howells 	ELS_RNIDA_MF_VIRT =	1UL << 21,	/* virtualization device */
693cf028200SDavid Howells };
694cf028200SDavid Howells 
695cf028200SDavid Howells enum fc_els_rnid_mgmt {
696cf028200SDavid Howells 	ELS_RNIDM_SNMP =	0,
697cf028200SDavid Howells 	ELS_RNIDM_TELNET =	1,
698cf028200SDavid Howells 	ELS_RNIDM_HTTP =	2,
699cf028200SDavid Howells 	ELS_RNIDM_HTTPS =	3,
700cf028200SDavid Howells 	ELS_RNIDM_XML =		4,	/* HTTP + XML */
701cf028200SDavid Howells };
702cf028200SDavid Howells 
703cf028200SDavid Howells enum fc_els_rnid_ipver {
704cf028200SDavid Howells 	ELS_RNIDIP_NONE =	0,	/* no IP support or node mgmt. */
705cf028200SDavid Howells 	ELS_RNIDIP_V4 =		1,	/* IPv4 */
706cf028200SDavid Howells 	ELS_RNIDIP_V6 =		2,	/* IPv6 */
707cf028200SDavid Howells };
708cf028200SDavid Howells 
709cf028200SDavid Howells /*
710cf028200SDavid Howells  * ELS RPL - Read Port List.
711cf028200SDavid Howells  */
712cf028200SDavid Howells struct fc_els_rpl {
713cf028200SDavid Howells 	__u8		rpl_cmd;	/* command */
714cf028200SDavid Howells 	__u8		rpl_resv[5];	/* reserved - must be zero */
715cf028200SDavid Howells 	__be16		rpl_max_size;	/* maximum response size or zero */
716cf028200SDavid Howells 	__u8		rpl_resv1;	/* reserved - must be zero */
717cf028200SDavid Howells 	__u8		rpl_index[3];	/* starting index */
718cf028200SDavid Howells };
719cf028200SDavid Howells 
720cf028200SDavid Howells /*
721cf028200SDavid Howells  * Port number block in RPL response.
722cf028200SDavid Howells  */
723cf028200SDavid Howells struct fc_els_pnb {
724cf028200SDavid Howells 	__be32		pnb_phys_pn;	/* physical port number */
725cf028200SDavid Howells 	__u8		pnb_resv;	/* reserved */
726cf028200SDavid Howells 	__u8		pnb_port_id[3];	/* port ID */
727cf028200SDavid Howells 	__be64		pnb_wwpn;	/* port name */
728cf028200SDavid Howells };
729cf028200SDavid Howells 
730cf028200SDavid Howells /*
731cf028200SDavid Howells  * RPL LS_ACC response.
732cf028200SDavid Howells  */
733cf028200SDavid Howells struct fc_els_rpl_resp {
734cf028200SDavid Howells 	__u8		rpl_cmd;	/* ELS_LS_ACC */
735cf028200SDavid Howells 	__u8		rpl_resv1;	/* reserved - must be zero */
736cf028200SDavid Howells 	__be16		rpl_plen;	/* payload length */
737cf028200SDavid Howells 	__u8		rpl_resv2;	/* reserved - must be zero */
738cf028200SDavid Howells 	__u8		rpl_llen[3];	/* list length */
739cf028200SDavid Howells 	__u8		rpl_resv3;	/* reserved - must be zero */
740cf028200SDavid Howells 	__u8		rpl_index[3];	/* starting index */
741cf028200SDavid Howells 	struct fc_els_pnb rpl_pnb[1];	/* variable number of PNBs */
742cf028200SDavid Howells };
743cf028200SDavid Howells 
744cf028200SDavid Howells /*
745cf028200SDavid Howells  * Link Error Status Block.
746cf028200SDavid Howells  */
747cf028200SDavid Howells struct fc_els_lesb {
748cf028200SDavid Howells 	__be32		lesb_link_fail;	/* link failure count */
749cf028200SDavid Howells 	__be32		lesb_sync_loss;	/* loss of synchronization count */
750cf028200SDavid Howells 	__be32		lesb_sig_loss;	/* loss of signal count */
751cf028200SDavid Howells 	__be32		lesb_prim_err;	/* primitive sequence error count */
752cf028200SDavid Howells 	__be32		lesb_inv_word;	/* invalid transmission word count */
753cf028200SDavid Howells 	__be32		lesb_inv_crc;	/* invalid CRC count */
754cf028200SDavid Howells };
755cf028200SDavid Howells 
756cf028200SDavid Howells /*
757cf028200SDavid Howells  * ELS RPS - Read Port Status Block request.
758cf028200SDavid Howells  */
759cf028200SDavid Howells struct fc_els_rps {
760cf028200SDavid Howells 	__u8		rps_cmd;	/* command */
761cf028200SDavid Howells 	__u8		rps_resv[2];	/* reserved - must be zero */
762cf028200SDavid Howells 	__u8		rps_flag;	/* flag - see below */
763cf028200SDavid Howells 	__be64		rps_port_spec;	/* port selection */
764cf028200SDavid Howells };
765cf028200SDavid Howells 
766cf028200SDavid Howells enum fc_els_rps_flag {
767cf028200SDavid Howells 	FC_ELS_RPS_DID =	0x00,	/* port identified by D_ID of req. */
768cf028200SDavid Howells 	FC_ELS_RPS_PPN =	0x01,	/* port_spec is physical port number */
769cf028200SDavid Howells 	FC_ELS_RPS_WWPN =	0x02,	/* port_spec is port WWN */
770cf028200SDavid Howells };
771cf028200SDavid Howells 
772cf028200SDavid Howells /*
773cf028200SDavid Howells  * ELS RPS LS_ACC response.
774cf028200SDavid Howells  */
775cf028200SDavid Howells struct fc_els_rps_resp {
776cf028200SDavid Howells 	__u8		rps_cmd;	/* command - LS_ACC */
777cf028200SDavid Howells 	__u8		rps_resv[2];	/* reserved - must be zero */
778cf028200SDavid Howells 	__u8		rps_flag;	/* flag - see below */
779cf028200SDavid Howells 	__u8		rps_resv2[2];	/* reserved */
780cf028200SDavid Howells 	__be16		rps_status;	/* port status - see below */
781cf028200SDavid Howells 	struct fc_els_lesb rps_lesb;	/* link error status block */
782cf028200SDavid Howells };
783cf028200SDavid Howells 
784cf028200SDavid Howells enum fc_els_rps_resp_flag {
785cf028200SDavid Howells 	FC_ELS_RPS_LPEV =	0x01,	/* L_port extension valid */
786cf028200SDavid Howells };
787cf028200SDavid Howells 
788cf028200SDavid Howells enum fc_els_rps_resp_status {
789cf028200SDavid Howells 	FC_ELS_RPS_PTP =	1 << 5,	/* point-to-point connection */
790cf028200SDavid Howells 	FC_ELS_RPS_LOOP =	1 << 4,	/* loop mode */
791cf028200SDavid Howells 	FC_ELS_RPS_FAB =	1 << 3,	/* fabric present */
792cf028200SDavid Howells 	FC_ELS_RPS_NO_SIG =	1 << 2,	/* loss of signal */
793cf028200SDavid Howells 	FC_ELS_RPS_NO_SYNC =	1 << 1,	/* loss of synchronization */
794cf028200SDavid Howells 	FC_ELS_RPS_RESET =	1 << 0,	/* in link reset protocol */
795cf028200SDavid Howells };
796cf028200SDavid Howells 
797cf028200SDavid Howells /*
798cf028200SDavid Howells  * ELS LIRR - Link Incident Record Registration request.
799cf028200SDavid Howells  */
800cf028200SDavid Howells struct fc_els_lirr {
801cf028200SDavid Howells 	__u8		lirr_cmd;	/* command */
802cf028200SDavid Howells 	__u8		lirr_resv[3];	/* reserved - must be zero */
803cf028200SDavid Howells 	__u8		lirr_func;	/* registration function */
804cf028200SDavid Howells 	__u8		lirr_fmt;	/* FC-4 type of RLIR requested */
805cf028200SDavid Howells 	__u8		lirr_resv2[2];	/* reserved - must be zero */
806cf028200SDavid Howells };
807cf028200SDavid Howells 
808cf028200SDavid Howells enum fc_els_lirr_func {
809cf028200SDavid Howells 	ELS_LIRR_SET_COND = 	0x01,	/* set - conditionally receive */
810cf028200SDavid Howells 	ELS_LIRR_SET_UNCOND = 	0x02,	/* set - unconditionally receive */
811cf028200SDavid Howells 	ELS_LIRR_CLEAR = 	0xff	/* clear registration */
812cf028200SDavid Howells };
813cf028200SDavid Howells 
814cf028200SDavid Howells /*
815cf028200SDavid Howells  * ELS SRL - Scan Remote Loop request.
816cf028200SDavid Howells  */
817cf028200SDavid Howells struct fc_els_srl {
818cf028200SDavid Howells 	__u8		srl_cmd;	/* command */
819cf028200SDavid Howells 	__u8		srl_resv[3];	/* reserved - must be zero */
820cf028200SDavid Howells 	__u8		srl_flag;	/* flag - see below */
821cf028200SDavid Howells 	__u8		srl_flag_param[3];	/* flag parameter */
822cf028200SDavid Howells };
823cf028200SDavid Howells 
824cf028200SDavid Howells enum fc_els_srl_flag {
825cf028200SDavid Howells 	FC_ELS_SRL_ALL =	0x00,	/* scan all FL ports */
826cf028200SDavid Howells 	FC_ELS_SRL_ONE =	0x01,	/* scan specified loop */
827cf028200SDavid Howells 	FC_ELS_SRL_EN_PER =	0x02,	/* enable periodic scanning (param) */
828cf028200SDavid Howells 	FC_ELS_SRL_DIS_PER =	0x03,	/* disable periodic scanning */
829cf028200SDavid Howells };
830cf028200SDavid Howells 
831cf028200SDavid Howells /*
832cf028200SDavid Howells  * ELS RLS - Read Link Error Status Block request.
833cf028200SDavid Howells  */
834cf028200SDavid Howells struct fc_els_rls {
835cf028200SDavid Howells 	__u8		rls_cmd;	/* command */
836cf028200SDavid Howells 	__u8		rls_resv[4];	/* reserved - must be zero */
837cf028200SDavid Howells 	__u8		rls_port_id[3];	/* port ID */
838cf028200SDavid Howells };
839cf028200SDavid Howells 
840cf028200SDavid Howells /*
841cf028200SDavid Howells  * ELS RLS LS_ACC Response.
842cf028200SDavid Howells  */
843cf028200SDavid Howells struct fc_els_rls_resp {
844cf028200SDavid Howells 	__u8		rls_cmd;	/* ELS_LS_ACC */
845cf028200SDavid Howells 	__u8		rls_resv[3];	/* reserved - must be zero */
846cf028200SDavid Howells 	struct fc_els_lesb rls_lesb;	/* link error status block */
847cf028200SDavid Howells };
848cf028200SDavid Howells 
849cf028200SDavid Howells /*
850cf028200SDavid Howells  * ELS RLIR - Registered Link Incident Report.
851cf028200SDavid Howells  * This is followed by the CLIR and the CLID, described below.
852cf028200SDavid Howells  */
853cf028200SDavid Howells struct fc_els_rlir {
854cf028200SDavid Howells 	__u8		rlir_cmd;	/* command */
855cf028200SDavid Howells 	__u8		rlir_resv[3];	/* reserved - must be zero */
856cf028200SDavid Howells 	__u8		rlir_fmt;	/* format (FC4-type if type specific) */
857cf028200SDavid Howells 	__u8		rlir_clr_len;	/* common link incident record length */
858cf028200SDavid Howells 	__u8		rlir_cld_len;	/* common link incident desc. length */
859cf028200SDavid Howells 	__u8		rlir_slr_len;	/* spec. link incident record length */
860cf028200SDavid Howells };
861cf028200SDavid Howells 
862cf028200SDavid Howells /*
863cf028200SDavid Howells  * CLIR - Common Link Incident Record Data. - Sent via RLIR.
864cf028200SDavid Howells  */
865cf028200SDavid Howells struct fc_els_clir {
866cf028200SDavid Howells 	__be64		clir_wwpn;	/* incident port name */
867cf028200SDavid Howells 	__be64		clir_wwnn;	/* incident port node name */
868cf028200SDavid Howells 	__u8		clir_port_type;	/* incident port type */
869cf028200SDavid Howells 	__u8		clir_port_id[3];	/* incident port ID */
870cf028200SDavid Howells 
871cf028200SDavid Howells 	__be64		clir_conn_wwpn;	/* connected port name */
872cf028200SDavid Howells 	__be64		clir_conn_wwnn;	/* connected node name */
873cf028200SDavid Howells 	__be64		clir_fab_name;	/* fabric name */
874cf028200SDavid Howells 	__be32		clir_phys_port;	/* physical port number */
875cf028200SDavid Howells 	__be32		clir_trans_id;	/* transaction ID */
876cf028200SDavid Howells 	__u8		clir_resv[3];	/* reserved */
877cf028200SDavid Howells 	__u8		clir_ts_fmt;	/* time stamp format */
878cf028200SDavid Howells 	__be64		clir_timestamp;	/* time stamp */
879cf028200SDavid Howells };
880cf028200SDavid Howells 
881cf028200SDavid Howells /*
882cf028200SDavid Howells  * CLIR clir_ts_fmt - time stamp format values.
883cf028200SDavid Howells  */
884cf028200SDavid Howells enum fc_els_clir_ts_fmt {
885cf028200SDavid Howells 	ELS_CLIR_TS_UNKNOWN = 	0,	/* time stamp field unknown */
886cf028200SDavid Howells 	ELS_CLIR_TS_SEC_FRAC = 	1,	/* time in seconds and fractions */
887cf028200SDavid Howells 	ELS_CLIR_TS_CSU =	2,	/* time in clock synch update format */
888cf028200SDavid Howells };
889cf028200SDavid Howells 
890cf028200SDavid Howells /*
891cf028200SDavid Howells  * Common Link Incident Descriptor - sent via RLIR.
892cf028200SDavid Howells  */
893cf028200SDavid Howells struct fc_els_clid {
894cf028200SDavid Howells 	__u8		clid_iq;	/* incident qualifier flags */
895cf028200SDavid Howells 	__u8		clid_ic;	/* incident code */
896cf028200SDavid Howells 	__be16		clid_epai;	/* domain/area of ISL */
897cf028200SDavid Howells };
898cf028200SDavid Howells 
899cf028200SDavid Howells /*
900cf028200SDavid Howells  * CLID incident qualifier flags.
901cf028200SDavid Howells  */
902cf028200SDavid Howells enum fc_els_clid_iq {
903cf028200SDavid Howells 	ELS_CLID_SWITCH =	0x20,	/* incident port is a switch node */
904cf028200SDavid Howells 	ELS_CLID_E_PORT =	0x10,	/* incident is an ISL (E) port */
905cf028200SDavid Howells 	ELS_CLID_SEV_MASK =	0x0c,	/* severity 2-bit field mask */
906cf028200SDavid Howells 	ELS_CLID_SEV_INFO =	0x00,	/* report is informational */
907cf028200SDavid Howells 	ELS_CLID_SEV_INOP =	0x08,	/* link not operational */
908cf028200SDavid Howells 	ELS_CLID_SEV_DEG =	0x04,	/* link degraded but operational */
909cf028200SDavid Howells 	ELS_CLID_LASER =	0x02,	/* subassembly is a laser */
910cf028200SDavid Howells 	ELS_CLID_FRU =		0x01,	/* format can identify a FRU */
911cf028200SDavid Howells };
912cf028200SDavid Howells 
913cf028200SDavid Howells /*
914cf028200SDavid Howells  * CLID incident code.
915cf028200SDavid Howells  */
916cf028200SDavid Howells enum fc_els_clid_ic {
917cf028200SDavid Howells 	ELS_CLID_IC_IMPL =	1,	/* implicit incident */
918cf028200SDavid Howells 	ELS_CLID_IC_BER =	2,	/* bit-error-rate threshold exceeded */
919cf028200SDavid Howells 	ELS_CLID_IC_LOS =	3,	/* loss of synch or signal */
920cf028200SDavid Howells 	ELS_CLID_IC_NOS =	4,	/* non-operational primitive sequence */
921cf028200SDavid Howells 	ELS_CLID_IC_PST =	5,	/* primitive sequence timeout */
922cf028200SDavid Howells 	ELS_CLID_IC_INVAL =	6,	/* invalid primitive sequence */
923cf028200SDavid Howells 	ELS_CLID_IC_LOOP_TO =	7,	/* loop initialization time out */
924cf028200SDavid Howells 	ELS_CLID_IC_LIP =	8,	/* receiving LIP */
925cf028200SDavid Howells };
926cf028200SDavid Howells 
927874163aaSShyam Sundar /*
928874163aaSShyam Sundar  * Link Integrity event types
929874163aaSShyam Sundar  */
93073ec6d27SJames Smart enum fc_fpin_li_event_types {
93173ec6d27SJames Smart 	FPIN_LI_UNKNOWN =		0x0,
93273ec6d27SJames Smart 	FPIN_LI_LINK_FAILURE =		0x1,
93373ec6d27SJames Smart 	FPIN_LI_LOSS_OF_SYNC =		0x2,
93473ec6d27SJames Smart 	FPIN_LI_LOSS_OF_SIG =		0x3,
93573ec6d27SJames Smart 	FPIN_LI_PRIM_SEQ_ERR =		0x4,
93673ec6d27SJames Smart 	FPIN_LI_INVALID_TX_WD =		0x5,
93773ec6d27SJames Smart 	FPIN_LI_INVALID_CRC =		0x6,
93873ec6d27SJames Smart 	FPIN_LI_DEVICE_SPEC =		0xF,
939a7dff3adSJames Smart };
940a7dff3adSJames Smart 
941a7dff3adSJames Smart /*
94273ec6d27SJames Smart  * Initializer useful for decoding table.
94373ec6d27SJames Smart  * Please keep this in sync with the above definitions.
944a7dff3adSJames Smart  */
94573ec6d27SJames Smart #define FC_FPIN_LI_EVT_TYPES_INIT {					\
94673ec6d27SJames Smart 	{ FPIN_LI_UNKNOWN,		"Unknown" },			\
94773ec6d27SJames Smart 	{ FPIN_LI_LINK_FAILURE,		"Link Failure" },		\
94873ec6d27SJames Smart 	{ FPIN_LI_LOSS_OF_SYNC,		"Loss of Synchronization" },	\
94973ec6d27SJames Smart 	{ FPIN_LI_LOSS_OF_SIG,		"Loss of Signal" },		\
95073ec6d27SJames Smart 	{ FPIN_LI_PRIM_SEQ_ERR,		"Primitive Sequence Protocol Error" }, \
95173ec6d27SJames Smart 	{ FPIN_LI_INVALID_TX_WD,	"Invalid Transmission Word" },	\
95273ec6d27SJames Smart 	{ FPIN_LI_INVALID_CRC,		"Invalid CRC" },		\
95373ec6d27SJames Smart 	{ FPIN_LI_DEVICE_SPEC,		"Device Specific" },		\
95473ec6d27SJames Smart }
95573ec6d27SJames Smart 
956874163aaSShyam Sundar /*
957874163aaSShyam Sundar  * Delivery event types
958874163aaSShyam Sundar  */
959874163aaSShyam Sundar enum fc_fpin_deli_event_types {
960874163aaSShyam Sundar 	FPIN_DELI_UNKNOWN =		0x0,
961874163aaSShyam Sundar 	FPIN_DELI_TIMEOUT =		0x1,
962874163aaSShyam Sundar 	FPIN_DELI_UNABLE_TO_ROUTE =	0x2,
963874163aaSShyam Sundar 	FPIN_DELI_DEVICE_SPEC =		0xF,
964874163aaSShyam Sundar };
965874163aaSShyam Sundar 
966874163aaSShyam Sundar /*
967874163aaSShyam Sundar  * Initializer useful for decoding table.
968874163aaSShyam Sundar  * Please keep this in sync with the above definitions.
969874163aaSShyam Sundar  */
970874163aaSShyam Sundar #define FC_FPIN_DELI_EVT_TYPES_INIT {					\
971874163aaSShyam Sundar 	{ FPIN_DELI_UNKNOWN,		"Unknown" },			\
972874163aaSShyam Sundar 	{ FPIN_DELI_TIMEOUT,		"Timeout" },			\
973874163aaSShyam Sundar 	{ FPIN_DELI_UNABLE_TO_ROUTE,	"Unable to Route" },		\
974874163aaSShyam Sundar 	{ FPIN_DELI_DEVICE_SPEC,	"Device Specific" },		\
975874163aaSShyam Sundar }
976874163aaSShyam Sundar 
977874163aaSShyam Sundar /*
978874163aaSShyam Sundar  * Congestion event types
979874163aaSShyam Sundar  */
980874163aaSShyam Sundar enum fc_fpin_congn_event_types {
981874163aaSShyam Sundar 	FPIN_CONGN_CLEAR =		0x0,
982874163aaSShyam Sundar 	FPIN_CONGN_LOST_CREDIT =	0x1,
983874163aaSShyam Sundar 	FPIN_CONGN_CREDIT_STALL =	0x2,
984874163aaSShyam Sundar 	FPIN_CONGN_OVERSUBSCRIPTION =	0x3,
985874163aaSShyam Sundar 	FPIN_CONGN_DEVICE_SPEC =	0xF,
986874163aaSShyam Sundar };
987874163aaSShyam Sundar 
988874163aaSShyam Sundar /*
989874163aaSShyam Sundar  * Initializer useful for decoding table.
990874163aaSShyam Sundar  * Please keep this in sync with the above definitions.
991874163aaSShyam Sundar  */
992874163aaSShyam Sundar #define FC_FPIN_CONGN_EVT_TYPES_INIT {					\
993874163aaSShyam Sundar 	{ FPIN_CONGN_CLEAR,		"Clear" },			\
994874163aaSShyam Sundar 	{ FPIN_CONGN_LOST_CREDIT,	"Lost Credit" },		\
995874163aaSShyam Sundar 	{ FPIN_CONGN_CREDIT_STALL,	"Credit Stall" },		\
996874163aaSShyam Sundar 	{ FPIN_CONGN_OVERSUBSCRIPTION,	"Oversubscription" },		\
997874163aaSShyam Sundar 	{ FPIN_CONGN_DEVICE_SPEC,	"Device Specific" },		\
998874163aaSShyam Sundar }
999874163aaSShyam Sundar 
1000874163aaSShyam Sundar enum fc_fpin_congn_severity_types {
1001874163aaSShyam Sundar 	FPIN_CONGN_SEVERITY_WARNING =	0xF1,
1002874163aaSShyam Sundar 	FPIN_CONGN_SEVERITY_ERROR =	0xF7,
1003874163aaSShyam Sundar };
100473ec6d27SJames Smart 
100573ec6d27SJames Smart /*
100673ec6d27SJames Smart  * Link Integrity Notification Descriptor
1007a7dff3adSJames Smart  */
100873ec6d27SJames Smart struct fc_fn_li_desc {
100973ec6d27SJames Smart 	__be32		desc_tag;	/* Descriptor Tag (0x00020001) */
101073ec6d27SJames Smart 	__be32		desc_len;	/* Length of Descriptor (in bytes).
101173ec6d27SJames Smart 					 * Size of descriptor excluding
101273ec6d27SJames Smart 					 * desc_tag and desc_len fields.
101373ec6d27SJames Smart 					 */
101473ec6d27SJames Smart 	__be64		detecting_wwpn;	/* Port Name that detected event */
101573ec6d27SJames Smart 	__be64		attached_wwpn;	/* Port Name of device attached to
101673ec6d27SJames Smart 					 * detecting Port Name
101773ec6d27SJames Smart 					 */
101873ec6d27SJames Smart 	__be16		event_type;	/* see enum fc_fpin_li_event_types */
101973ec6d27SJames Smart 	__be16		event_modifier;	/* Implementation specific value
102073ec6d27SJames Smart 					 * describing the event type
102173ec6d27SJames Smart 					 */
102273ec6d27SJames Smart 	__be32		event_threshold;/* duration in ms of the link
102373ec6d27SJames Smart 					 * integrity detection cycle
102473ec6d27SJames Smart 					 */
102573ec6d27SJames Smart 	__be32		event_count;	/* minimum number of event
102673ec6d27SJames Smart 					 * occurrences during the event
102773ec6d27SJames Smart 					 * threshold to caause the LI event
102873ec6d27SJames Smart 					 */
102973ec6d27SJames Smart 	__be32		pname_count;	/* number of portname_list elements */
1030*94dfc73eSGustavo A. R. Silva 	__be64		pname_list[];	/* list of N_Port_Names accessible
103173ec6d27SJames Smart 					 * through the attached port
103273ec6d27SJames Smart 					 */
1033a7dff3adSJames Smart };
1034a7dff3adSJames Smart 
1035a7dff3adSJames Smart /*
1036874163aaSShyam Sundar  * Delivery Notification Descriptor
1037874163aaSShyam Sundar  */
1038874163aaSShyam Sundar struct fc_fn_deli_desc {
1039874163aaSShyam Sundar 	__be32		desc_tag;	/* Descriptor Tag (0x00020002) */
1040874163aaSShyam Sundar 	__be32		desc_len;	/* Length of Descriptor (in bytes).
1041874163aaSShyam Sundar 					 * Size of descriptor excluding
1042874163aaSShyam Sundar 					 * desc_tag and desc_len fields.
1043874163aaSShyam Sundar 					 */
1044874163aaSShyam Sundar 	__be64		detecting_wwpn;	/* Port Name that detected event */
1045874163aaSShyam Sundar 	__be64		attached_wwpn;	/* Port Name of device attached to
1046874163aaSShyam Sundar 					 * detecting Port Name
1047874163aaSShyam Sundar 					 */
1048874163aaSShyam Sundar 	__be32		deli_reason_code;/* see enum fc_fpin_deli_event_types */
1049874163aaSShyam Sundar };
1050874163aaSShyam Sundar 
1051874163aaSShyam Sundar /*
1052874163aaSShyam Sundar  * Peer Congestion Notification Descriptor
1053874163aaSShyam Sundar  */
1054874163aaSShyam Sundar struct fc_fn_peer_congn_desc {
1055874163aaSShyam Sundar 	__be32		desc_tag;	/* Descriptor Tag (0x00020003) */
1056874163aaSShyam Sundar 	__be32		desc_len;	/* Length of Descriptor (in bytes).
1057874163aaSShyam Sundar 					 * Size of descriptor excluding
1058874163aaSShyam Sundar 					 * desc_tag and desc_len fields.
1059874163aaSShyam Sundar 					 */
1060874163aaSShyam Sundar 	__be64		detecting_wwpn;	/* Port Name that detected event */
1061874163aaSShyam Sundar 	__be64		attached_wwpn;	/* Port Name of device attached to
1062874163aaSShyam Sundar 					 * detecting Port Name
1063874163aaSShyam Sundar 					 */
1064874163aaSShyam Sundar 	__be16		event_type;	/* see enum fc_fpin_congn_event_types */
1065874163aaSShyam Sundar 	__be16		event_modifier;	/* Implementation specific value
1066874163aaSShyam Sundar 					 * describing the event type
1067874163aaSShyam Sundar 					 */
1068874163aaSShyam Sundar 	__be32		event_period;	/* duration (ms) of the detected
1069874163aaSShyam Sundar 					 * congestion event
1070874163aaSShyam Sundar 					 */
1071874163aaSShyam Sundar 	__be32		pname_count;	/* number of portname_list elements */
1072*94dfc73eSGustavo A. R. Silva 	__be64		pname_list[];	/* list of N_Port_Names accessible
1073874163aaSShyam Sundar 					 * through the attached port
1074874163aaSShyam Sundar 					 */
1075874163aaSShyam Sundar };
1076874163aaSShyam Sundar 
1077874163aaSShyam Sundar /*
1078874163aaSShyam Sundar  * Congestion Notification Descriptor
1079874163aaSShyam Sundar  */
1080874163aaSShyam Sundar struct fc_fn_congn_desc {
1081874163aaSShyam Sundar 	__be32		desc_tag;	/* Descriptor Tag (0x00020004) */
1082874163aaSShyam Sundar 	__be32		desc_len;	/* Length of Descriptor (in bytes).
1083874163aaSShyam Sundar 					 * Size of descriptor excluding
1084874163aaSShyam Sundar 					 * desc_tag and desc_len fields.
1085874163aaSShyam Sundar 					 */
1086874163aaSShyam Sundar 	__be16		event_type;	/* see enum fc_fpin_congn_event_types */
1087874163aaSShyam Sundar 	__be16		event_modifier;	/* Implementation specific value
1088874163aaSShyam Sundar 					 * describing the event type
1089874163aaSShyam Sundar 					 */
1090874163aaSShyam Sundar 	__be32		event_period;	/* duration (ms) of the detected
1091874163aaSShyam Sundar 					 * congestion event
1092874163aaSShyam Sundar 					 */
1093874163aaSShyam Sundar 	__u8		severity;	/* command */
1094874163aaSShyam Sundar 	__u8		resv[3];	/* reserved - must be zero */
1095874163aaSShyam Sundar };
1096874163aaSShyam Sundar 
1097874163aaSShyam Sundar /*
1098a7dff3adSJames Smart  * ELS_FPIN - Fabric Performance Impact Notification
1099a7dff3adSJames Smart  */
1100a7dff3adSJames Smart struct fc_els_fpin {
1101a7dff3adSJames Smart 	__u8		fpin_cmd;	/* command (0x16) */
1102a7dff3adSJames Smart 	__u8		fpin_zero[3];	/* specified as zero - part of cmd */
110373ec6d27SJames Smart 	__be32		desc_len;	/* Length of Descriptor List (in bytes).
110473ec6d27SJames Smart 					 * Size of ELS excluding fpin_cmd,
110573ec6d27SJames Smart 					 * fpin_zero and desc_len fields.
110673ec6d27SJames Smart 					 */
1107*94dfc73eSGustavo A. R. Silva 	struct fc_tlv_desc	fpin_desc[];	/* Descriptor list */
1108a7dff3adSJames Smart };
1109a7dff3adSJames Smart 
111073ec6d27SJames Smart /* Diagnostic Function Descriptor - FPIN Registration */
111173ec6d27SJames Smart struct fc_df_desc_fpin_reg {
111273ec6d27SJames Smart 	__be32		desc_tag;	/* FPIN Registration (0x00030001) */
111373ec6d27SJames Smart 	__be32		desc_len;	/* Length of Descriptor (in bytes).
111473ec6d27SJames Smart 					 * Size of descriptor excluding
111573ec6d27SJames Smart 					 * desc_tag and desc_len fields.
111673ec6d27SJames Smart 					 */
111773ec6d27SJames Smart 	__be32		count;		/* Number of desc_tags elements */
1118*94dfc73eSGustavo A. R. Silva 	__be32		desc_tags[];	/* Array of Descriptor Tags.
111973ec6d27SJames Smart 					 * Each tag indicates a function
112073ec6d27SJames Smart 					 * supported by the N_Port (request)
112173ec6d27SJames Smart 					 * or by the  N_Port and Fabric
112273ec6d27SJames Smart 					 * Controller (reply; may be a subset
112373ec6d27SJames Smart 					 * of the request).
112473ec6d27SJames Smart 					 * See ELS_FN_DTAG_xxx for tag values.
112573ec6d27SJames Smart 					 */
112673ec6d27SJames Smart };
112773ec6d27SJames Smart 
112873ec6d27SJames Smart /*
112973ec6d27SJames Smart  * ELS_RDF - Register Diagnostic Functions
113073ec6d27SJames Smart  */
113173ec6d27SJames Smart struct fc_els_rdf {
113273ec6d27SJames Smart 	__u8		fpin_cmd;	/* command (0x19) */
113373ec6d27SJames Smart 	__u8		fpin_zero[3];	/* specified as zero - part of cmd */
113473ec6d27SJames Smart 	__be32		desc_len;	/* Length of Descriptor List (in bytes).
113573ec6d27SJames Smart 					 * Size of ELS excluding fpin_cmd,
113673ec6d27SJames Smart 					 * fpin_zero and desc_len fields.
113773ec6d27SJames Smart 					 */
1138*94dfc73eSGustavo A. R. Silva 	struct fc_tlv_desc	desc[];	/* Descriptor list */
113973ec6d27SJames Smart };
114073ec6d27SJames Smart 
114173ec6d27SJames Smart /*
114273ec6d27SJames Smart  * ELS RDF LS_ACC Response.
114373ec6d27SJames Smart  */
114473ec6d27SJames Smart struct fc_els_rdf_resp {
114573ec6d27SJames Smart 	struct fc_els_ls_acc	acc_hdr;
114673ec6d27SJames Smart 	__be32			desc_list_len;	/* Length of response (in
114773ec6d27SJames Smart 						 * bytes). Excludes acc_hdr
114873ec6d27SJames Smart 						 * and desc_list_len fields.
114973ec6d27SJames Smart 						 */
115073ec6d27SJames Smart 	struct fc_els_lsri_desc	lsri;
1151*94dfc73eSGustavo A. R. Silva 	struct fc_tlv_desc	desc[];	/* Supported Descriptor list */
115273ec6d27SJames Smart };
115373ec6d27SJames Smart 
115473ec6d27SJames Smart 
115554404d35SJames Smart /*
115654404d35SJames Smart  * Diagnostic Capability Descriptors for EDC ELS
115754404d35SJames Smart  */
115854404d35SJames Smart 
115954404d35SJames Smart /*
116054404d35SJames Smart  * Diagnostic: Link Fault Capability Descriptor
116154404d35SJames Smart  */
116254404d35SJames Smart struct fc_diag_lnkflt_desc {
116354404d35SJames Smart 	__be32		desc_tag;	/* Descriptor Tag (0x0001000D) */
116454404d35SJames Smart 	__be32		desc_len;	/* Length of Descriptor (in bytes).
116554404d35SJames Smart 					 * Size of descriptor excluding
116654404d35SJames Smart 					 * desc_tag and desc_len fields.
116754404d35SJames Smart 					 * 12 bytes
116854404d35SJames Smart 					 */
116954404d35SJames Smart 	__be32		degrade_activate_threshold;
117054404d35SJames Smart 	__be32		degrade_deactivate_threshold;
117154404d35SJames Smart 	__be32		fec_degrade_interval;
117254404d35SJames Smart };
117354404d35SJames Smart 
117454404d35SJames Smart enum fc_edc_cg_signal_cap_types {
117554404d35SJames Smart 	/* Note: Capability: bits 31:4 Rsvd; bits 3:0 are capabilities */
117654404d35SJames Smart 	EDC_CG_SIG_NOTSUPPORTED =	0x00, /* neither supported */
117754404d35SJames Smart 	EDC_CG_SIG_WARN_ONLY =		0x01,
117854404d35SJames Smart 	EDC_CG_SIG_WARN_ALARM =		0x02, /* both supported */
117954404d35SJames Smart };
118054404d35SJames Smart 
118154404d35SJames Smart /*
118254404d35SJames Smart  * Initializer useful for decoding table.
118354404d35SJames Smart  * Please keep this in sync with the above definitions.
118454404d35SJames Smart  */
118554404d35SJames Smart #define FC_EDC_CG_SIGNAL_CAP_TYPES_INIT {				\
118654404d35SJames Smart 	{ EDC_CG_SIG_NOTSUPPORTED,	"Signaling Not Supported" },	\
118754404d35SJames Smart 	{ EDC_CG_SIG_WARN_ONLY,		"Warning Signal" },		\
118854404d35SJames Smart 	{ EDC_CG_SIG_WARN_ALARM,	"Warning and Alarm Signals" },	\
118954404d35SJames Smart }
119054404d35SJames Smart 
119154404d35SJames Smart enum fc_diag_cg_sig_freq_types {
119254404d35SJames Smart 	EDC_CG_SIGFREQ_CNT_MIN =	1,	/* Min Frequency Count */
119354404d35SJames Smart 	EDC_CG_SIGFREQ_CNT_MAX =	999,	/* Max Frequency Count */
119454404d35SJames Smart 
119554404d35SJames Smart 	EDC_CG_SIGFREQ_SEC =		0x1,	/* Units: seconds */
119654404d35SJames Smart 	EDC_CG_SIGFREQ_MSEC =		0x2,	/* Units: milliseconds */
119754404d35SJames Smart };
119854404d35SJames Smart 
119954404d35SJames Smart struct fc_diag_cg_sig_freq {
120054404d35SJames Smart 	__be16		count;		/* Time between signals
120154404d35SJames Smart 					 * note: upper 6 bits rsvd
120254404d35SJames Smart 					 */
120354404d35SJames Smart 	__be16		units;		/* Time unit for count
120454404d35SJames Smart 					 * note: upper 12 bits rsvd
120554404d35SJames Smart 					 */
120654404d35SJames Smart };
120754404d35SJames Smart 
120854404d35SJames Smart /*
120954404d35SJames Smart  * Diagnostic: Congestion Signaling Capability Descriptor
121054404d35SJames Smart  */
121154404d35SJames Smart struct fc_diag_cg_sig_desc {
121254404d35SJames Smart 	__be32		desc_tag;	/* Descriptor Tag (0x0001000F) */
121354404d35SJames Smart 	__be32		desc_len;	/* Length of Descriptor (in bytes).
121454404d35SJames Smart 					 * Size of descriptor excluding
121554404d35SJames Smart 					 * desc_tag and desc_len fields.
121654404d35SJames Smart 					 * 16 bytes
121754404d35SJames Smart 					 */
121854404d35SJames Smart 	__be32				xmt_signal_capability;
121954404d35SJames Smart 	struct fc_diag_cg_sig_freq	xmt_signal_frequency;
122054404d35SJames Smart 	__be32				rcv_signal_capability;
122154404d35SJames Smart 	struct fc_diag_cg_sig_freq	rcv_signal_frequency;
122254404d35SJames Smart };
122354404d35SJames Smart 
122454404d35SJames Smart /*
122554404d35SJames Smart  * ELS_EDC - Exchange Diagnostic Capabilities
122654404d35SJames Smart  */
122754404d35SJames Smart struct fc_els_edc {
122854404d35SJames Smart 	__u8		edc_cmd;	/* command (0x17) */
122954404d35SJames Smart 	__u8		edc_zero[3];	/* specified as zero - part of cmd */
123054404d35SJames Smart 	__be32		desc_len;	/* Length of Descriptor List (in bytes).
123154404d35SJames Smart 					 * Size of ELS excluding edc_cmd,
123254404d35SJames Smart 					 * edc_zero and desc_len fields.
123354404d35SJames Smart 					 */
1234*94dfc73eSGustavo A. R. Silva 	struct fc_tlv_desc	desc[];
123554404d35SJames Smart 					/* Diagnostic Descriptor list */
123654404d35SJames Smart };
123754404d35SJames Smart 
123854404d35SJames Smart /*
123954404d35SJames Smart  * ELS EDC LS_ACC Response.
124054404d35SJames Smart  */
124154404d35SJames Smart struct fc_els_edc_resp {
124254404d35SJames Smart 	struct fc_els_ls_acc	acc_hdr;
124354404d35SJames Smart 	__be32			desc_list_len;	/* Length of response (in
124454404d35SJames Smart 						 * bytes). Excludes acc_hdr
124554404d35SJames Smart 						 * and desc_list_len fields.
124654404d35SJames Smart 						 */
124754404d35SJames Smart 	struct fc_els_lsri_desc	lsri;
1248*94dfc73eSGustavo A. R. Silva 	struct fc_tlv_desc	desc[];
124954404d35SJames Smart 				    /* Supported Diagnostic Descriptor list */
125054404d35SJames Smart };
125154404d35SJames Smart 
125254404d35SJames Smart 
1253cf028200SDavid Howells #endif /* _FC_ELS_H_ */
1254