History

UAPI: (Scripted) Disintegrate include/scsi/fc

David Howells committed 13 years ago

Commit cf028201 parent 4f670ff6 files · +4 −4Browse files

Showing the changes to include/uapi (5 of 6 files). Show all

Unified · Split

5 files
  1. include/uapi/scsi/fc/Kbuild +4 −0
  2. include/uapi/scsi/fc/fc_els.h +831 −0
  3. include/uapi/scsi/fc/fc_fs.h +348 −0
  4. include/uapi/scsi/fc/fc_gs.h +96 −0
  5. include/uapi/scsi/fc/fc_ns.h +208 −0
include/uapi/scsi/fc/Kbuild+4−0
@@ -1 +1,5 @@
11 # UAPI Header export list
2+header-y += fc_els.h
3+header-y += fc_fs.h
4+header-y += fc_gs.h
5+header-y += fc_ns.h
include/uapi/scsi/fc/fc_els.h+831−0
@@ -0,0 +1,831 @@
1+/*
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+#include <linux/types.h>
24+
25+/*
26+ * Fibre Channel Switch - Enhanced Link Services definitions.
27+ * From T11 FC-LS Rev 1.2 June 7, 2005.
28+ */
29+
30+/*
31+ * ELS Command codes - byte 0 of the frame payload
32+ */
33+enum fc_els_cmd {
34+ ELS_LS_RJT = 0x01, /* ESL reject */
35+ ELS_LS_ACC = 0x02, /* ESL Accept */
36+ ELS_PLOGI = 0x03, /* N_Port login */
37+ ELS_FLOGI = 0x04, /* F_Port login */
38+ ELS_LOGO = 0x05, /* Logout */
39+ ELS_ABTX = 0x06, /* Abort exchange - obsolete */
40+ ELS_RCS = 0x07, /* read connection status */
41+ ELS_RES = 0x08, /* read exchange status block */
42+ ELS_RSS = 0x09, /* read sequence status block */
43+ ELS_RSI = 0x0a, /* read sequence initiative */
44+ ELS_ESTS = 0x0b, /* establish streaming */
45+ ELS_ESTC = 0x0c, /* estimate credit */
46+ ELS_ADVC = 0x0d, /* advise credit */
47+ ELS_RTV = 0x0e, /* read timeout value */
48+ ELS_RLS = 0x0f, /* read link error status block */
49+ ELS_ECHO = 0x10, /* echo */
50+ ELS_TEST = 0x11, /* test */
51+ ELS_RRQ = 0x12, /* reinstate recovery qualifier */
52+ ELS_REC = 0x13, /* read exchange concise */
53+ ELS_SRR = 0x14, /* sequence retransmission request */
54+ ELS_PRLI = 0x20, /* process login */
55+ ELS_PRLO = 0x21, /* process logout */
56+ ELS_SCN = 0x22, /* state change notification */
57+ ELS_TPLS = 0x23, /* test process login state */
58+ ELS_TPRLO = 0x24, /* third party process logout */
59+ ELS_LCLM = 0x25, /* login control list mgmt (obs) */
60+ ELS_GAID = 0x30, /* get alias_ID */
61+ ELS_FACT = 0x31, /* fabric activate alias_id */
62+ ELS_FDACDT = 0x32, /* fabric deactivate alias_id */
63+ ELS_NACT = 0x33, /* N-port activate alias_id */
64+ ELS_NDACT = 0x34, /* N-port deactivate alias_id */
65+ ELS_QOSR = 0x40, /* quality of service request */
66+ ELS_RVCS = 0x41, /* read virtual circuit status */
67+ ELS_PDISC = 0x50, /* discover N_port service params */
68+ ELS_FDISC = 0x51, /* discover F_port service params */
69+ ELS_ADISC = 0x52, /* discover address */
70+ ELS_RNC = 0x53, /* report node cap (obs) */
71+ ELS_FARP_REQ = 0x54, /* FC ARP request */
72+ ELS_FARP_REPL = 0x55, /* FC ARP reply */
73+ ELS_RPS = 0x56, /* read port status block */
74+ ELS_RPL = 0x57, /* read port list */
75+ ELS_RPBC = 0x58, /* read port buffer condition */
76+ ELS_FAN = 0x60, /* fabric address notification */
77+ ELS_RSCN = 0x61, /* registered state change notification */
78+ ELS_SCR = 0x62, /* state change registration */
79+ ELS_RNFT = 0x63, /* report node FC-4 types */
80+ ELS_CSR = 0x68, /* clock synch. request */
81+ ELS_CSU = 0x69, /* clock synch. update */
82+ ELS_LINIT = 0x70, /* loop initialize */
83+ ELS_LSTS = 0x72, /* loop status */
84+ ELS_RNID = 0x78, /* request node ID data */
85+ ELS_RLIR = 0x79, /* registered link incident report */
86+ ELS_LIRR = 0x7a, /* link incident record registration */
87+ ELS_SRL = 0x7b, /* scan remote loop */
88+ ELS_SBRP = 0x7c, /* set bit-error reporting params */
89+ ELS_RPSC = 0x7d, /* report speed capabilities */
90+ ELS_QSA = 0x7e, /* query security attributes */
91+ ELS_EVFP = 0x7f, /* exchange virt. fabrics params */
92+ ELS_LKA = 0x80, /* link keep-alive */
93+ ELS_AUTH_ELS = 0x90, /* authentication ELS */
94+};
95+
96+/*
97+ * Initializer useful for decoding table.
98+ * Please keep this in sync with the above definitions.
99+ */
100+#define FC_ELS_CMDS_INIT { \
101+ [ELS_LS_RJT] = "LS_RJT", \
102+ [ELS_LS_ACC] = "LS_ACC", \
103+ [ELS_PLOGI] = "PLOGI", \
104+ [ELS_FLOGI] = "FLOGI", \
105+ [ELS_LOGO] = "LOGO", \
106+ [ELS_ABTX] = "ABTX", \
107+ [ELS_RCS] = "RCS", \
108+ [ELS_RES] = "RES", \
109+ [ELS_RSS] = "RSS", \
110+ [ELS_RSI] = "RSI", \
111+ [ELS_ESTS] = "ESTS", \
112+ [ELS_ESTC] = "ESTC", \
113+ [ELS_ADVC] = "ADVC", \
114+ [ELS_RTV] = "RTV", \
115+ [ELS_RLS] = "RLS", \
116+ [ELS_ECHO] = "ECHO", \
117+ [ELS_TEST] = "TEST", \
118+ [ELS_RRQ] = "RRQ", \
119+ [ELS_REC] = "REC", \
120+ [ELS_SRR] = "SRR", \
121+ [ELS_PRLI] = "PRLI", \
122+ [ELS_PRLO] = "PRLO", \
123+ [ELS_SCN] = "SCN", \
124+ [ELS_TPLS] = "TPLS", \
125+ [ELS_TPRLO] = "TPRLO", \
126+ [ELS_LCLM] = "LCLM", \
127+ [ELS_GAID] = "GAID", \
128+ [ELS_FACT] = "FACT", \
129+ [ELS_FDACDT] = "FDACDT", \
130+ [ELS_NACT] = "NACT", \
131+ [ELS_NDACT] = "NDACT", \
132+ [ELS_QOSR] = "QOSR", \
133+ [ELS_RVCS] = "RVCS", \
134+ [ELS_PDISC] = "PDISC", \
135+ [ELS_FDISC] = "FDISC", \
136+ [ELS_ADISC] = "ADISC", \
137+ [ELS_RNC] = "RNC", \
138+ [ELS_FARP_REQ] = "FARP_REQ", \
139+ [ELS_FARP_REPL] = "FARP_REPL", \
140+ [ELS_RPS] = "RPS", \
141+ [ELS_RPL] = "RPL", \
142+ [ELS_RPBC] = "RPBC", \
143+ [ELS_FAN] = "FAN", \
144+ [ELS_RSCN] = "RSCN", \
145+ [ELS_SCR] = "SCR", \
146+ [ELS_RNFT] = "RNFT", \
147+ [ELS_CSR] = "CSR", \
148+ [ELS_CSU] = "CSU", \
149+ [ELS_LINIT] = "LINIT", \
150+ [ELS_LSTS] = "LSTS", \
151+ [ELS_RNID] = "RNID", \
152+ [ELS_RLIR] = "RLIR", \
153+ [ELS_LIRR] = "LIRR", \
154+ [ELS_SRL] = "SRL", \
155+ [ELS_SBRP] = "SBRP", \
156+ [ELS_RPSC] = "RPSC", \
157+ [ELS_QSA] = "QSA", \
158+ [ELS_EVFP] = "EVFP", \
159+ [ELS_LKA] = "LKA", \
160+ [ELS_AUTH_ELS] = "AUTH_ELS", \
161+}
162+
163+/*
164+ * LS_ACC payload.
165+ */
166+struct fc_els_ls_acc {
167+ __u8 la_cmd; /* command code ELS_LS_ACC */
168+ __u8 la_resv[3]; /* reserved */
169+};
170+
171+/*
172+ * ELS reject payload.
173+ */
174+struct fc_els_ls_rjt {
175+ __u8 er_cmd; /* command code ELS_LS_RJT */
176+ __u8 er_resv[4]; /* reserved must be zero */
177+ __u8 er_reason; /* reason (enum fc_els_rjt_reason below) */
178+ __u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */
179+ __u8 er_vendor; /* vendor specific code */
180+};
181+
182+/*
183+ * ELS reject reason codes (er_reason).
184+ */
185+enum fc_els_rjt_reason {
186+ ELS_RJT_NONE = 0, /* no reject - not to be sent */
187+ ELS_RJT_INVAL = 0x01, /* invalid ELS command code */
188+ ELS_RJT_LOGIC = 0x03, /* logical error */
189+ ELS_RJT_BUSY = 0x05, /* logical busy */
190+ ELS_RJT_PROT = 0x07, /* protocol error */
191+ ELS_RJT_UNAB = 0x09, /* unable to perform command request */
192+ ELS_RJT_UNSUP = 0x0b, /* command not supported */
193+ ELS_RJT_INPROG = 0x0e, /* command already in progress */
194+ ELS_RJT_FIP = 0x20, /* FIP error */
195+ ELS_RJT_VENDOR = 0xff, /* vendor specific error */
196+};
197+
198+
199+/*
200+ * reason code explanation (er_explan).
201+ */
202+enum fc_els_rjt_explan {
203+ ELS_EXPL_NONE = 0x00, /* No additional explanation */
204+ ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */
205+ ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */
206+ ELS_EXPL_AH = 0x11, /* invalid association header */
207+ ELS_EXPL_AH_REQ = 0x13, /* association_header required */
208+ ELS_EXPL_SID = 0x15, /* invalid originator S_ID */
209+ ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */
210+ ELS_EXPL_INPROG = 0x19, /* Request already in progress */
211+ ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */
212+ ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */
213+ ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */
214+ ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */
215+ ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */
216+ ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */
217+ /* TBD - above definitions incomplete */
218+};
219+
220+/*
221+ * Common service parameters (N ports).
222+ */
223+struct fc_els_csp {
224+ __u8 sp_hi_ver; /* highest version supported (obs.) */
225+ __u8 sp_lo_ver; /* highest version supported (obs.) */
226+ __be16 sp_bb_cred; /* buffer-to-buffer credits */
227+ __be16 sp_features; /* common feature flags */
228+ __be16 sp_bb_data; /* b-b state number and data field sz */
229+ union {
230+ struct {
231+ __be16 _sp_tot_seq; /* total concurrent sequences */
232+ __be16 _sp_rel_off; /* rel. offset by info cat */
233+ } sp_plogi;
234+ struct {
235+ __be32 _sp_r_a_tov; /* resource alloc. timeout msec */
236+ } sp_flogi_acc;
237+ } sp_u;
238+ __be32 sp_e_d_tov; /* error detect timeout value */
239+};
240+#define sp_tot_seq sp_u.sp_plogi._sp_tot_seq
241+#define sp_rel_off sp_u.sp_plogi._sp_rel_off
242+#define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov
243+
244+#define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */
245+
246+/*
247+ * Minimum and maximum values for max data field size in service parameters.
248+ */
249+#define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD
250+#define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD
251+
252+/*
253+ * sp_features
254+ */
255+#define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */
256+#define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */
257+#define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */
258+#define FC_SP_FT_RAND 0x4000 /* random relative offset */
259+#define FC_SP_FT_VAL 0x2000 /* valid vendor version level */
260+#define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */
261+#define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */
262+#define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */
263+#define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */
264+#define FC_SP_FT_MCAST 0x0200 /* multicast */
265+#define FC_SP_FT_BCAST 0x0100 /* broadcast */
266+#define FC_SP_FT_HUNT 0x0080 /* hunt group */
267+#define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */
268+#define FC_SP_FT_SEC 0x0020 /* reserved for security */
269+#define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */
270+#define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */
271+#define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */
272+#define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */
273+#define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */
274+
275+/*
276+ * Class-specific service parameters.
277+ */
278+struct fc_els_cssp {
279+ __be16 cp_class; /* class flags */
280+ __be16 cp_init; /* initiator flags */
281+ __be16 cp_recip; /* recipient flags */
282+ __be16 cp_rdfs; /* receive data field size */
283+ __be16 cp_con_seq; /* concurrent sequences */
284+ __be16 cp_ee_cred; /* N-port end-to-end credit */
285+ __u8 cp_resv1; /* reserved */
286+ __u8 cp_open_seq; /* open sequences per exchange */
287+ __u8 _cp_resv2[2]; /* reserved */
288+};
289+
290+/*
291+ * cp_class flags.
292+ */
293+#define FC_CPC_VALID 0x8000 /* class valid */
294+#define FC_CPC_IMIX 0x4000 /* intermix mode */
295+#define FC_CPC_SEQ 0x0800 /* sequential delivery */
296+#define FC_CPC_CAMP 0x0200 /* camp-on */
297+#define FC_CPC_PRI 0x0080 /* priority */
298+
299+/*
300+ * cp_init flags.
301+ * (TBD: not all flags defined here).
302+ */
303+#define FC_CPI_CSYN 0x0010 /* clock synch. capable */
304+
305+/*
306+ * cp_recip flags.
307+ */
308+#define FC_CPR_CSYN 0x0008 /* clock synch. capable */
309+
310+/*
311+ * NFC_ELS_FLOGI: Fabric login request.
312+ * NFC_ELS_PLOGI: Port login request (same format).
313+ */
314+struct fc_els_flogi {
315+ __u8 fl_cmd; /* command */
316+ __u8 _fl_resvd[3]; /* must be zero */
317+ struct fc_els_csp fl_csp; /* common service parameters */
318+ __be64 fl_wwpn; /* port name */
319+ __be64 fl_wwnn; /* node name */
320+ struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */
321+ __u8 fl_vend[16]; /* vendor version level */
322+} __attribute__((__packed__));
323+
324+/*
325+ * Process login service parameter page.
326+ */
327+struct fc_els_spp {
328+ __u8 spp_type; /* type code or common service params */
329+ __u8 spp_type_ext; /* type code extension */
330+ __u8 spp_flags;
331+ __u8 _spp_resvd;
332+ __be32 spp_orig_pa; /* originator process associator */
333+ __be32 spp_resp_pa; /* responder process associator */
334+ __be32 spp_params; /* service parameters */
335+};
336+
337+/*
338+ * spp_flags.
339+ */
340+#define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */
341+#define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */
342+#define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */
343+#define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */
344+
345+/*
346+ * SPP response code in spp_flags - lower 4 bits.
347+ */
348+enum fc_els_spp_resp {
349+ FC_SPP_RESP_ACK = 1, /* request executed */
350+ FC_SPP_RESP_RES = 2, /* unable due to lack of resources */
351+ FC_SPP_RESP_INIT = 3, /* initialization not complete */
352+ FC_SPP_RESP_NO_PA = 4, /* unknown process associator */
353+ FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */
354+ FC_SPP_RESP_COND = 6, /* request completed conditionally */
355+ FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */
356+ FC_SPP_RESP_INVL = 8, /* SPP is invalid */
357+};
358+
359+/*
360+ * ELS_RRQ - Reinstate Recovery Qualifier
361+ */
362+struct fc_els_rrq {
363+ __u8 rrq_cmd; /* command (0x12) */
364+ __u8 rrq_zero[3]; /* specified as zero - part of cmd */
365+ __u8 rrq_resvd; /* reserved */
366+ __u8 rrq_s_id[3]; /* originator FID */
367+ __be16 rrq_ox_id; /* originator exchange ID */
368+ __be16 rrq_rx_id; /* responders exchange ID */
369+};
370+
371+/*
372+ * ELS_REC - Read exchange concise.
373+ */
374+struct fc_els_rec {
375+ __u8 rec_cmd; /* command (0x13) */
376+ __u8 rec_zero[3]; /* specified as zero - part of cmd */
377+ __u8 rec_resvd; /* reserved */
378+ __u8 rec_s_id[3]; /* originator FID */
379+ __be16 rec_ox_id; /* originator exchange ID */
380+ __be16 rec_rx_id; /* responders exchange ID */
381+};
382+
383+/*
384+ * ELS_REC LS_ACC payload.
385+ */
386+struct fc_els_rec_acc {
387+ __u8 reca_cmd; /* accept (0x02) */
388+ __u8 reca_zero[3]; /* specified as zero - part of cmd */
389+ __be16 reca_ox_id; /* originator exchange ID */
390+ __be16 reca_rx_id; /* responders exchange ID */
391+ __u8 reca_resvd1; /* reserved */
392+ __u8 reca_ofid[3]; /* originator FID */
393+ __u8 reca_resvd2; /* reserved */
394+ __u8 reca_rfid[3]; /* responder FID */
395+ __be32 reca_fc4value; /* FC4 value */
396+ __be32 reca_e_stat; /* ESB (exchange status block) status */
397+};
398+
399+/*
400+ * ELS_PRLI - Process login request and response.
401+ */
402+struct fc_els_prli {
403+ __u8 prli_cmd; /* command */
404+ __u8 prli_spp_len; /* length of each serv. parm. page */
405+ __be16 prli_len; /* length of entire payload */
406+ /* service parameter pages follow */
407+};
408+
409+/*
410+ * ELS_PRLO - Process logout request and response.
411+ */
412+struct fc_els_prlo {
413+ __u8 prlo_cmd; /* command */
414+ __u8 prlo_obs; /* obsolete, but shall be set to 10h */
415+ __be16 prlo_len; /* payload length */
416+};
417+
418+/*
419+ * ELS_ADISC payload
420+ */
421+struct fc_els_adisc {
422+ __u8 adisc_cmd;
423+ __u8 adisc_resv[3];
424+ __u8 adisc_resv1;
425+ __u8 adisc_hard_addr[3];
426+ __be64 adisc_wwpn;
427+ __be64 adisc_wwnn;
428+ __u8 adisc_resv2;
429+ __u8 adisc_port_id[3];
430+} __attribute__((__packed__));
431+
432+/*
433+ * ELS_LOGO - process or fabric logout.
434+ */
435+struct fc_els_logo {
436+ __u8 fl_cmd; /* command code */
437+ __u8 fl_zero[3]; /* specified as zero - part of cmd */
438+ __u8 fl_resvd; /* reserved */
439+ __u8 fl_n_port_id[3];/* N port ID */
440+ __be64 fl_n_port_wwn; /* port name */
441+};
442+
443+/*
444+ * ELS_RTV - read timeout value.
445+ */
446+struct fc_els_rtv {
447+ __u8 rtv_cmd; /* command code 0x0e */
448+ __u8 rtv_zero[3]; /* specified as zero - part of cmd */
449+};
450+
451+/*
452+ * LS_ACC for ELS_RTV - read timeout value.
453+ */
454+struct fc_els_rtv_acc {
455+ __u8 rtv_cmd; /* command code 0x02 */
456+ __u8 rtv_zero[3]; /* specified as zero - part of cmd */
457+ __be32 rtv_r_a_tov; /* resource allocation timeout value */
458+ __be32 rtv_e_d_tov; /* error detection timeout value */
459+ __be32 rtv_toq; /* timeout qualifier (see below) */
460+};
461+
462+/*
463+ * rtv_toq bits.
464+ */
465+#define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */
466+#define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */
467+
468+/*
469+ * ELS_SCR - state change registration payload.
470+ */
471+struct fc_els_scr {
472+ __u8 scr_cmd; /* command code */
473+ __u8 scr_resv[6]; /* reserved */
474+ __u8 scr_reg_func; /* registration function (see below) */
475+};
476+
477+enum fc_els_scr_func {
478+ ELS_SCRF_FAB = 1, /* fabric-detected registration */
479+ ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */
480+ ELS_SCRF_FULL = 3, /* full registration */
481+ ELS_SCRF_CLEAR = 255, /* remove any current registrations */
482+};
483+
484+/*
485+ * ELS_RSCN - registered state change notification payload.
486+ */
487+struct fc_els_rscn {
488+ __u8 rscn_cmd; /* RSCN opcode (0x61) */
489+ __u8 rscn_page_len; /* page length (4) */
490+ __be16 rscn_plen; /* payload length including this word */
491+
492+ /* followed by 4-byte generic affected Port_ID pages */
493+};
494+
495+struct fc_els_rscn_page {
496+ __u8 rscn_page_flags; /* event and address format */
497+ __u8 rscn_fid[3]; /* fabric ID */
498+};
499+
500+#define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */
501+#define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */
502+#define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */
503+#define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */
504+
505+enum fc_els_rscn_ev_qual {
506+ ELS_EV_QUAL_NONE = 0, /* unspecified */
507+ ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */
508+ ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */
509+ ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */
510+ ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */
511+ ELS_EV_QUAL_REM_OBJ = 5, /* removed object */
512+};
513+
514+enum fc_els_rscn_addr_fmt {
515+ ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */
516+ ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */
517+ ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */
518+ ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */
519+};
520+
521+/*
522+ * ELS_RNID - request Node ID.
523+ */
524+struct fc_els_rnid {
525+ __u8 rnid_cmd; /* RNID opcode (0x78) */
526+ __u8 rnid_resv[3]; /* reserved */
527+ __u8 rnid_fmt; /* data format */
528+ __u8 rnid_resv2[3]; /* reserved */
529+};
530+
531+/*
532+ * Node Identification Data formats (rnid_fmt)
533+ */
534+enum fc_els_rnid_fmt {
535+ ELS_RNIDF_NONE = 0, /* no specific identification data */
536+ ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */
537+};
538+
539+/*
540+ * ELS_RNID response.
541+ */
542+struct fc_els_rnid_resp {
543+ __u8 rnid_cmd; /* response code (LS_ACC) */
544+ __u8 rnid_resv[3]; /* reserved */
545+ __u8 rnid_fmt; /* data format */
546+ __u8 rnid_cid_len; /* common ID data length */
547+ __u8 rnid_resv2; /* reserved */
548+ __u8 rnid_sid_len; /* specific ID data length */
549+};
550+
551+struct fc_els_rnid_cid {
552+ __be64 rnid_wwpn; /* N port name */
553+ __be64 rnid_wwnn; /* node name */
554+};
555+
556+struct fc_els_rnid_gen {
557+ __u8 rnid_vend_id[16]; /* vendor-unique ID */
558+ __be32 rnid_atype; /* associated type (see below) */
559+ __be32 rnid_phys_port; /* physical port number */
560+ __be32 rnid_att_nodes; /* number of attached nodes */
561+ __u8 rnid_node_mgmt; /* node management (see below) */
562+ __u8 rnid_ip_ver; /* IP version (see below) */
563+ __be16 rnid_prot_port; /* UDP / TCP port number */
564+ __be32 rnid_ip_addr[4]; /* IP address */
565+ __u8 rnid_resvd[2]; /* reserved */
566+ __be16 rnid_vend_spec; /* vendor-specific field */
567+};
568+
569+enum fc_els_rnid_atype {
570+ ELS_RNIDA_UNK = 0x01, /* unknown */
571+ ELS_RNIDA_OTHER = 0x02, /* none of the following */
572+ ELS_RNIDA_HUB = 0x03,
573+ ELS_RNIDA_SWITCH = 0x04,
574+ ELS_RNIDA_GATEWAY = 0x05,
575+ ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */
576+ ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */
577+ ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */
578+ ELS_RNIDA_STORAGE = 0x09,
579+ ELS_RNIDA_HOST = 0x0a,
580+ ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */
581+ ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */
582+ ELS_RNIDA_NAS = 0x11, /* NAS server */
583+ ELS_RNIDA_BRIDGE = 0x12, /* bridge */
584+ ELS_RNIDA_VIRT = 0x13, /* virtualization device */
585+ ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */
586+ ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */
587+ ELS_RNIDA_MF_SW = 1UL << 30, /* switch */
588+ ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */
589+ ELS_RNIDA_MF_ST = 1UL << 28, /* storage */
590+ ELS_RNIDA_MF_HOST = 1UL << 27, /* host */
591+ ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */
592+ ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */
593+ ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */
594+ ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */
595+ ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */
596+ ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */
597+};
598+
599+enum fc_els_rnid_mgmt {
600+ ELS_RNIDM_SNMP = 0,
601+ ELS_RNIDM_TELNET = 1,
602+ ELS_RNIDM_HTTP = 2,
603+ ELS_RNIDM_HTTPS = 3,
604+ ELS_RNIDM_XML = 4, /* HTTP + XML */
605+};
606+
607+enum fc_els_rnid_ipver {
608+ ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */
609+ ELS_RNIDIP_V4 = 1, /* IPv4 */
610+ ELS_RNIDIP_V6 = 2, /* IPv6 */
611+};
612+
613+/*
614+ * ELS RPL - Read Port List.
615+ */
616+struct fc_els_rpl {
617+ __u8 rpl_cmd; /* command */
618+ __u8 rpl_resv[5]; /* reserved - must be zero */
619+ __be16 rpl_max_size; /* maximum response size or zero */
620+ __u8 rpl_resv1; /* reserved - must be zero */
621+ __u8 rpl_index[3]; /* starting index */
622+};
623+
624+/*
625+ * Port number block in RPL response.
626+ */
627+struct fc_els_pnb {
628+ __be32 pnb_phys_pn; /* physical port number */
629+ __u8 pnb_resv; /* reserved */
630+ __u8 pnb_port_id[3]; /* port ID */
631+ __be64 pnb_wwpn; /* port name */
632+};
633+
634+/*
635+ * RPL LS_ACC response.
636+ */
637+struct fc_els_rpl_resp {
638+ __u8 rpl_cmd; /* ELS_LS_ACC */
639+ __u8 rpl_resv1; /* reserved - must be zero */
640+ __be16 rpl_plen; /* payload length */
641+ __u8 rpl_resv2; /* reserved - must be zero */
642+ __u8 rpl_llen[3]; /* list length */
643+ __u8 rpl_resv3; /* reserved - must be zero */
644+ __u8 rpl_index[3]; /* starting index */
645+ struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */
646+};
647+
648+/*
649+ * Link Error Status Block.
650+ */
651+struct fc_els_lesb {
652+ __be32 lesb_link_fail; /* link failure count */
653+ __be32 lesb_sync_loss; /* loss of synchronization count */
654+ __be32 lesb_sig_loss; /* loss of signal count */
655+ __be32 lesb_prim_err; /* primitive sequence error count */
656+ __be32 lesb_inv_word; /* invalid transmission word count */
657+ __be32 lesb_inv_crc; /* invalid CRC count */
658+};
659+
660+/*
661+ * ELS RPS - Read Port Status Block request.
662+ */
663+struct fc_els_rps {
664+ __u8 rps_cmd; /* command */
665+ __u8 rps_resv[2]; /* reserved - must be zero */
666+ __u8 rps_flag; /* flag - see below */
667+ __be64 rps_port_spec; /* port selection */
668+};
669+
670+enum fc_els_rps_flag {
671+ FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */
672+ FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */
673+ FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */
674+};
675+
676+/*
677+ * ELS RPS LS_ACC response.
678+ */
679+struct fc_els_rps_resp {
680+ __u8 rps_cmd; /* command - LS_ACC */
681+ __u8 rps_resv[2]; /* reserved - must be zero */
682+ __u8 rps_flag; /* flag - see below */
683+ __u8 rps_resv2[2]; /* reserved */
684+ __be16 rps_status; /* port status - see below */
685+ struct fc_els_lesb rps_lesb; /* link error status block */
686+};
687+
688+enum fc_els_rps_resp_flag {
689+ FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */
690+};
691+
692+enum fc_els_rps_resp_status {
693+ FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */
694+ FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */
695+ FC_ELS_RPS_FAB = 1 << 3, /* fabric present */
696+ FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */
697+ FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */
698+ FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */
699+};
700+
701+/*
702+ * ELS LIRR - Link Incident Record Registration request.
703+ */
704+struct fc_els_lirr {
705+ __u8 lirr_cmd; /* command */
706+ __u8 lirr_resv[3]; /* reserved - must be zero */
707+ __u8 lirr_func; /* registration function */
708+ __u8 lirr_fmt; /* FC-4 type of RLIR requested */
709+ __u8 lirr_resv2[2]; /* reserved - must be zero */
710+};
711+
712+enum fc_els_lirr_func {
713+ ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */
714+ ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */
715+ ELS_LIRR_CLEAR = 0xff /* clear registration */
716+};
717+
718+/*
719+ * ELS SRL - Scan Remote Loop request.
720+ */
721+struct fc_els_srl {
722+ __u8 srl_cmd; /* command */
723+ __u8 srl_resv[3]; /* reserved - must be zero */
724+ __u8 srl_flag; /* flag - see below */
725+ __u8 srl_flag_param[3]; /* flag parameter */
726+};
727+
728+enum fc_els_srl_flag {
729+ FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */
730+ FC_ELS_SRL_ONE = 0x01, /* scan specified loop */
731+ FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */
732+ FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */
733+};
734+
735+/*
736+ * ELS RLS - Read Link Error Status Block request.
737+ */
738+struct fc_els_rls {
739+ __u8 rls_cmd; /* command */
740+ __u8 rls_resv[4]; /* reserved - must be zero */
741+ __u8 rls_port_id[3]; /* port ID */
742+};
743+
744+/*
745+ * ELS RLS LS_ACC Response.
746+ */
747+struct fc_els_rls_resp {
748+ __u8 rls_cmd; /* ELS_LS_ACC */
749+ __u8 rls_resv[3]; /* reserved - must be zero */
750+ struct fc_els_lesb rls_lesb; /* link error status block */
751+};
752+
753+/*
754+ * ELS RLIR - Registered Link Incident Report.
755+ * This is followed by the CLIR and the CLID, described below.
756+ */
757+struct fc_els_rlir {
758+ __u8 rlir_cmd; /* command */
759+ __u8 rlir_resv[3]; /* reserved - must be zero */
760+ __u8 rlir_fmt; /* format (FC4-type if type specific) */
761+ __u8 rlir_clr_len; /* common link incident record length */
762+ __u8 rlir_cld_len; /* common link incident desc. length */
763+ __u8 rlir_slr_len; /* spec. link incident record length */
764+};
765+
766+/*
767+ * CLIR - Common Link Incident Record Data. - Sent via RLIR.
768+ */
769+struct fc_els_clir {
770+ __be64 clir_wwpn; /* incident port name */
771+ __be64 clir_wwnn; /* incident port node name */
772+ __u8 clir_port_type; /* incident port type */
773+ __u8 clir_port_id[3]; /* incident port ID */
774+
775+ __be64 clir_conn_wwpn; /* connected port name */
776+ __be64 clir_conn_wwnn; /* connected node name */
777+ __be64 clir_fab_name; /* fabric name */
778+ __be32 clir_phys_port; /* physical port number */
779+ __be32 clir_trans_id; /* transaction ID */
780+ __u8 clir_resv[3]; /* reserved */
781+ __u8 clir_ts_fmt; /* time stamp format */
782+ __be64 clir_timestamp; /* time stamp */
783+};
784+
785+/*
786+ * CLIR clir_ts_fmt - time stamp format values.
787+ */
788+enum fc_els_clir_ts_fmt {
789+ ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */
790+ ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */
791+ ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */
792+};
793+
794+/*
795+ * Common Link Incident Descriptor - sent via RLIR.
796+ */
797+struct fc_els_clid {
798+ __u8 clid_iq; /* incident qualifier flags */
799+ __u8 clid_ic; /* incident code */
800+ __be16 clid_epai; /* domain/area of ISL */
801+};
802+
803+/*
804+ * CLID incident qualifier flags.
805+ */
806+enum fc_els_clid_iq {
807+ ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */
808+ ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */
809+ ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */
810+ ELS_CLID_SEV_INFO = 0x00, /* report is informational */
811+ ELS_CLID_SEV_INOP = 0x08, /* link not operational */
812+ ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */
813+ ELS_CLID_LASER = 0x02, /* subassembly is a laser */
814+ ELS_CLID_FRU = 0x01, /* format can identify a FRU */
815+};
816+
817+/*
818+ * CLID incident code.
819+ */
820+enum fc_els_clid_ic {
821+ ELS_CLID_IC_IMPL = 1, /* implicit incident */
822+ ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */
823+ ELS_CLID_IC_LOS = 3, /* loss of synch or signal */
824+ ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */
825+ ELS_CLID_IC_PST = 5, /* primitive sequence timeout */
826+ ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */
827+ ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */
828+ ELS_CLID_IC_LIP = 8, /* receiving LIP */
829+};
830+
831+#endif /* _FC_ELS_H_ */
include/uapi/scsi/fc/fc_fs.h+348−0
@@ -0,0 +1,348 @@
1+/*
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_FS_H_
21+#define _FC_FS_H_
22+
23+#include <linux/types.h>
24+
25+/*
26+ * Fibre Channel Framing and Signalling definitions.
27+ * From T11 FC-FS-2 Rev 0.90 - 9 August 2005.
28+ */
29+
30+/*
31+ * Frame header
32+ */
33+struct fc_frame_header {
34+ __u8 fh_r_ctl; /* routing control */
35+ __u8 fh_d_id[3]; /* Destination ID */
36+
37+ __u8 fh_cs_ctl; /* class of service control / pri */
38+ __u8 fh_s_id[3]; /* Source ID */
39+
40+ __u8 fh_type; /* see enum fc_fh_type below */
41+ __u8 fh_f_ctl[3]; /* frame control */
42+
43+ __u8 fh_seq_id; /* sequence ID */
44+ __u8 fh_df_ctl; /* data field control */
45+ __be16 fh_seq_cnt; /* sequence count */
46+
47+ __be16 fh_ox_id; /* originator exchange ID */
48+ __be16 fh_rx_id; /* responder exchange ID */
49+ __be32 fh_parm_offset; /* parameter or relative offset */
50+};
51+
52+#define FC_FRAME_HEADER_LEN 24 /* expected length of structure */
53+
54+#define FC_MAX_PAYLOAD 2112U /* max payload length in bytes */
55+#define FC_MIN_MAX_PAYLOAD 256U /* lower limit on max payload */
56+
57+#define FC_MAX_FRAME (FC_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
58+#define FC_MIN_MAX_FRAME (FC_MIN_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
59+
60+/*
61+ * fh_r_ctl - Routing control definitions.
62+ */
63+ /*
64+ * FC-4 device_data.
65+ */
66+enum fc_rctl {
67+ FC_RCTL_DD_UNCAT = 0x00, /* uncategorized information */
68+ FC_RCTL_DD_SOL_DATA = 0x01, /* solicited data */
69+ FC_RCTL_DD_UNSOL_CTL = 0x02, /* unsolicited control */
70+ FC_RCTL_DD_SOL_CTL = 0x03, /* solicited control or reply */
71+ FC_RCTL_DD_UNSOL_DATA = 0x04, /* unsolicited data */
72+ FC_RCTL_DD_DATA_DESC = 0x05, /* data descriptor */
73+ FC_RCTL_DD_UNSOL_CMD = 0x06, /* unsolicited command */
74+ FC_RCTL_DD_CMD_STATUS = 0x07, /* command status */
75+
76+#define FC_RCTL_ILS_REQ FC_RCTL_DD_UNSOL_CTL /* ILS request */
77+#define FC_RCTL_ILS_REP FC_RCTL_DD_SOL_CTL /* ILS reply */
78+
79+ /*
80+ * Extended Link_Data
81+ */
82+ FC_RCTL_ELS_REQ = 0x22, /* extended link services request */
83+ FC_RCTL_ELS_REP = 0x23, /* extended link services reply */
84+ FC_RCTL_ELS4_REQ = 0x32, /* FC-4 ELS request */
85+ FC_RCTL_ELS4_REP = 0x33, /* FC-4 ELS reply */
86+ /*
87+ * Optional Extended Headers
88+ */
89+ FC_RCTL_VFTH = 0x50, /* virtual fabric tagging header */
90+ FC_RCTL_IFRH = 0x51, /* inter-fabric routing header */
91+ FC_RCTL_ENCH = 0x52, /* encapsulation header */
92+ /*
93+ * Basic Link Services fh_r_ctl values.
94+ */
95+ FC_RCTL_BA_NOP = 0x80, /* basic link service NOP */
96+ FC_RCTL_BA_ABTS = 0x81, /* basic link service abort */
97+ FC_RCTL_BA_RMC = 0x82, /* remove connection */
98+ FC_RCTL_BA_ACC = 0x84, /* basic accept */
99+ FC_RCTL_BA_RJT = 0x85, /* basic reject */
100+ FC_RCTL_BA_PRMT = 0x86, /* dedicated connection preempted */
101+ /*
102+ * Link Control Information.
103+ */
104+ FC_RCTL_ACK_1 = 0xc0, /* acknowledge_1 */
105+ FC_RCTL_ACK_0 = 0xc1, /* acknowledge_0 */
106+ FC_RCTL_P_RJT = 0xc2, /* port reject */
107+ FC_RCTL_F_RJT = 0xc3, /* fabric reject */
108+ FC_RCTL_P_BSY = 0xc4, /* port busy */
109+ FC_RCTL_F_BSY = 0xc5, /* fabric busy to data frame */
110+ FC_RCTL_F_BSYL = 0xc6, /* fabric busy to link control frame */
111+ FC_RCTL_LCR = 0xc7, /* link credit reset */
112+ FC_RCTL_END = 0xc9, /* end */
113+};
114+ /* incomplete list of definitions */
115+
116+/*
117+ * R_CTL names initializer.
118+ * Please keep this matching the above definitions.
119+ */
120+#define FC_RCTL_NAMES_INIT { \
121+ [FC_RCTL_DD_UNCAT] = "uncat", \
122+ [FC_RCTL_DD_SOL_DATA] = "sol data", \
123+ [FC_RCTL_DD_UNSOL_CTL] = "unsol ctl", \
124+ [FC_RCTL_DD_SOL_CTL] = "sol ctl/reply", \
125+ [FC_RCTL_DD_UNSOL_DATA] = "unsol data", \
126+ [FC_RCTL_DD_DATA_DESC] = "data desc", \
127+ [FC_RCTL_DD_UNSOL_CMD] = "unsol cmd", \
128+ [FC_RCTL_DD_CMD_STATUS] = "cmd status", \
129+ [FC_RCTL_ELS_REQ] = "ELS req", \
130+ [FC_RCTL_ELS_REP] = "ELS rep", \
131+ [FC_RCTL_ELS4_REQ] = "FC-4 ELS req", \
132+ [FC_RCTL_ELS4_REP] = "FC-4 ELS rep", \
133+ [FC_RCTL_BA_NOP] = "BLS NOP", \
134+ [FC_RCTL_BA_ABTS] = "BLS abort", \
135+ [FC_RCTL_BA_RMC] = "BLS remove connection", \
136+ [FC_RCTL_BA_ACC] = "BLS accept", \
137+ [FC_RCTL_BA_RJT] = "BLS reject", \
138+ [FC_RCTL_BA_PRMT] = "BLS dedicated connection preempted", \
139+ [FC_RCTL_ACK_1] = "LC ACK_1", \
140+ [FC_RCTL_ACK_0] = "LC ACK_0", \
141+ [FC_RCTL_P_RJT] = "LC port reject", \
142+ [FC_RCTL_F_RJT] = "LC fabric reject", \
143+ [FC_RCTL_P_BSY] = "LC port busy", \
144+ [FC_RCTL_F_BSY] = "LC fabric busy to data frame", \
145+ [FC_RCTL_F_BSYL] = "LC fabric busy to link control frame",\
146+ [FC_RCTL_LCR] = "LC link credit reset", \
147+ [FC_RCTL_END] = "LC end", \
148+}
149+
150+/*
151+ * Well-known fabric addresses.
152+ */
153+enum fc_well_known_fid {
154+ FC_FID_NONE = 0x000000, /* No destination */
155+ FC_FID_BCAST = 0xffffff, /* broadcast */
156+ FC_FID_FLOGI = 0xfffffe, /* fabric login */
157+ FC_FID_FCTRL = 0xfffffd, /* fabric controller */
158+ FC_FID_DIR_SERV = 0xfffffc, /* directory server */
159+ FC_FID_TIME_SERV = 0xfffffb, /* time server */
160+ FC_FID_MGMT_SERV = 0xfffffa, /* management server */
161+ FC_FID_QOS = 0xfffff9, /* QoS Facilitator */
162+ FC_FID_ALIASES = 0xfffff8, /* alias server (FC-PH2) */
163+ FC_FID_SEC_KEY = 0xfffff7, /* Security key dist. server */
164+ FC_FID_CLOCK = 0xfffff6, /* clock synch server */
165+ FC_FID_MCAST_SERV = 0xfffff5, /* multicast server */
166+};
167+
168+#define FC_FID_WELL_KNOWN_MAX 0xffffff /* highest well-known fabric ID */
169+#define FC_FID_WELL_KNOWN_BASE 0xfffff5 /* start of well-known fabric ID */
170+
171+/*
172+ * Other well-known addresses, outside the above contiguous range.
173+ */
174+#define FC_FID_DOM_MGR 0xfffc00 /* domain manager base */
175+
176+/*
177+ * Fabric ID bytes.
178+ */
179+#define FC_FID_DOMAIN 0
180+#define FC_FID_PORT 1
181+#define FC_FID_LINK 2
182+
183+/*
184+ * fh_type codes
185+ */
186+enum fc_fh_type {
187+ FC_TYPE_BLS = 0x00, /* basic link service */
188+ FC_TYPE_ELS = 0x01, /* extended link service */
189+ FC_TYPE_IP = 0x05, /* IP over FC, RFC 4338 */
190+ FC_TYPE_FCP = 0x08, /* SCSI FCP */
191+ FC_TYPE_CT = 0x20, /* Fibre Channel Services (FC-CT) */
192+ FC_TYPE_ILS = 0x22, /* internal link service */
193+};
194+
195+/*
196+ * FC_TYPE names initializer.
197+ * Please keep this matching the above definitions.
198+ */
199+#define FC_TYPE_NAMES_INIT { \
200+ [FC_TYPE_BLS] = "BLS", \
201+ [FC_TYPE_ELS] = "ELS", \
202+ [FC_TYPE_IP] = "IP", \
203+ [FC_TYPE_FCP] = "FCP", \
204+ [FC_TYPE_CT] = "CT", \
205+ [FC_TYPE_ILS] = "ILS", \
206+}
207+
208+/*
209+ * Exchange IDs.
210+ */
211+#define FC_XID_UNKNOWN 0xffff /* unknown exchange ID */
212+#define FC_XID_MIN 0x0 /* supported min exchange ID */
213+#define FC_XID_MAX 0xfffe /* supported max exchange ID */
214+
215+/*
216+ * fh_f_ctl - Frame control flags.
217+ */
218+#define FC_FC_EX_CTX (1 << 23) /* sent by responder to exchange */
219+#define FC_FC_SEQ_CTX (1 << 22) /* sent by responder to sequence */
220+#define FC_FC_FIRST_SEQ (1 << 21) /* first sequence of this exchange */
221+#define FC_FC_LAST_SEQ (1 << 20) /* last sequence of this exchange */
222+#define FC_FC_END_SEQ (1 << 19) /* last frame of sequence */
223+#define FC_FC_END_CONN (1 << 18) /* end of class 1 connection pending */
224+#define FC_FC_RES_B17 (1 << 17) /* reserved */
225+#define FC_FC_SEQ_INIT (1 << 16) /* transfer of sequence initiative */
226+#define FC_FC_X_ID_REASS (1 << 15) /* exchange ID has been changed */
227+#define FC_FC_X_ID_INVAL (1 << 14) /* exchange ID invalidated */
228+
229+#define FC_FC_ACK_1 (1 << 12) /* 13:12 = 1: ACK_1 expected */
230+#define FC_FC_ACK_N (2 << 12) /* 13:12 = 2: ACK_N expected */
231+#define FC_FC_ACK_0 (3 << 12) /* 13:12 = 3: ACK_0 expected */
232+
233+#define FC_FC_RES_B11 (1 << 11) /* reserved */
234+#define FC_FC_RES_B10 (1 << 10) /* reserved */
235+#define FC_FC_RETX_SEQ (1 << 9) /* retransmitted sequence */
236+#define FC_FC_UNI_TX (1 << 8) /* unidirectional transmit (class 1) */
237+#define FC_FC_CONT_SEQ(i) ((i) << 6)
238+#define FC_FC_ABT_SEQ(i) ((i) << 4)
239+#define FC_FC_REL_OFF (1 << 3) /* parameter is relative offset */
240+#define FC_FC_RES2 (1 << 2) /* reserved */
241+#define FC_FC_FILL(i) ((i) & 3) /* 1:0: bytes of trailing fill */
242+
243+/*
244+ * BA_ACC payload.
245+ */
246+struct fc_ba_acc {
247+ __u8 ba_seq_id_val; /* SEQ_ID validity */
248+#define FC_BA_SEQ_ID_VAL 0x80
249+ __u8 ba_seq_id; /* SEQ_ID of seq last deliverable */
250+ __u8 ba_resvd[2]; /* reserved */
251+ __be16 ba_ox_id; /* OX_ID for aborted seq or exch */
252+ __be16 ba_rx_id; /* RX_ID for aborted seq or exch */
253+ __be16 ba_low_seq_cnt; /* low SEQ_CNT of aborted seq */
254+ __be16 ba_high_seq_cnt; /* high SEQ_CNT of aborted seq */
255+};
256+
257+/*
258+ * BA_RJT: Basic Reject payload.
259+ */
260+struct fc_ba_rjt {
261+ __u8 br_resvd; /* reserved */
262+ __u8 br_reason; /* reason code */
263+ __u8 br_explan; /* reason explanation */
264+ __u8 br_vendor; /* vendor unique code */
265+};
266+
267+/*
268+ * BA_RJT reason codes.
269+ * From FS-2.
270+ */
271+enum fc_ba_rjt_reason {
272+ FC_BA_RJT_NONE = 0, /* in software this means no reject */
273+ FC_BA_RJT_INVL_CMD = 0x01, /* invalid command code */
274+ FC_BA_RJT_LOG_ERR = 0x03, /* logical error */
275+ FC_BA_RJT_LOG_BUSY = 0x05, /* logical busy */
276+ FC_BA_RJT_PROTO_ERR = 0x07, /* protocol error */
277+ FC_BA_RJT_UNABLE = 0x09, /* unable to perform request */
278+ FC_BA_RJT_VENDOR = 0xff, /* vendor-specific (see br_vendor) */
279+};
280+
281+/*
282+ * BA_RJT reason code explanations.
283+ */
284+enum fc_ba_rjt_explan {
285+ FC_BA_RJT_EXP_NONE = 0x00, /* no additional expanation */
286+ FC_BA_RJT_INV_XID = 0x03, /* invalid OX_ID-RX_ID combination */
287+ FC_BA_RJT_ABT = 0x05, /* sequence aborted, no seq info */
288+};
289+
290+/*
291+ * P_RJT or F_RJT: Port Reject or Fabric Reject parameter field.
292+ */
293+struct fc_pf_rjt {
294+ __u8 rj_action; /* reserved */
295+ __u8 rj_reason; /* reason code */
296+ __u8 rj_resvd; /* reserved */
297+ __u8 rj_vendor; /* vendor unique code */
298+};
299+
300+/*
301+ * P_RJT and F_RJT reject reason codes.
302+ */
303+enum fc_pf_rjt_reason {
304+ FC_RJT_NONE = 0, /* non-reject (reserved by standard) */
305+ FC_RJT_INVL_DID = 0x01, /* invalid destination ID */
306+ FC_RJT_INVL_SID = 0x02, /* invalid source ID */
307+ FC_RJT_P_UNAV_T = 0x03, /* port unavailable, temporary */
308+ FC_RJT_P_UNAV = 0x04, /* port unavailable, permanent */
309+ FC_RJT_CLS_UNSUP = 0x05, /* class not supported */
310+ FC_RJT_DEL_USAGE = 0x06, /* delimiter usage error */
311+ FC_RJT_TYPE_UNSUP = 0x07, /* type not supported */
312+ FC_RJT_LINK_CTL = 0x08, /* invalid link control */
313+ FC_RJT_R_CTL = 0x09, /* invalid R_CTL field */
314+ FC_RJT_F_CTL = 0x0a, /* invalid F_CTL field */
315+ FC_RJT_OX_ID = 0x0b, /* invalid originator exchange ID */
316+ FC_RJT_RX_ID = 0x0c, /* invalid responder exchange ID */
317+ FC_RJT_SEQ_ID = 0x0d, /* invalid sequence ID */
318+ FC_RJT_DF_CTL = 0x0e, /* invalid DF_CTL field */
319+ FC_RJT_SEQ_CNT = 0x0f, /* invalid SEQ_CNT field */
320+ FC_RJT_PARAM = 0x10, /* invalid parameter field */
321+ FC_RJT_EXCH_ERR = 0x11, /* exchange error */
322+ FC_RJT_PROTO = 0x12, /* protocol error */
323+ FC_RJT_LEN = 0x13, /* incorrect length */
324+ FC_RJT_UNEXP_ACK = 0x14, /* unexpected ACK */
325+ FC_RJT_FAB_CLASS = 0x15, /* class unsupported by fabric entity */
326+ FC_RJT_LOGI_REQ = 0x16, /* login required */
327+ FC_RJT_SEQ_XS = 0x17, /* excessive sequences attempted */
328+ FC_RJT_EXCH_EST = 0x18, /* unable to establish exchange */
329+ FC_RJT_FAB_UNAV = 0x1a, /* fabric unavailable */
330+ FC_RJT_VC_ID = 0x1b, /* invalid VC_ID (class 4) */
331+ FC_RJT_CS_CTL = 0x1c, /* invalid CS_CTL field */
332+ FC_RJT_INSUF_RES = 0x1d, /* insuff. resources for VC (Class 4) */
333+ FC_RJT_INVL_CLS = 0x1f, /* invalid class of service */
334+ FC_RJT_PREEMT_RJT = 0x20, /* preemption request rejected */
335+ FC_RJT_PREEMT_DIS = 0x21, /* preemption not enabled */
336+ FC_RJT_MCAST_ERR = 0x22, /* multicast error */
337+ FC_RJT_MCAST_ET = 0x23, /* multicast error terminate */
338+ FC_RJT_PRLI_REQ = 0x24, /* process login required */
339+ FC_RJT_INVL_ATT = 0x25, /* invalid attachment */
340+ FC_RJT_VENDOR = 0xff, /* vendor specific reject */
341+};
342+
343+/* default timeout values */
344+
345+#define FC_DEF_E_D_TOV 2000UL
346+#define FC_DEF_R_A_TOV 10000UL
347+
348+#endif /* _FC_FS_H_ */
include/uapi/scsi/fc/fc_gs.h+96−0
@@ -0,0 +1,96 @@
1+/*
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_GS_H_
21+#define _FC_GS_H_
22+
23+#include <linux/types.h>
24+
25+/*
26+ * Fibre Channel Services - Common Transport.
27+ * From T11.org FC-GS-2 Rev 5.3 November 1998.
28+ */
29+
30+struct fc_ct_hdr {
31+ __u8 ct_rev; /* revision */
32+ __u8 ct_in_id[3]; /* N_Port ID of original requestor */
33+ __u8 ct_fs_type; /* type of fibre channel service */
34+ __u8 ct_fs_subtype; /* subtype */
35+ __u8 ct_options;
36+ __u8 _ct_resvd1;
37+ __be16 ct_cmd; /* command / response code */
38+ __be16 ct_mr_size; /* maximum / residual size */
39+ __u8 _ct_resvd2;
40+ __u8 ct_reason; /* reject reason */
41+ __u8 ct_explan; /* reason code explanation */
42+ __u8 ct_vendor; /* vendor unique data */
43+};
44+
45+#define FC_CT_HDR_LEN 16 /* expected sizeof (struct fc_ct_hdr) */
46+
47+enum fc_ct_rev {
48+ FC_CT_REV = 1 /* common transport revision */
49+};
50+
51+/*
52+ * ct_fs_type values.
53+ */
54+enum fc_ct_fs_type {
55+ FC_FST_ALIAS = 0xf8, /* alias service */
56+ FC_FST_MGMT = 0xfa, /* management service */
57+ FC_FST_TIME = 0xfb, /* time service */
58+ FC_FST_DIR = 0xfc, /* directory service */
59+};
60+
61+/*
62+ * ct_cmd: Command / response codes
63+ */
64+enum fc_ct_cmd {
65+ FC_FS_RJT = 0x8001, /* reject */
66+ FC_FS_ACC = 0x8002, /* accept */
67+};
68+
69+/*
70+ * FS_RJT reason codes.
71+ */
72+enum fc_ct_reason {
73+ FC_FS_RJT_CMD = 0x01, /* invalid command code */
74+ FC_FS_RJT_VER = 0x02, /* invalid version level */
75+ FC_FS_RJT_LOG = 0x03, /* logical error */
76+ FC_FS_RJT_IUSIZ = 0x04, /* invalid IU size */
77+ FC_FS_RJT_BSY = 0x05, /* logical busy */
78+ FC_FS_RJT_PROTO = 0x07, /* protocol error */
79+ FC_FS_RJT_UNABL = 0x09, /* unable to perform command request */
80+ FC_FS_RJT_UNSUP = 0x0b, /* command not supported */
81+};
82+
83+/*
84+ * FS_RJT reason code explanations.
85+ */
86+enum fc_ct_explan {
87+ FC_FS_EXP_NONE = 0x00, /* no additional explanation */
88+ FC_FS_EXP_PID = 0x01, /* port ID not registered */
89+ FC_FS_EXP_PNAM = 0x02, /* port name not registered */
90+ FC_FS_EXP_NNAM = 0x03, /* node name not registered */
91+ FC_FS_EXP_COS = 0x04, /* class of service not registered */
92+ FC_FS_EXP_FTNR = 0x07, /* FC-4 types not registered */
93+ /* definitions not complete */
94+};
95+
96+#endif /* _FC_GS_H_ */
include/uapi/scsi/fc/fc_ns.h+208−0
@@ -0,0 +1,208 @@
1+/*
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_NS_H_
21+#define _FC_NS_H_
22+
23+#include <linux/types.h>
24+
25+/*
26+ * Fibre Channel Services - Name Service (dNS)
27+ * From T11.org FC-GS-2 Rev 5.3 November 1998.
28+ */
29+
30+/*
31+ * Common-transport sub-type for Name Server.
32+ */
33+#define FC_NS_SUBTYPE 2 /* fs_ct_hdr.ct_fs_subtype */
34+
35+/*
36+ * Name server Requests.
37+ * Note: this is an incomplete list, some unused requests are omitted.
38+ */
39+enum fc_ns_req {
40+ FC_NS_GA_NXT = 0x0100, /* get all next */
41+ FC_NS_GI_A = 0x0101, /* get identifiers - scope */
42+ FC_NS_GPN_ID = 0x0112, /* get port name by ID */
43+ FC_NS_GNN_ID = 0x0113, /* get node name by ID */
44+ FC_NS_GSPN_ID = 0x0118, /* get symbolic port name */
45+ FC_NS_GID_PN = 0x0121, /* get ID for port name */
46+ FC_NS_GID_NN = 0x0131, /* get IDs for node name */
47+ FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */
48+ FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */
49+ FC_NS_GID_PT = 0x01a1, /* get IDs by port type */
50+ FC_NS_RPN_ID = 0x0212, /* reg port name for ID */
51+ FC_NS_RNN_ID = 0x0213, /* reg node name for ID */
52+ FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */
53+ FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */
54+ FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */
55+ FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */
56+};
57+
58+/*
59+ * Port type values.
60+ */
61+enum fc_ns_pt {
62+ FC_NS_UNID_PORT = 0x00, /* unidentified */
63+ FC_NS_N_PORT = 0x01, /* N port */
64+ FC_NS_NL_PORT = 0x02, /* NL port */
65+ FC_NS_FNL_PORT = 0x03, /* F/NL port */
66+ FC_NS_NX_PORT = 0x7f, /* Nx port */
67+ FC_NS_F_PORT = 0x81, /* F port */
68+ FC_NS_FL_PORT = 0x82, /* FL port */
69+ FC_NS_E_PORT = 0x84, /* E port */
70+ FC_NS_B_PORT = 0x85, /* B port */
71+};
72+
73+/*
74+ * Port type object.
75+ */
76+struct fc_ns_pt_obj {
77+ __u8 pt_type;
78+};
79+
80+/*
81+ * Port ID object
82+ */
83+struct fc_ns_fid {
84+ __u8 fp_flags; /* flags for responses only */
85+ __u8 fp_fid[3];
86+};
87+
88+/*
89+ * fp_flags in port ID object, for responses only.
90+ */
91+#define FC_NS_FID_LAST 0x80 /* last object */
92+
93+/*
94+ * FC4-types object.
95+ */
96+#define FC_NS_TYPES 256 /* number of possible FC-4 types */
97+#define FC_NS_BPW 32 /* bits per word in bitmap */
98+
99+struct fc_ns_fts {
100+ __be32 ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */
101+};
102+
103+/*
104+ * FC4-features object.
105+ */
106+struct fc_ns_ff {
107+ __be32 fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */
108+};
109+
110+/*
111+ * GID_PT request.
112+ */
113+struct fc_ns_gid_pt {
114+ __u8 fn_pt_type;
115+ __u8 fn_domain_id_scope;
116+ __u8 fn_area_id_scope;
117+ __u8 fn_resvd;
118+};
119+
120+/*
121+ * GID_FT or GPN_FT request.
122+ */
123+struct fc_ns_gid_ft {
124+ __u8 fn_resvd;
125+ __u8 fn_domain_id_scope;
126+ __u8 fn_area_id_scope;
127+ __u8 fn_fc4_type;
128+};
129+
130+/*
131+ * GPN_FT response.
132+ */
133+struct fc_gpn_ft_resp {
134+ __u8 fp_flags; /* see fp_flags definitions above */
135+ __u8 fp_fid[3]; /* port ID */
136+ __be32 fp_resvd;
137+ __be64 fp_wwpn; /* port name */
138+};
139+
140+/*
141+ * GID_PN request
142+ */
143+struct fc_ns_gid_pn {
144+ __be64 fn_wwpn; /* port name */
145+};
146+
147+/*
148+ * GID_PN response or GSPN_ID request
149+ */
150+struct fc_gid_pn_resp {
151+ __u8 fp_resvd;
152+ __u8 fp_fid[3]; /* port ID */
153+};
154+
155+/*
156+ * GSPN_ID response
157+ */
158+struct fc_gspn_resp {
159+ __u8 fp_name_len;
160+ char fp_name[];
161+};
162+
163+/*
164+ * RFT_ID request - register FC-4 types for ID.
165+ */
166+struct fc_ns_rft_id {
167+ struct fc_ns_fid fr_fid; /* port ID object */
168+ struct fc_ns_fts fr_fts; /* FC-4 types object */
169+};
170+
171+/*
172+ * RPN_ID request - register port name for ID.
173+ * RNN_ID request - register node name for ID.
174+ */
175+struct fc_ns_rn_id {
176+ struct fc_ns_fid fr_fid; /* port ID object */
177+ __be64 fr_wwn; /* node name or port name */
178+} __attribute__((__packed__));
179+
180+/*
181+ * RSNN_NN request - register symbolic node name
182+ */
183+struct fc_ns_rsnn {
184+ __be64 fr_wwn; /* node name */
185+ __u8 fr_name_len;
186+ char fr_name[];
187+} __attribute__((__packed__));
188+
189+/*
190+ * RSPN_ID request - register symbolic port name
191+ */
192+struct fc_ns_rspn {
193+ struct fc_ns_fid fr_fid; /* port ID object */
194+ __u8 fr_name_len;
195+ char fr_name[];
196+} __attribute__((__packed__));
197+
198+/*
199+ * RFF_ID request - register FC-4 Features for ID.
200+ */
201+struct fc_ns_rff_id {
202+ struct fc_ns_fid fr_fid; /* port ID object */
203+ __u8 fr_resvd[2];
204+ __u8 fr_feat; /* FC-4 Feature bits */
205+ __u8 fr_type; /* FC-4 type */
206+} __attribute__((__packed__));
207+
208+#endif /* _FC_NS_H_ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t