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