xref: /openbmc/linux/include/scsi/fc/fc_ms.h (revision 7f6964c5)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* * Copyright(c) 2011 Intel Corporation. All rights reserved.
3  *
4  * Maintained at www.Open-FCoE.org
5  */
6 
7 #ifndef _FC_MS_H_
8 #define	_FC_MS_H_
9 
10 #include <linux/types.h>
11 
12 /*
13  * Fibre Channel Services - Management Service (MS)
14  * From T11.org FC-GS-4 Rev 7.91 February 4, 2004
15  */
16 
17 /*
18  * Fabric Device Management Interface
19  */
20 
21 /*
22  * Common-transport sub-type for FDMI
23  */
24 #define	FC_FDMI_SUBTYPE	    0x10 /* fs_ct_hdr.ct_fs_subtype */
25 
26 /*
27  * Management server FDMI Requests.
28  */
29 enum fc_fdmi_req {
30 	FC_FDMI_GRHL = 0x0100,	/* Get Registered HBA List */
31 	FC_FDMI_GHAT = 0x0101,	/* Get HBA Attributes */
32 	FC_FDMI_GRPL = 0x0102,	/* Get Registered Port List */
33 	FC_FDMI_GPAT = 0x0110,	/* Get Port Attributes */
34 	FC_FDMI_RHBA = 0x0200,	/* Register HBA */
35 	FC_FDMI_RHAT = 0x0201,	/* Register HBA Attributes */
36 	FC_FDMI_RPRT = 0x0210,	/* Register Port */
37 	FC_FDMI_RPA = 0x0211,	/* Register Port Attributes */
38 	FC_FDMI_DHBA = 0x0300,	/* Deregister HBA */
39 	FC_FDMI_DHAT = 0x0301,	/* Deregister HBA Attributes */
40 	FC_FDMI_DPRT = 0x0310,	/* Deregister Port */
41 	FC_FDMI_DPA = 0x0311,	/* Deregister Port Attributes */
42 };
43 
44 /*
45  * HBA Attribute Entry Type
46  */
47 enum fc_fdmi_hba_attr_type {
48 	FC_FDMI_HBA_ATTR_NODENAME = 0x0001,
49 	FC_FDMI_HBA_ATTR_MANUFACTURER = 0x0002,
50 	FC_FDMI_HBA_ATTR_SERIALNUMBER = 0x0003,
51 	FC_FDMI_HBA_ATTR_MODEL = 0x0004,
52 	FC_FDMI_HBA_ATTR_MODELDESCRIPTION = 0x0005,
53 	FC_FDMI_HBA_ATTR_HARDWAREVERSION = 0x0006,
54 	FC_FDMI_HBA_ATTR_DRIVERVERSION = 0x0007,
55 	FC_FDMI_HBA_ATTR_OPTIONROMVERSION = 0x0008,
56 	FC_FDMI_HBA_ATTR_FIRMWAREVERSION = 0x0009,
57 	FC_FDMI_HBA_ATTR_OSNAMEVERSION = 0x000A,
58 	FC_FDMI_HBA_ATTR_MAXCTPAYLOAD = 0x000B,
59 };
60 
61 /*
62  * HBA Attribute Length
63  */
64 #define FC_FDMI_HBA_ATTR_NODENAME_LEN		8
65 #define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN	64
66 #define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN	64
67 #define FC_FDMI_HBA_ATTR_MODEL_LEN		256
68 #define FC_FDMI_HBA_ATTR_MODELDESCR_LEN		256
69 #define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN	256
70 #define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN	256
71 #define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN	256
72 #define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN	256
73 #define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN	256
74 #define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN	4
75 
76 /*
77  * Port Attribute Type
78  */
79 enum fc_fdmi_port_attr_type {
80 	FC_FDMI_PORT_ATTR_FC4TYPES = 0x0001,
81 	FC_FDMI_PORT_ATTR_SUPPORTEDSPEED = 0x0002,
82 	FC_FDMI_PORT_ATTR_CURRENTPORTSPEED = 0x0003,
83 	FC_FDMI_PORT_ATTR_MAXFRAMESIZE = 0x0004,
84 	FC_FDMI_PORT_ATTR_OSDEVICENAME = 0x0005,
85 	FC_FDMI_PORT_ATTR_HOSTNAME = 0x0006,
86 };
87 
88 /*
89  * Port Attribute Length
90  */
91 #define FC_FDMI_PORT_ATTR_FC4TYPES_LEN		32
92 #define FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN	4
93 #define FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN	4
94 #define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN	4
95 #define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN	256
96 #define FC_FDMI_PORT_ATTR_HOSTNAME_LEN		256
97 
98 /*
99  * HBA Attribute ID
100  */
101 struct fc_fdmi_hba_identifier {
102 	__be64		id;
103 };
104 
105 /*
106  * Port Name
107  */
108 struct fc_fdmi_port_name {
109 	__be64		portname;
110 };
111 
112 /*
113  * Attribute Entry Block for HBA/Port Attributes
114  */
115 #define FC_FDMI_ATTR_ENTRY_HEADER_LEN	4
116 struct fc_fdmi_attr_entry {
117 	__be16		type;
118 	__be16		len;
119 	__u8		value[1];
120 } __attribute__((__packed__));
121 
122 /*
123  * Common for HBA/Port Attributes
124  */
125 struct fs_fdmi_attrs {
126 	__be32				numattrs;
127 	struct fc_fdmi_attr_entry	attr[1];
128 } __attribute__((__packed__));
129 
130 /*
131  * Registered Port List
132  */
133 struct fc_fdmi_rpl {
134 	__be32				numport;
135 	struct fc_fdmi_port_name	port[1];
136 } __attribute__((__packed__));
137 
138 /*
139  * Register HBA (RHBA)
140  */
141 struct fc_fdmi_rhba {
142 	struct fc_fdmi_hba_identifier hbaid;
143 	struct fc_fdmi_rpl		 port;
144 	struct fs_fdmi_attrs		 hba_attrs;
145 } __attribute__((__packed__));
146 
147 /*
148  * Register HBA Attributes (RHAT)
149  */
150 struct fc_fdmi_rhat {
151 	struct fc_fdmi_hba_identifier hbaid;
152 	struct fs_fdmi_attrs		 hba_attrs;
153 } __attribute__((__packed__));
154 
155 /*
156  * Register Port (RPRT)
157  */
158 struct fc_fdmi_rprt {
159 	struct fc_fdmi_hba_identifier hbaid;
160 	struct fc_fdmi_port_name	 port;
161 	struct fs_fdmi_attrs		 hba_attrs;
162 } __attribute__((__packed__));
163 
164 /*
165  * Register Port Attributes (RPA)
166  */
167 struct fc_fdmi_rpa {
168 	struct fc_fdmi_port_name	 port;
169 	struct fs_fdmi_attrs		 hba_attrs;
170 } __attribute__((__packed__));
171 
172 /*
173  * Deregister Port (DPRT)
174  */
175 struct fc_fdmi_dprt {
176 	struct fc_fdmi_port_name	 port;
177 } __attribute__((__packed__));
178 
179 /*
180  * Deregister Port Attributes (DPA)
181  */
182 struct fc_fdmi_dpa {
183 	struct fc_fdmi_port_name	 port;
184 	struct fs_fdmi_attrs		 hba_attrs;
185 } __attribute__((__packed__));
186 
187 /*
188  * Deregister HBA Attributes (DHAT)
189  */
190 struct fc_fdmi_dhat {
191 	struct fc_fdmi_hba_identifier hbaid;
192 } __attribute__((__packed__));
193 
194 /*
195  * Deregister HBA (DHBA)
196  */
197 struct fc_fdmi_dhba {
198 	struct fc_fdmi_hba_identifier hbaid;
199 } __attribute__((__packed__));
200 
201 #endif /* _FC_MS_H_ */
202