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_ */
97