aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-03-02 14:42:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-03-02 14:42:16 -0500
commit426d266c12e9116497e3055212f823a56e1a6914 (patch)
treec65828dd2f7aca6da8267f2a405ba39789eb6581 /include/uapi
parent20e6926dcbafa1b361f1c29d967688be14b6ca4b (diff)
parent3e34c1fc2b51f117045e4a2472572f14ac91df6e (diff)
Merge tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley: "This is an assorted set of stragglers into the merge window with driver updates for qla2xxx, megaraid_sas, storvsc and ufs. It also includes pulls of the uapi tree (all the remaining SCSI pieces) and the fcoe tree (updates to fcoe and libfc)" * tag 'scsi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (81 commits) [SCSI] ufs: Separate PCI code into glue driver [SCSI] ufs: Segregate PCI Specific Code [SCSI] scsi: fix lpfc build when wmb() is defined as mb() [SCSI] storvsc: Handle dynamic resizing of the device [SCSI] storvsc: Restructure error handling code on command completion [SCSI] storvsc: avoid usage of WRITE_SAME [SCSI] aacraid: suppress two GCC warnings [SCSI] hpsa: check for dma_mapping_error in hpsa_passthru ioctls [SCSI] hpsa: reorganize error handling in hpsa_passthru_ioctl [SCSI] hpsa: check for dma_mapping_error in hpsa_map_sg_chain_block [SCSI] hpsa: Check for dma_mapping_error for all code paths using fill_cmd [SCSI] hpsa: Check for dma_mapping_error in hpsa_map_one [SCSI] dc395x: uninitialized variable in device_alloc() [SCSI] Fix range check in scsi_host_dif_capable() [SCSI] storvsc: Initialize the sglist [SCSI] mpt2sas: Add support for OEM specific controller [SCSI] ipr: Fix oops while resetting an ipr adapter [SCSI] fnic: Fnic Trace Utility [SCSI] fnic: New debug flags and debug log messages [SCSI] fnic: fnic driver may hit BUG_ON on device reset ...
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/scsi/Kbuild3
-rw-r--r--include/uapi/scsi/fc/Kbuild4
-rw-r--r--include/uapi/scsi/fc/fc_els.h831
-rw-r--r--include/uapi/scsi/fc/fc_fs.h348
-rw-r--r--include/uapi/scsi/fc/fc_gs.h96
-rw-r--r--include/uapi/scsi/fc/fc_ns.h208
-rw-r--r--include/uapi/scsi/scsi_bsg_fc.h320
-rw-r--r--include/uapi/scsi/scsi_netlink.h123
-rw-r--r--include/uapi/scsi/scsi_netlink_fc.h71
9 files changed, 2004 insertions, 0 deletions
diff --git a/include/uapi/scsi/Kbuild b/include/uapi/scsi/Kbuild
index 29a87dd26cfb..75746d52f208 100644
--- a/include/uapi/scsi/Kbuild
+++ b/include/uapi/scsi/Kbuild
@@ -1,2 +1,5 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += fc/ 2header-y += fc/
3header-y += scsi_bsg_fc.h
4header-y += scsi_netlink.h
5header-y += scsi_netlink_fc.h
diff --git a/include/uapi/scsi/fc/Kbuild b/include/uapi/scsi/fc/Kbuild
index aafaa5aa54d4..5ead9fac265c 100644
--- a/include/uapi/scsi/fc/Kbuild
+++ b/include/uapi/scsi/fc/Kbuild
@@ -1 +1,5 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += fc_els.h
3header-y += fc_fs.h
4header-y += fc_gs.h
5header-y += fc_ns.h
diff --git a/include/uapi/scsi/fc/fc_els.h b/include/uapi/scsi/fc/fc_els.h
new file mode 100644
index 000000000000..481abbd48e39
--- /dev/null
+++ b/include/uapi/scsi/fc/fc_els.h
@@ -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 */
33enum 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 */
166struct 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 */
174struct 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 */
185enum 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 */
202enum 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 */
223struct 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 */
278struct 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 */
314struct 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 */
327struct 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 */
348enum 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 */
362struct 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 */
374struct 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 */
386struct 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 */
402struct 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 */
412struct 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 */
421struct 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 */
435struct 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 */
446struct 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 */
454struct 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 */
471struct 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
477enum 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 */
487struct 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
495struct 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
505enum 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
514enum 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 */
524struct 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 */
534enum 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 */
542struct 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
551struct fc_els_rnid_cid {
552 __be64 rnid_wwpn; /* N port name */
553 __be64 rnid_wwnn; /* node name */
554};
555
556struct 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
569enum 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
599enum 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
607enum 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 */
616struct 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 */
627struct 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 */
637struct 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 */
651struct 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 */
663struct 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
670enum 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 */
679struct 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
688enum fc_els_rps_resp_flag {
689 FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */
690};
691
692enum 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 */
704struct 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
712enum 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 */
721struct 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
728enum 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 */
738struct 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 */
747struct 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 */
757struct 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 */
769struct 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 */
788enum 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 */
797struct 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 */
806enum 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 */
820enum 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_ */
diff --git a/include/uapi/scsi/fc/fc_fs.h b/include/uapi/scsi/fc/fc_fs.h
new file mode 100644
index 000000000000..50f28b143451
--- /dev/null
+++ b/include/uapi/scsi/fc/fc_fs.h
@@ -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 */
33struct 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 */
66enum 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 */
153enum 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 */
186enum 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 */
246struct 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 */
260struct 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 */
271enum 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 */
284enum 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 */
293struct 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 */
303enum 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_ */
diff --git a/include/uapi/scsi/fc/fc_gs.h b/include/uapi/scsi/fc/fc_gs.h
new file mode 100644
index 000000000000..a37346d47eb1
--- /dev/null
+++ b/include/uapi/scsi/fc/fc_gs.h
@@ -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
30struct 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
47enum fc_ct_rev {
48 FC_CT_REV = 1 /* common transport revision */
49};
50
51/*
52 * ct_fs_type values.
53 */
54enum 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 */
64enum fc_ct_cmd {
65 FC_FS_RJT = 0x8001, /* reject */
66 FC_FS_ACC = 0x8002, /* accept */
67};
68
69/*
70 * FS_RJT reason codes.
71 */
72enum 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 */
86enum 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_ */
diff --git a/include/uapi/scsi/fc/fc_ns.h b/include/uapi/scsi/fc/fc_ns.h
new file mode 100644
index 000000000000..f7751d53f1d3
--- /dev/null
+++ b/include/uapi/scsi/fc/fc_ns.h
@@ -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 */
39enum 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 */
61enum 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 */
76struct fc_ns_pt_obj {
77 __u8 pt_type;
78};
79
80/*
81 * Port ID object
82 */
83struct 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
99struct 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 */
106struct 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 */
113struct 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 */
123struct 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 */
133struct 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 */
143struct fc_ns_gid_pn {
144 __be64 fn_wwpn; /* port name */
145};
146
147/*
148 * GID_PN response or GSPN_ID request
149 */
150struct fc_gid_pn_resp {
151 __u8 fp_resvd;
152 __u8 fp_fid[3]; /* port ID */
153};
154
155/*
156 * GSPN_ID response
157 */
158struct 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 */
166struct 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 */
175struct 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 */
183struct 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 */
192struct 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 */
201struct 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_ */
diff --git a/include/uapi/scsi/scsi_bsg_fc.h b/include/uapi/scsi/scsi_bsg_fc.h
new file mode 100644
index 000000000000..3031b900b087
--- /dev/null
+++ b/include/uapi/scsi/scsi_bsg_fc.h
@@ -0,0 +1,320 @@
1/*
2 * FC Transport BSG Interface
3 *
4 * Copyright (C) 2008 James Smart, Emulex Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#ifndef SCSI_BSG_FC_H
23#define SCSI_BSG_FC_H
24
25/*
26 * This file intended to be included by both kernel and user space
27 */
28
29/*
30 * FC Transport SGIO v4 BSG Message Support
31 */
32
33/* Default BSG request timeout (in seconds) */
34#define FC_DEFAULT_BSG_TIMEOUT (10 * HZ)
35
36
37/*
38 * Request Message Codes supported by the FC Transport
39 */
40
41/* define the class masks for the message codes */
42#define FC_BSG_CLS_MASK 0xF0000000 /* find object class */
43#define FC_BSG_HST_MASK 0x80000000 /* fc host class */
44#define FC_BSG_RPT_MASK 0x40000000 /* fc rport class */
45
46 /* fc_host Message Codes */
47#define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001)
48#define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002)
49#define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003)
50#define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004)
51#define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF)
52
53 /* fc_rport Message Codes */
54#define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001)
55#define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002)
56
57
58
59/*
60 * FC Address Identifiers in Message Structures :
61 *
62 * Whenever a command payload contains a FC Address Identifier
63 * (aka port_id), the value is effectively in big-endian
64 * order, thus the array elements are decoded as follows:
65 * element [0] is bits 23:16 of the FC Address Identifier
66 * element [1] is bits 15:8 of the FC Address Identifier
67 * element [2] is bits 7:0 of the FC Address Identifier
68 */
69
70
71/*
72 * FC Host Messages
73 */
74
75/* FC_BSG_HST_ADDR_PORT : */
76
77/* Request:
78 * This message requests the FC host to login to the remote port
79 * at the specified N_Port_Id. The remote port is to be enumerated
80 * with the transport upon completion of the login.
81 */
82struct fc_bsg_host_add_rport {
83 uint8_t reserved;
84
85 /* FC Address Identier of the remote port to login to */
86 uint8_t port_id[3];
87};
88
89/* Response:
90 * There is no additional response data - fc_bsg_reply->result is sufficient
91 */
92
93
94/* FC_BSG_HST_DEL_RPORT : */
95
96/* Request:
97 * This message requests the FC host to remove an enumerated
98 * remote port and to terminate the login to it.
99 *
100 * Note: The driver is free to reject this request if it desires to
101 * remain logged in with the remote port.
102 */
103struct fc_bsg_host_del_rport {
104 uint8_t reserved;
105
106 /* FC Address Identier of the remote port to logout of */
107 uint8_t port_id[3];
108};
109
110/* Response:
111 * There is no additional response data - fc_bsg_reply->result is sufficient
112 */
113
114
115/* FC_BSG_HST_ELS_NOLOGIN : */
116
117/* Request:
118 * This message requests the FC_Host to send an ELS to a specific
119 * N_Port_ID. The host does not need to log into the remote port,
120 * nor does it need to enumerate the rport for further traffic
121 * (although, the FC host is free to do so if it desires).
122 */
123struct fc_bsg_host_els {
124 /*
125 * ELS Command Code being sent (must be the same as byte 0
126 * of the payload)
127 */
128 uint8_t command_code;
129
130 /* FC Address Identier of the remote port to send the ELS to */
131 uint8_t port_id[3];
132};
133
134/* Response:
135 */
136/* fc_bsg_ctels_reply->status values */
137#define FC_CTELS_STATUS_OK 0x00000000
138#define FC_CTELS_STATUS_REJECT 0x00000001
139#define FC_CTELS_STATUS_P_RJT 0x00000002
140#define FC_CTELS_STATUS_F_RJT 0x00000003
141#define FC_CTELS_STATUS_P_BSY 0x00000004
142#define FC_CTELS_STATUS_F_BSY 0x00000006
143struct fc_bsg_ctels_reply {
144 /*
145 * Note: An ELS LS_RJT may be reported in 2 ways:
146 * a) A status of FC_CTELS_STATUS_OK is returned. The caller
147 * is to look into the ELS receive payload to determine
148 * LS_ACC or LS_RJT (by contents of word 0). The reject
149 * data will be in word 1.
150 * b) A status of FC_CTELS_STATUS_REJECT is returned, The
151 * rjt_data field will contain valid data.
152 *
153 * Note: ELS LS_ACC is determined by an FC_CTELS_STATUS_OK, and
154 * the receive payload word 0 indicates LS_ACC
155 * (e.g. value is 0x02xxxxxx).
156 *
157 * Note: Similarly, a CT Reject may be reported in 2 ways:
158 * a) A status of FC_CTELS_STATUS_OK is returned. The caller
159 * is to look into the CT receive payload to determine
160 * Accept or Reject (by contents of word 2). The reject
161 * data will be in word 3.
162 * b) A status of FC_CTELS_STATUS_REJECT is returned, The
163 * rjt_data field will contain valid data.
164 *
165 * Note: x_RJT/BSY status will indicae that the rjt_data field
166 * is valid and contains the reason/explanation values.
167 */
168 uint32_t status; /* See FC_CTELS_STATUS_xxx */
169
170 /* valid if status is not FC_CTELS_STATUS_OK */
171 struct {
172 uint8_t action; /* fragment_id for CT REJECT */
173 uint8_t reason_code;
174 uint8_t reason_explanation;
175 uint8_t vendor_unique;
176 } rjt_data;
177};
178
179
180/* FC_BSG_HST_CT : */
181
182/* Request:
183 * This message requests that a CT Request be performed with the
184 * indicated N_Port_ID. The driver is responsible for logging in with
185 * the fabric and/or N_Port_ID, etc as per FC rules. This request does
186 * not mandate that the driver must enumerate the destination in the
187 * transport. The driver is allowed to decide whether to enumerate it,
188 * and whether to tear it down after the request.
189 */
190struct fc_bsg_host_ct {
191 uint8_t reserved;
192
193 /* FC Address Identier of the remote port to send the ELS to */
194 uint8_t port_id[3];
195
196 /*
197 * We need words 0-2 of the generic preamble for the LLD's
198 */
199 uint32_t preamble_word0; /* revision & IN_ID */
200 uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
201 uint32_t preamble_word2; /* Cmd Code, Max Size */
202
203};
204/* Response:
205 *
206 * The reply structure is an fc_bsg_ctels_reply structure
207 */
208
209
210/* FC_BSG_HST_VENDOR : */
211
212/* Request:
213 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
214 * formatting requirements specified in scsi_netlink.h
215 */
216struct fc_bsg_host_vendor {
217 /*
218 * Identifies the vendor that the message is formatted for. This
219 * should be the recipient of the message.
220 */
221 uint64_t vendor_id;
222
223 /* start of vendor command area */
224 uint32_t vendor_cmd[0];
225};
226
227/* Response:
228 */
229struct fc_bsg_host_vendor_reply {
230 /* start of vendor response area */
231 uint32_t vendor_rsp[0];
232};
233
234
235
236/*
237 * FC Remote Port Messages
238 */
239
240/* FC_BSG_RPT_ELS : */
241
242/* Request:
243 * This message requests that an ELS be performed with the rport.
244 */
245struct fc_bsg_rport_els {
246 /*
247 * ELS Command Code being sent (must be the same as
248 * byte 0 of the payload)
249 */
250 uint8_t els_code;
251};
252
253/* Response:
254 *
255 * The reply structure is an fc_bsg_ctels_reply structure
256 */
257
258
259/* FC_BSG_RPT_CT : */
260
261/* Request:
262 * This message requests that a CT Request be performed with the rport.
263 */
264struct fc_bsg_rport_ct {
265 /*
266 * We need words 0-2 of the generic preamble for the LLD's
267 */
268 uint32_t preamble_word0; /* revision & IN_ID */
269 uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
270 uint32_t preamble_word2; /* Cmd Code, Max Size */
271};
272/* Response:
273 *
274 * The reply structure is an fc_bsg_ctels_reply structure
275 */
276
277
278
279
280/* request (CDB) structure of the sg_io_v4 */
281struct fc_bsg_request {
282 uint32_t msgcode;
283 union {
284 struct fc_bsg_host_add_rport h_addrport;
285 struct fc_bsg_host_del_rport h_delrport;
286 struct fc_bsg_host_els h_els;
287 struct fc_bsg_host_ct h_ct;
288 struct fc_bsg_host_vendor h_vendor;
289
290 struct fc_bsg_rport_els r_els;
291 struct fc_bsg_rport_ct r_ct;
292 } rqst_data;
293} __attribute__((packed));
294
295
296/* response (request sense data) structure of the sg_io_v4 */
297struct fc_bsg_reply {
298 /*
299 * The completion result. Result exists in two forms:
300 * if negative, it is an -Exxx system errno value. There will
301 * be no further reply information supplied.
302 * else, it's the 4-byte scsi error result, with driver, host,
303 * msg and status fields. The per-msgcode reply structure
304 * will contain valid data.
305 */
306 uint32_t result;
307
308 /* If there was reply_payload, how much was recevied ? */
309 uint32_t reply_payload_rcv_len;
310
311 union {
312 struct fc_bsg_host_vendor_reply vendor_reply;
313
314 struct fc_bsg_ctels_reply ctels_reply;
315 } reply_data;
316};
317
318
319#endif /* SCSI_BSG_FC_H */
320
diff --git a/include/uapi/scsi/scsi_netlink.h b/include/uapi/scsi/scsi_netlink.h
new file mode 100644
index 000000000000..62b4edab15d3
--- /dev/null
+++ b/include/uapi/scsi/scsi_netlink.h
@@ -0,0 +1,123 @@
1/*
2 * SCSI Transport Netlink Interface
3 * Used for the posting of outbound SCSI transport events
4 *
5 * Copyright (C) 2006 James Smart, Emulex Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22#ifndef SCSI_NETLINK_H
23#define SCSI_NETLINK_H
24
25#include <linux/netlink.h>
26#include <linux/types.h>
27
28/*
29 * This file intended to be included by both kernel and user space
30 */
31
32/* Single Netlink Message type to send all SCSI Transport messages */
33#define SCSI_TRANSPORT_MSG NLMSG_MIN_TYPE + 1
34
35/* SCSI Transport Broadcast Groups */
36 /* leaving groups 0 and 1 unassigned */
37#define SCSI_NL_GRP_FC_EVENTS (1<<2) /* Group 2 */
38#define SCSI_NL_GRP_CNT 3
39
40
41/* SCSI_TRANSPORT_MSG event message header */
42struct scsi_nl_hdr {
43 uint8_t version;
44 uint8_t transport;
45 uint16_t magic;
46 uint16_t msgtype;
47 uint16_t msglen;
48} __attribute__((aligned(sizeof(uint64_t))));
49
50/* scsi_nl_hdr->version value */
51#define SCSI_NL_VERSION 1
52
53/* scsi_nl_hdr->magic value */
54#define SCSI_NL_MAGIC 0xA1B2
55
56/* scsi_nl_hdr->transport value */
57#define SCSI_NL_TRANSPORT 0
58#define SCSI_NL_TRANSPORT_FC 1
59#define SCSI_NL_MAX_TRANSPORTS 2
60
61/* Transport-based scsi_nl_hdr->msgtype values are defined in each transport */
62
63/*
64 * GENERIC SCSI scsi_nl_hdr->msgtype Values
65 */
66 /* kernel -> user */
67#define SCSI_NL_SHOST_VENDOR 0x0001
68 /* user -> kernel */
69/* SCSI_NL_SHOST_VENDOR msgtype is kernel->user and user->kernel */
70
71
72/*
73 * Message Structures :
74 */
75
76/* macro to round up message lengths to 8byte boundary */
77#define SCSI_NL_MSGALIGN(len) (((len) + 7) & ~7)
78
79
80/*
81 * SCSI HOST Vendor Unique messages :
82 * SCSI_NL_SHOST_VENDOR
83 *
84 * Note: The Vendor Unique message payload will begin directly after
85 * this structure, with the length of the payload per vmsg_datalen.
86 *
87 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
88 * formatting requirements specified below
89 */
90struct scsi_nl_host_vendor_msg {
91 struct scsi_nl_hdr snlh; /* must be 1st element ! */
92 uint64_t vendor_id;
93 uint16_t host_no;
94 uint16_t vmsg_datalen;
95} __attribute__((aligned(sizeof(uint64_t))));
96
97
98/*
99 * Vendor ID:
100 * If transports post vendor-unique events, they must pass a well-known
101 * 32-bit vendor identifier. This identifier consists of 8 bits indicating
102 * the "type" of identifier contained, and 24 bits of id data.
103 *
104 * Identifiers for each type:
105 * PCI : ID data is the 16 bit PCI Registered Vendor ID
106 */
107#define SCSI_NL_VID_TYPE_SHIFT 56
108#define SCSI_NL_VID_TYPE_MASK ((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
109#define SCSI_NL_VID_TYPE_PCI ((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
110#define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK)
111
112
113#define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen) \
114 { \
115 (hdr)->version = SCSI_NL_VERSION; \
116 (hdr)->transport = t; \
117 (hdr)->magic = SCSI_NL_MAGIC; \
118 (hdr)->msgtype = mtype; \
119 (hdr)->msglen = mlen; \
120 }
121
122#endif /* SCSI_NETLINK_H */
123
diff --git a/include/uapi/scsi/scsi_netlink_fc.h b/include/uapi/scsi/scsi_netlink_fc.h
new file mode 100644
index 000000000000..cbf76e479761
--- /dev/null
+++ b/include/uapi/scsi/scsi_netlink_fc.h
@@ -0,0 +1,71 @@
1/*
2 * FC Transport Netlink Interface
3 *
4 * Copyright (C) 2006 James Smart, Emulex Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21#ifndef SCSI_NETLINK_FC_H
22#define SCSI_NETLINK_FC_H
23
24#include <scsi/scsi_netlink.h>
25
26/*
27 * This file intended to be included by both kernel and user space
28 */
29
30/*
31 * FC Transport Message Types
32 */
33 /* kernel -> user */
34#define FC_NL_ASYNC_EVENT 0x0100
35 /* user -> kernel */
36/* none */
37
38
39/*
40 * Message Structures :
41 */
42
43/* macro to round up message lengths to 8byte boundary */
44#define FC_NL_MSGALIGN(len) (((len) + 7) & ~7)
45
46
47/*
48 * FC Transport Broadcast Event Message :
49 * FC_NL_ASYNC_EVENT
50 *
51 * Note: if Vendor Unique message, &event_data will be start of
52 * vendor unique payload, and the length of the payload is
53 * per event_datalen
54 *
55 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
56 * formatting requirements specified in scsi_netlink.h
57 */
58struct fc_nl_event {
59 struct scsi_nl_hdr snlh; /* must be 1st element ! */
60 uint64_t seconds;
61 uint64_t vendor_id;
62 uint16_t host_no;
63 uint16_t event_datalen;
64 uint32_t event_num;
65 uint32_t event_code;
66 uint32_t event_data;
67} __attribute__((aligned(sizeof(uint64_t))));
68
69
70#endif /* SCSI_NETLINK_FC_H */
71