GNU Linux-libre 4.14.262-gnu1
[releases.git] / include / uapi / scsi / fc / fc_gs.h
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * Copyright(c) 2007 Intel Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * Maintained at www.Open-FCoE.org
19  */
20
21 #ifndef _FC_GS_H_
22 #define _FC_GS_H_
23
24 #include <linux/types.h>
25
26 /*
27  * Fibre Channel Services - Common Transport.
28  * From T11.org FC-GS-2 Rev 5.3 November 1998.
29  */
30
31 struct fc_ct_hdr {
32         __u8            ct_rev;         /* revision */
33         __u8            ct_in_id[3];    /* N_Port ID of original requestor */
34         __u8            ct_fs_type;     /* type of fibre channel service */
35         __u8            ct_fs_subtype;  /* subtype */
36         __u8            ct_options;
37         __u8            _ct_resvd1;
38         __be16          ct_cmd;         /* command / response code */
39         __be16          ct_mr_size;     /* maximum / residual size */
40         __u8            _ct_resvd2;
41         __u8            ct_reason;      /* reject reason */
42         __u8            ct_explan;      /* reason code explanation */
43         __u8            ct_vendor;      /* vendor unique data */
44 };
45
46 #define FC_CT_HDR_LEN   16      /* expected sizeof (struct fc_ct_hdr) */
47
48 enum fc_ct_rev {
49         FC_CT_REV = 1           /* common transport revision */
50 };
51
52 /*
53  * ct_fs_type values.
54  */
55 enum fc_ct_fs_type {
56         FC_FST_ALIAS =  0xf8,   /* alias service */
57         FC_FST_MGMT =   0xfa,   /* management service */
58         FC_FST_TIME =   0xfb,   /* time service */
59         FC_FST_DIR =    0xfc,   /* directory service */
60 };
61
62 /*
63  * ct_cmd: Command / response codes
64  */
65 enum fc_ct_cmd {
66         FC_FS_RJT =     0x8001, /* reject */
67         FC_FS_ACC =     0x8002, /* accept */
68 };
69
70 /*
71  * FS_RJT reason codes.
72  */
73 enum fc_ct_reason {
74         FC_FS_RJT_CMD =         0x01,   /* invalid command code */
75         FC_FS_RJT_VER =         0x02,   /* invalid version level */
76         FC_FS_RJT_LOG =         0x03,   /* logical error */
77         FC_FS_RJT_IUSIZ =       0x04,   /* invalid IU size */
78         FC_FS_RJT_BSY =         0x05,   /* logical busy */
79         FC_FS_RJT_PROTO =       0x07,   /* protocol error */
80         FC_FS_RJT_UNABL =       0x09,   /* unable to perform command request */
81         FC_FS_RJT_UNSUP =       0x0b,   /* command not supported */
82 };
83
84 /*
85  * FS_RJT reason code explanations.
86  */
87 enum fc_ct_explan {
88         FC_FS_EXP_NONE =        0x00,   /* no additional explanation */
89         FC_FS_EXP_PID =         0x01,   /* port ID not registered */
90         FC_FS_EXP_PNAM =        0x02,   /* port name not registered */
91         FC_FS_EXP_NNAM =        0x03,   /* node name not registered */
92         FC_FS_EXP_COS =         0x04,   /* class of service not registered */
93         FC_FS_EXP_FTNR =        0x07,   /* FC-4 types not registered */
94         /* definitions not complete */
95 };
96
97 #endif /* _FC_GS_H_ */