blob: b0872afe2d30849e8dbcf5c013210466e830d782 [file] [log] [blame]
Robert Lovef032c2f2008-12-09 15:10:11 -08001/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _FC_ELS_H_
21#define _FC_ELS_H_
22
23/*
24 * Fibre Channel Switch - Enhanced Link Services definitions.
25 * From T11 FC-LS Rev 1.2 June 7, 2005.
26 */
27
28/*
29 * ELS Command codes - byte 0 of the frame payload
30 */
31enum fc_els_cmd {
32 ELS_LS_RJT = 0x01, /* ESL reject */
33 ELS_LS_ACC = 0x02, /* ESL Accept */
34 ELS_PLOGI = 0x03, /* N_Port login */
35 ELS_FLOGI = 0x04, /* F_Port login */
36 ELS_LOGO = 0x05, /* Logout */
37 ELS_ABTX = 0x06, /* Abort exchange - obsolete */
38 ELS_RCS = 0x07, /* read connection status */
39 ELS_RES = 0x08, /* read exchange status block */
40 ELS_RSS = 0x09, /* read sequence status block */
41 ELS_RSI = 0x0a, /* read sequence initiative */
42 ELS_ESTS = 0x0b, /* establish streaming */
43 ELS_ESTC = 0x0c, /* estimate credit */
44 ELS_ADVC = 0x0d, /* advise credit */
45 ELS_RTV = 0x0e, /* read timeout value */
46 ELS_RLS = 0x0f, /* read link error status block */
47 ELS_ECHO = 0x10, /* echo */
48 ELS_TEST = 0x11, /* test */
49 ELS_RRQ = 0x12, /* reinstate recovery qualifier */
50 ELS_REC = 0x13, /* read exchange concise */
51 ELS_SRR = 0x14, /* sequence retransmission request */
52 ELS_PRLI = 0x20, /* process login */
53 ELS_PRLO = 0x21, /* process logout */
54 ELS_SCN = 0x22, /* state change notification */
55 ELS_TPLS = 0x23, /* test process login state */
56 ELS_TPRLO = 0x24, /* third party process logout */
57 ELS_LCLM = 0x25, /* login control list mgmt (obs) */
58 ELS_GAID = 0x30, /* get alias_ID */
59 ELS_FACT = 0x31, /* fabric activate alias_id */
60 ELS_FDACDT = 0x32, /* fabric deactivate alias_id */
61 ELS_NACT = 0x33, /* N-port activate alias_id */
62 ELS_NDACT = 0x34, /* N-port deactivate alias_id */
63 ELS_QOSR = 0x40, /* quality of service request */
64 ELS_RVCS = 0x41, /* read virtual circuit status */
65 ELS_PDISC = 0x50, /* discover N_port service params */
66 ELS_FDISC = 0x51, /* discover F_port service params */
67 ELS_ADISC = 0x52, /* discover address */
68 ELS_RNC = 0x53, /* report node cap (obs) */
69 ELS_FARP_REQ = 0x54, /* FC ARP request */
70 ELS_FARP_REPL = 0x55, /* FC ARP reply */
71 ELS_RPS = 0x56, /* read port status block */
72 ELS_RPL = 0x57, /* read port list */
73 ELS_RPBC = 0x58, /* read port buffer condition */
74 ELS_FAN = 0x60, /* fabric address notification */
75 ELS_RSCN = 0x61, /* registered state change notification */
76 ELS_SCR = 0x62, /* state change registration */
77 ELS_RNFT = 0x63, /* report node FC-4 types */
78 ELS_CSR = 0x68, /* clock synch. request */
79 ELS_CSU = 0x69, /* clock synch. update */
80 ELS_LINIT = 0x70, /* loop initialize */
81 ELS_LSTS = 0x72, /* loop status */
82 ELS_RNID = 0x78, /* request node ID data */
83 ELS_RLIR = 0x79, /* registered link incident report */
84 ELS_LIRR = 0x7a, /* link incident record registration */
85 ELS_SRL = 0x7b, /* scan remote loop */
86 ELS_SBRP = 0x7c, /* set bit-error reporting params */
87 ELS_RPSC = 0x7d, /* report speed capabilities */
88 ELS_QSA = 0x7e, /* query security attributes */
89 ELS_EVFP = 0x7f, /* exchange virt. fabrics params */
90 ELS_LKA = 0x80, /* link keep-alive */
91 ELS_AUTH_ELS = 0x90, /* authentication ELS */
92};
93
94/*
95 * Initializer useful for decoding table.
96 * Please keep this in sync with the above definitions.
97 */
98#define FC_ELS_CMDS_INIT { \
99 [ELS_LS_RJT] = "LS_RJT", \
100 [ELS_LS_ACC] = "LS_ACC", \
101 [ELS_PLOGI] = "PLOGI", \
102 [ELS_FLOGI] = "FLOGI", \
103 [ELS_LOGO] = "LOGO", \
104 [ELS_ABTX] = "ABTX", \
105 [ELS_RCS] = "RCS", \
106 [ELS_RES] = "RES", \
107 [ELS_RSS] = "RSS", \
108 [ELS_RSI] = "RSI", \
109 [ELS_ESTS] = "ESTS", \
110 [ELS_ESTC] = "ESTC", \
111 [ELS_ADVC] = "ADVC", \
112 [ELS_RTV] = "RTV", \
113 [ELS_RLS] = "RLS", \
114 [ELS_ECHO] = "ECHO", \
115 [ELS_TEST] = "TEST", \
116 [ELS_RRQ] = "RRQ", \
117 [ELS_REC] = "REC", \
118 [ELS_SRR] = "SRR", \
119 [ELS_PRLI] = "PRLI", \
120 [ELS_PRLO] = "PRLO", \
121 [ELS_SCN] = "SCN", \
122 [ELS_TPLS] = "TPLS", \
123 [ELS_TPRLO] = "TPRLO", \
124 [ELS_LCLM] = "LCLM", \
125 [ELS_GAID] = "GAID", \
126 [ELS_FACT] = "FACT", \
127 [ELS_FDACDT] = "FDACDT", \
128 [ELS_NACT] = "NACT", \
129 [ELS_NDACT] = "NDACT", \
130 [ELS_QOSR] = "QOSR", \
131 [ELS_RVCS] = "RVCS", \
132 [ELS_PDISC] = "PDISC", \
133 [ELS_FDISC] = "FDISC", \
134 [ELS_ADISC] = "ADISC", \
135 [ELS_RNC] = "RNC", \
136 [ELS_FARP_REQ] = "FARP_REQ", \
137 [ELS_FARP_REPL] = "FARP_REPL", \
138 [ELS_RPS] = "RPS", \
139 [ELS_RPL] = "RPL", \
140 [ELS_RPBC] = "RPBC", \
141 [ELS_FAN] = "FAN", \
142 [ELS_RSCN] = "RSCN", \
143 [ELS_SCR] = "SCR", \
144 [ELS_RNFT] = "RNFT", \
145 [ELS_CSR] = "CSR", \
146 [ELS_CSU] = "CSU", \
147 [ELS_LINIT] = "LINIT", \
148 [ELS_LSTS] = "LSTS", \
149 [ELS_RNID] = "RNID", \
150 [ELS_RLIR] = "RLIR", \
151 [ELS_LIRR] = "LIRR", \
152 [ELS_SRL] = "SRL", \
153 [ELS_SBRP] = "SBRP", \
154 [ELS_RPSC] = "RPSC", \
155 [ELS_QSA] = "QSA", \
156 [ELS_EVFP] = "EVFP", \
157 [ELS_LKA] = "LKA", \
158 [ELS_AUTH_ELS] = "AUTH_ELS", \
159}
160
161/*
162 * LS_ACC payload.
163 */
164struct fc_els_ls_acc {
165 __u8 la_cmd; /* command code ELS_LS_ACC */
166 __u8 la_resv[3]; /* reserved */
167};
168
169/*
170 * ELS reject payload.
171 */
172struct fc_els_ls_rjt {
173 __u8 er_cmd; /* command code ELS_LS_RJT */
174 __u8 er_resv[4]; /* reserved must be zero */
175 __u8 er_reason; /* reason (enum fc_els_rjt_reason below) */
176 __u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */
177 __u8 er_vendor; /* vendor specific code */
178};
179
180/*
181 * ELS reject reason codes (er_reason).
182 */
183enum fc_els_rjt_reason {
184 ELS_RJT_NONE = 0, /* no reject - not to be sent */
185 ELS_RJT_INVAL = 0x01, /* invalid ELS command code */
186 ELS_RJT_LOGIC = 0x03, /* logical error */
187 ELS_RJT_BUSY = 0x05, /* logical busy */
188 ELS_RJT_PROT = 0x07, /* protocol error */
189 ELS_RJT_UNAB = 0x09, /* unable to perform command request */
190 ELS_RJT_UNSUP = 0x0b, /* command not supported */
191 ELS_RJT_INPROG = 0x0e, /* command already in progress */
192 ELS_RJT_VENDOR = 0xff, /* vendor specific error */
193};
194
195
196/*
197 * reason code explanation (er_explan).
198 */
199enum fc_els_rjt_explan {
200 ELS_EXPL_NONE = 0x00, /* No additional explanation */
201 ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */
202 ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */
203 ELS_EXPL_AH = 0x11, /* invalid association header */
204 ELS_EXPL_AH_REQ = 0x13, /* association_header required */
205 ELS_EXPL_SID = 0x15, /* invalid originator S_ID */
206 ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */
207 ELS_EXPL_INPROG = 0x19, /* Request already in progress */
208 ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */
209 ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */
210 ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */
211 ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */
212 ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */
213 /* TBD - above definitions incomplete */
214};
215
216/*
217 * Common service parameters (N ports).
218 */
219struct fc_els_csp {
220 __u8 sp_hi_ver; /* highest version supported (obs.) */
221 __u8 sp_lo_ver; /* highest version supported (obs.) */
222 __be16 sp_bb_cred; /* buffer-to-buffer credits */
223 __be16 sp_features; /* common feature flags */
224 __be16 sp_bb_data; /* b-b state number and data field sz */
225 union {
226 struct {
227 __be16 _sp_tot_seq; /* total concurrent sequences */
228 __be16 _sp_rel_off; /* rel. offset by info cat */
229 } sp_plogi;
230 struct {
231 __be32 _sp_r_a_tov; /* resource alloc. timeout msec */
232 } sp_flogi_acc;
233 } sp_u;
234 __be32 sp_e_d_tov; /* error detect timeout value */
235};
236#define sp_tot_seq sp_u.sp_plogi._sp_tot_seq
237#define sp_rel_off sp_u.sp_plogi._sp_rel_off
238#define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov
239
240#define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */
241
242/*
243 * Minimum and maximum values for max data field size in service parameters.
244 */
245#define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD
246#define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD
247
248/*
249 * sp_features
250 */
Chris Leechdb36c062009-11-03 11:46:24 -0800251#define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */
252#define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */
Robert Lovef032c2f2008-12-09 15:10:11 -0800253#define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */
254#define FC_SP_FT_RAND 0x4000 /* random relative offset */
255#define FC_SP_FT_VAL 0x2000 /* valid vendor version level */
Chris Leechdb36c062009-11-03 11:46:24 -0800256#define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */
Robert Lovef032c2f2008-12-09 15:10:11 -0800257#define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */
258#define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */
259#define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */
260#define FC_SP_FT_MCAST 0x0200 /* multicast */
261#define FC_SP_FT_BCAST 0x0100 /* broadcast */
262#define FC_SP_FT_HUNT 0x0080 /* hunt group */
263#define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */
264#define FC_SP_FT_SEC 0x0020 /* reserved for security */
265#define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */
266#define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */
267#define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */
268#define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */
269#define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */
270
271/*
272 * Class-specific service parameters.
273 */
274struct fc_els_cssp {
275 __be16 cp_class; /* class flags */
276 __be16 cp_init; /* initiator flags */
277 __be16 cp_recip; /* recipient flags */
278 __be16 cp_rdfs; /* receive data field size */
279 __be16 cp_con_seq; /* concurrent sequences */
280 __be16 cp_ee_cred; /* N-port end-to-end credit */
281 __u8 cp_resv1; /* reserved */
282 __u8 cp_open_seq; /* open sequences per exchange */
283 __u8 _cp_resv2[2]; /* reserved */
284};
285
286/*
287 * cp_class flags.
288 */
289#define FC_CPC_VALID 0x8000 /* class valid */
290#define FC_CPC_IMIX 0x4000 /* intermix mode */
291#define FC_CPC_SEQ 0x0800 /* sequential delivery */
292#define FC_CPC_CAMP 0x0200 /* camp-on */
293#define FC_CPC_PRI 0x0080 /* priority */
294
295/*
296 * cp_init flags.
297 * (TBD: not all flags defined here).
298 */
299#define FC_CPI_CSYN 0x0010 /* clock synch. capable */
300
301/*
302 * cp_recip flags.
303 */
304#define FC_CPR_CSYN 0x0008 /* clock synch. capable */
305
306/*
307 * NFC_ELS_FLOGI: Fabric login request.
308 * NFC_ELS_PLOGI: Port login request (same format).
309 */
310struct fc_els_flogi {
311 __u8 fl_cmd; /* command */
312 __u8 _fl_resvd[3]; /* must be zero */
313 struct fc_els_csp fl_csp; /* common service parameters */
314 __be64 fl_wwpn; /* port name */
315 __be64 fl_wwnn; /* node name */
316 struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */
317 __u8 fl_vend[16]; /* vendor version level */
318} __attribute__((__packed__));
319
320/*
321 * Process login service parameter page.
322 */
323struct fc_els_spp {
324 __u8 spp_type; /* type code or common service params */
325 __u8 spp_type_ext; /* type code extension */
326 __u8 spp_flags;
327 __u8 _spp_resvd;
328 __be32 spp_orig_pa; /* originator process associator */
329 __be32 spp_resp_pa; /* responder process associator */
330 __be32 spp_params; /* service parameters */
331};
332
333/*
334 * spp_flags.
335 */
336#define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */
337#define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */
338#define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */
339#define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */
340
341/*
342 * SPP response code in spp_flags - lower 4 bits.
343 */
344enum fc_els_spp_resp {
345 FC_SPP_RESP_ACK = 1, /* request executed */
346 FC_SPP_RESP_RES = 2, /* unable due to lack of resources */
347 FC_SPP_RESP_INIT = 3, /* initialization not complete */
348 FC_SPP_RESP_NO_PA = 4, /* unknown process associator */
349 FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */
350 FC_SPP_RESP_COND = 6, /* request completed conditionally */
351 FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */
352 FC_SPP_RESP_INVL = 8, /* SPP is invalid */
353};
354
355/*
356 * ELS_RRQ - Reinstate Recovery Qualifier
357 */
358struct fc_els_rrq {
359 __u8 rrq_cmd; /* command (0x12) */
360 __u8 rrq_zero[3]; /* specified as zero - part of cmd */
361 __u8 rrq_resvd; /* reserved */
362 __u8 rrq_s_id[3]; /* originator FID */
363 __be16 rrq_ox_id; /* originator exchange ID */
364 __be16 rrq_rx_id; /* responders exchange ID */
365};
366
367/*
368 * ELS_REC - Read exchange concise.
369 */
370struct fc_els_rec {
371 __u8 rec_cmd; /* command (0x13) */
372 __u8 rec_zero[3]; /* specified as zero - part of cmd */
373 __u8 rec_resvd; /* reserved */
374 __u8 rec_s_id[3]; /* originator FID */
375 __be16 rec_ox_id; /* originator exchange ID */
376 __be16 rec_rx_id; /* responders exchange ID */
377};
378
379/*
380 * ELS_REC LS_ACC payload.
381 */
382struct fc_els_rec_acc {
383 __u8 reca_cmd; /* accept (0x02) */
384 __u8 reca_zero[3]; /* specified as zero - part of cmd */
385 __be16 reca_ox_id; /* originator exchange ID */
386 __be16 reca_rx_id; /* responders exchange ID */
387 __u8 reca_resvd1; /* reserved */
388 __u8 reca_ofid[3]; /* originator FID */
389 __u8 reca_resvd2; /* reserved */
390 __u8 reca_rfid[3]; /* responder FID */
391 __be32 reca_fc4value; /* FC4 value */
392 __be32 reca_e_stat; /* ESB (exchange status block) status */
393};
394
395/*
396 * ELS_PRLI - Process login request and response.
397 */
398struct fc_els_prli {
399 __u8 prli_cmd; /* command */
400 __u8 prli_spp_len; /* length of each serv. parm. page */
401 __be16 prli_len; /* length of entire payload */
402 /* service parameter pages follow */
403};
404
405/*
406 * ELS_ADISC payload
407 */
408struct fc_els_adisc {
409 __u8 adisc_cmd;
410 __u8 adisc_resv[3];
411 __u8 adisc_resv1;
412 __u8 adisc_hard_addr[3];
413 __be64 adisc_wwpn;
414 __be64 adisc_wwnn;
415 __u8 adisc_resv2;
416 __u8 adisc_port_id[3];
417} __attribute__((__packed__));
418
419/*
420 * ELS_LOGO - process or fabric logout.
421 */
422struct fc_els_logo {
423 __u8 fl_cmd; /* command code */
424 __u8 fl_zero[3]; /* specified as zero - part of cmd */
425 __u8 fl_resvd; /* reserved */
426 __u8 fl_n_port_id[3];/* N port ID */
427 __be64 fl_n_port_wwn; /* port name */
428};
429
430/*
431 * ELS_RTV - read timeout value.
432 */
433struct fc_els_rtv {
434 __u8 rtv_cmd; /* command code 0x0e */
435 __u8 rtv_zero[3]; /* specified as zero - part of cmd */
436};
437
438/*
439 * LS_ACC for ELS_RTV - read timeout value.
440 */
441struct fc_els_rtv_acc {
442 __u8 rtv_cmd; /* command code 0x02 */
443 __u8 rtv_zero[3]; /* specified as zero - part of cmd */
444 __be32 rtv_r_a_tov; /* resource allocation timeout value */
445 __be32 rtv_e_d_tov; /* error detection timeout value */
446 __be32 rtv_toq; /* timeout qualifier (see below) */
447};
448
449/*
450 * rtv_toq bits.
451 */
452#define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */
453#define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */
454
455/*
456 * ELS_SCR - state change registration payload.
457 */
458struct fc_els_scr {
459 __u8 scr_cmd; /* command code */
460 __u8 scr_resv[6]; /* reserved */
461 __u8 scr_reg_func; /* registration function (see below) */
462};
463
464enum fc_els_scr_func {
465 ELS_SCRF_FAB = 1, /* fabric-detected registration */
466 ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */
467 ELS_SCRF_FULL = 3, /* full registration */
468 ELS_SCRF_CLEAR = 255, /* remove any current registrations */
469};
470
471/*
472 * ELS_RSCN - registered state change notification payload.
473 */
474struct fc_els_rscn {
475 __u8 rscn_cmd; /* RSCN opcode (0x61) */
476 __u8 rscn_page_len; /* page length (4) */
477 __be16 rscn_plen; /* payload length including this word */
478
479 /* followed by 4-byte generic affected Port_ID pages */
480};
481
482struct fc_els_rscn_page {
483 __u8 rscn_page_flags; /* event and address format */
484 __u8 rscn_fid[3]; /* fabric ID */
485};
486
487#define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */
488#define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */
489#define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */
490#define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */
491
492enum fc_els_rscn_ev_qual {
493 ELS_EV_QUAL_NONE = 0, /* unspecified */
494 ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */
495 ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */
496 ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */
497 ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */
498 ELS_EV_QUAL_REM_OBJ = 5, /* removed object */
499};
500
501enum fc_els_rscn_addr_fmt {
502 ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */
503 ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */
504 ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */
505 ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */
506};
507
508/*
509 * ELS_RNID - request Node ID.
510 */
511struct fc_els_rnid {
512 __u8 rnid_cmd; /* RNID opcode (0x78) */
513 __u8 rnid_resv[3]; /* reserved */
514 __u8 rnid_fmt; /* data format */
515 __u8 rnid_resv2[3]; /* reserved */
516};
517
518/*
519 * Node Identification Data formats (rnid_fmt)
520 */
521enum fc_els_rnid_fmt {
522 ELS_RNIDF_NONE = 0, /* no specific identification data */
523 ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */
524};
525
526/*
527 * ELS_RNID response.
528 */
529struct fc_els_rnid_resp {
530 __u8 rnid_cmd; /* response code (LS_ACC) */
531 __u8 rnid_resv[3]; /* reserved */
532 __u8 rnid_fmt; /* data format */
533 __u8 rnid_cid_len; /* common ID data length */
534 __u8 rnid_resv2; /* reserved */
535 __u8 rnid_sid_len; /* specific ID data length */
536};
537
538struct fc_els_rnid_cid {
539 __be64 rnid_wwpn; /* N port name */
540 __be64 rnid_wwnn; /* node name */
541};
542
543struct fc_els_rnid_gen {
544 __u8 rnid_vend_id[16]; /* vendor-unique ID */
545 __be32 rnid_atype; /* associated type (see below) */
546 __be32 rnid_phys_port; /* physical port number */
547 __be32 rnid_att_nodes; /* number of attached nodes */
548 __u8 rnid_node_mgmt; /* node management (see below) */
549 __u8 rnid_ip_ver; /* IP version (see below) */
550 __be16 rnid_prot_port; /* UDP / TCP port number */
551 __be32 rnid_ip_addr[4]; /* IP address */
552 __u8 rnid_resvd[2]; /* reserved */
553 __be16 rnid_vend_spec; /* vendor-specific field */
554};
555
556enum fc_els_rnid_atype {
557 ELS_RNIDA_UNK = 0x01, /* unknown */
558 ELS_RNIDA_OTHER = 0x02, /* none of the following */
559 ELS_RNIDA_HUB = 0x03,
560 ELS_RNIDA_SWITCH = 0x04,
561 ELS_RNIDA_GATEWAY = 0x05,
562 ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */
563 ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */
564 ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */
565 ELS_RNIDA_STORAGE = 0x09,
566 ELS_RNIDA_HOST = 0x0a,
567 ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */
568 ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */
569 ELS_RNIDA_NAS = 0x11, /* NAS server */
570 ELS_RNIDA_BRIDGE = 0x12, /* bridge */
571 ELS_RNIDA_VIRT = 0x13, /* virtualization device */
572 ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */
573 ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */
574 ELS_RNIDA_MF_SW = 1UL << 30, /* switch */
575 ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */
576 ELS_RNIDA_MF_ST = 1UL << 28, /* storage */
577 ELS_RNIDA_MF_HOST = 1UL << 27, /* host */
578 ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */
579 ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */
580 ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */
581 ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */
582 ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */
583 ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */
584};
585
586enum fc_els_rnid_mgmt {
587 ELS_RNIDM_SNMP = 0,
588 ELS_RNIDM_TELNET = 1,
589 ELS_RNIDM_HTTP = 2,
590 ELS_RNIDM_HTTPS = 3,
591 ELS_RNIDM_XML = 4, /* HTTP + XML */
592};
593
594enum fc_els_rnid_ipver {
595 ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */
596 ELS_RNIDIP_V4 = 1, /* IPv4 */
597 ELS_RNIDIP_V6 = 2, /* IPv6 */
598};
599
600/*
601 * ELS RPL - Read Port List.
602 */
603struct fc_els_rpl {
604 __u8 rpl_cmd; /* command */
605 __u8 rpl_resv[5]; /* reserved - must be zero */
606 __be16 rpl_max_size; /* maximum response size or zero */
607 __u8 rpl_resv1; /* reserved - must be zero */
608 __u8 rpl_index[3]; /* starting index */
609};
610
611/*
612 * Port number block in RPL response.
613 */
614struct fc_els_pnb {
615 __be32 pnb_phys_pn; /* physical port number */
616 __u8 pnb_resv; /* reserved */
617 __u8 pnb_port_id[3]; /* port ID */
618 __be64 pnb_wwpn; /* port name */
619};
620
621/*
622 * RPL LS_ACC response.
623 */
624struct fc_els_rpl_resp {
625 __u8 rpl_cmd; /* ELS_LS_ACC */
626 __u8 rpl_resv1; /* reserved - must be zero */
627 __be16 rpl_plen; /* payload length */
628 __u8 rpl_resv2; /* reserved - must be zero */
629 __u8 rpl_llen[3]; /* list length */
630 __u8 rpl_resv3; /* reserved - must be zero */
631 __u8 rpl_index[3]; /* starting index */
632 struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */
633};
634
635/*
636 * Link Error Status Block.
637 */
638struct fc_els_lesb {
639 __be32 lesb_link_fail; /* link failure count */
640 __be32 lesb_sync_loss; /* loss of synchronization count */
641 __be32 lesb_sig_loss; /* loss of signal count */
642 __be32 lesb_prim_err; /* primitive sequence error count */
643 __be32 lesb_inv_word; /* invalid transmission word count */
644 __be32 lesb_inv_crc; /* invalid CRC count */
645};
646
647/*
648 * ELS RPS - Read Port Status Block request.
649 */
650struct fc_els_rps {
651 __u8 rps_cmd; /* command */
652 __u8 rps_resv[2]; /* reserved - must be zero */
653 __u8 rps_flag; /* flag - see below */
654 __be64 rps_port_spec; /* port selection */
655};
656
657enum fc_els_rps_flag {
658 FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */
659 FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */
660 FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */
661};
662
663/*
664 * ELS RPS LS_ACC response.
665 */
666struct fc_els_rps_resp {
667 __u8 rps_cmd; /* command - LS_ACC */
668 __u8 rps_resv[2]; /* reserved - must be zero */
669 __u8 rps_flag; /* flag - see below */
670 __u8 rps_resv2[2]; /* reserved */
671 __be16 rps_status; /* port status - see below */
672 struct fc_els_lesb rps_lesb; /* link error status block */
673};
674
675enum fc_els_rps_resp_flag {
676 FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */
677};
678
679enum fc_els_rps_resp_status {
680 FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */
681 FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */
682 FC_ELS_RPS_FAB = 1 << 3, /* fabric present */
683 FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */
684 FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */
685 FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */
686};
687
688/*
689 * ELS LIRR - Link Incident Record Registration request.
690 */
691struct fc_els_lirr {
692 __u8 lirr_cmd; /* command */
693 __u8 lirr_resv[3]; /* reserved - must be zero */
694 __u8 lirr_func; /* registration function */
695 __u8 lirr_fmt; /* FC-4 type of RLIR requested */
696 __u8 lirr_resv2[2]; /* reserved - must be zero */
697};
698
699enum fc_els_lirr_func {
700 ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */
701 ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */
702 ELS_LIRR_CLEAR = 0xff /* clear registration */
703};
704
705/*
706 * ELS SRL - Scan Remote Loop request.
707 */
708struct fc_els_srl {
709 __u8 srl_cmd; /* command */
710 __u8 srl_resv[3]; /* reserved - must be zero */
711 __u8 srl_flag; /* flag - see below */
712 __u8 srl_flag_param[3]; /* flag parameter */
713};
714
715enum fc_els_srl_flag {
716 FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */
717 FC_ELS_SRL_ONE = 0x01, /* scan specified loop */
718 FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */
719 FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */
720};
721
722/*
723 * ELS RLS - Read Link Error Status Block request.
724 */
725struct fc_els_rls {
726 __u8 rls_cmd; /* command */
727 __u8 rls_resv[4]; /* reserved - must be zero */
728 __u8 rls_port_id[3]; /* port ID */
729};
730
731/*
732 * ELS RLS LS_ACC Response.
733 */
734struct fc_els_rls_resp {
735 __u8 rls_cmd; /* ELS_LS_ACC */
736 __u8 rls_resv[3]; /* reserved - must be zero */
737 struct fc_els_lesb rls_lesb; /* link error status block */
738};
739
740/*
741 * ELS RLIR - Registered Link Incident Report.
742 * This is followed by the CLIR and the CLID, described below.
743 */
744struct fc_els_rlir {
745 __u8 rlir_cmd; /* command */
746 __u8 rlir_resv[3]; /* reserved - must be zero */
747 __u8 rlir_fmt; /* format (FC4-type if type specific) */
748 __u8 rlir_clr_len; /* common link incident record length */
749 __u8 rlir_cld_len; /* common link incident desc. length */
750 __u8 rlir_slr_len; /* spec. link incident record length */
751};
752
753/*
754 * CLIR - Common Link Incident Record Data. - Sent via RLIR.
755 */
756struct fc_els_clir {
757 __be64 clir_wwpn; /* incident port name */
758 __be64 clir_wwnn; /* incident port node name */
759 __u8 clir_port_type; /* incident port type */
760 __u8 clir_port_id[3]; /* incident port ID */
761
762 __be64 clir_conn_wwpn; /* connected port name */
763 __be64 clir_conn_wwnn; /* connected node name */
764 __be64 clir_fab_name; /* fabric name */
765 __be32 clir_phys_port; /* physical port number */
766 __be32 clir_trans_id; /* transaction ID */
767 __u8 clir_resv[3]; /* reserved */
768 __u8 clir_ts_fmt; /* time stamp format */
769 __be64 clir_timestamp; /* time stamp */
770};
771
772/*
773 * CLIR clir_ts_fmt - time stamp format values.
774 */
775enum fc_els_clir_ts_fmt {
776 ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */
777 ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */
778 ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */
779};
780
781/*
782 * Common Link Incident Descriptor - sent via RLIR.
783 */
784struct fc_els_clid {
785 __u8 clid_iq; /* incident qualifier flags */
786 __u8 clid_ic; /* incident code */
787 __be16 clid_epai; /* domain/area of ISL */
788};
789
790/*
791 * CLID incident qualifier flags.
792 */
793enum fc_els_clid_iq {
794 ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */
795 ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */
796 ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */
797 ELS_CLID_SEV_INFO = 0x00, /* report is informational */
798 ELS_CLID_SEV_INOP = 0x08, /* link not operational */
799 ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */
800 ELS_CLID_LASER = 0x02, /* subassembly is a laser */
801 ELS_CLID_FRU = 0x01, /* format can identify a FRU */
802};
803
804/*
805 * CLID incident code.
806 */
807enum fc_els_clid_ic {
808 ELS_CLID_IC_IMPL = 1, /* implicit incident */
809 ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */
810 ELS_CLID_IC_LOS = 3, /* loss of synch or signal */
811 ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */
812 ELS_CLID_IC_PST = 5, /* primitive sequence timeout */
813 ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */
814 ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */
815 ELS_CLID_IC_LIP = 8, /* receiving LIP */
816};
817
818#endif /* _FC_ELS_H_ */