xref: /openbmc/linux/include/uapi/scsi/fc/fc_ns.h (revision c67e8ec0)
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_NS_H_
22 #define	_FC_NS_H_
23 
24 #include <linux/types.h>
25 
26 /*
27  * Fibre Channel Services - Name Service (dNS)
28  * From T11.org FC-GS-2 Rev 5.3 November 1998.
29  */
30 
31 /*
32  * Common-transport sub-type for Name Server.
33  */
34 #define	FC_NS_SUBTYPE	    2	/* fs_ct_hdr.ct_fs_subtype */
35 
36 /*
37  * Name server Requests.
38  * Note:  this is an incomplete list, some unused requests are omitted.
39  */
40 enum fc_ns_req {
41 	FC_NS_GA_NXT =	0x0100,		/* get all next */
42 	FC_NS_GI_A =	0x0101,		/* get identifiers - scope */
43 	FC_NS_GPN_ID =	0x0112,		/* get port name by ID */
44 	FC_NS_GNN_ID =	0x0113,		/* get node name by ID */
45 	FC_NS_GSPN_ID = 0x0118,		/* get symbolic port name */
46 	FC_NS_GID_PN =	0x0121,		/* get ID for port name */
47 	FC_NS_GID_NN =	0x0131,		/* get IDs for node name */
48 	FC_NS_GID_FT =	0x0171,		/* get IDs by FC4 type */
49 	FC_NS_GPN_FT =	0x0172,		/* get port names by FC4 type */
50 	FC_NS_GID_PT =	0x01a1,		/* get IDs by port type */
51 	FC_NS_RPN_ID =	0x0212,		/* reg port name for ID */
52 	FC_NS_RNN_ID =	0x0213,		/* reg node name for ID */
53 	FC_NS_RFT_ID =	0x0217,		/* reg FC4 type for ID */
54 	FC_NS_RSPN_ID =	0x0218,		/* reg symbolic port name */
55 	FC_NS_RFF_ID =	0x021f,		/* reg FC4 Features for ID */
56 	FC_NS_RSNN_NN =	0x0239,		/* reg symbolic node name */
57 };
58 
59 /*
60  * Port type values.
61  */
62 enum fc_ns_pt {
63 	FC_NS_UNID_PORT = 0x00,	/* unidentified */
64 	FC_NS_N_PORT =	0x01,	/* N port */
65 	FC_NS_NL_PORT =	0x02,	/* NL port */
66 	FC_NS_FNL_PORT = 0x03,	/* F/NL port */
67 	FC_NS_NX_PORT =	0x7f,	/* Nx port */
68 	FC_NS_F_PORT =	0x81,	/* F port */
69 	FC_NS_FL_PORT =	0x82,	/* FL port */
70 	FC_NS_E_PORT =	0x84,	/* E port */
71 	FC_NS_B_PORT =	0x85,	/* B port */
72 };
73 
74 /*
75  * Port type object.
76  */
77 struct fc_ns_pt_obj {
78 	__u8		pt_type;
79 };
80 
81 /*
82  * Port ID object
83  */
84 struct fc_ns_fid {
85 	__u8		fp_flags;	/* flags for responses only */
86 	__u8		fp_fid[3];
87 };
88 
89 /*
90  * fp_flags in port ID object, for responses only.
91  */
92 #define	FC_NS_FID_LAST	0x80		/* last object */
93 
94 /*
95  * FC4-types object.
96  */
97 #define	FC_NS_TYPES	256	/* number of possible FC-4 types */
98 #define	FC_NS_BPW	32	/* bits per word in bitmap */
99 
100 struct fc_ns_fts {
101 	__be32	ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */
102 };
103 
104 /*
105  * FC4-features object.
106  */
107 struct fc_ns_ff	{
108 	__be32	fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */
109 };
110 
111 /*
112  * GID_PT request.
113  */
114 struct fc_ns_gid_pt {
115 	__u8		fn_pt_type;
116 	__u8		fn_domain_id_scope;
117 	__u8		fn_area_id_scope;
118 	__u8		fn_resvd;
119 };
120 
121 /*
122  * GID_FT or GPN_FT request.
123  */
124 struct fc_ns_gid_ft {
125 	__u8		fn_resvd;
126 	__u8		fn_domain_id_scope;
127 	__u8		fn_area_id_scope;
128 	__u8		fn_fc4_type;
129 };
130 
131 /*
132  * GPN_FT response.
133  */
134 struct fc_gpn_ft_resp {
135 	__u8		fp_flags;	/* see fp_flags definitions above */
136 	__u8		fp_fid[3];	/* port ID */
137 	__be32		fp_resvd;
138 	__be64		fp_wwpn;	/* port name */
139 };
140 
141 /*
142  * GID_PN request
143  */
144 struct fc_ns_gid_pn {
145 	__be64     fn_wwpn;    /* port name */
146 };
147 
148 /*
149  * GID_PN response or GSPN_ID request
150  */
151 struct fc_gid_pn_resp {
152 	__u8      fp_resvd;
153 	__u8      fp_fid[3];     /* port ID */
154 };
155 
156 /*
157  * GSPN_ID response
158  */
159 struct fc_gspn_resp {
160 	__u8	fp_name_len;
161 	char	fp_name[];
162 };
163 
164 /*
165  * RFT_ID request - register FC-4 types for ID.
166  */
167 struct fc_ns_rft_id {
168 	struct fc_ns_fid fr_fid;	/* port ID object */
169 	struct fc_ns_fts fr_fts;	/* FC-4 types object */
170 };
171 
172 /*
173  * RPN_ID request - register port name for ID.
174  * RNN_ID request - register node name for ID.
175  */
176 struct fc_ns_rn_id {
177 	struct fc_ns_fid fr_fid;	/* port ID object */
178 	__be64		fr_wwn;		/* node name or port name */
179 } __attribute__((__packed__));
180 
181 /*
182  * RSNN_NN request - register symbolic node name
183  */
184 struct fc_ns_rsnn {
185 	__be64		fr_wwn;		/* node name */
186 	__u8		fr_name_len;
187 	char		fr_name[];
188 } __attribute__((__packed__));
189 
190 /*
191  * RSPN_ID request - register symbolic port name
192  */
193 struct fc_ns_rspn {
194 	struct fc_ns_fid fr_fid;	/* port ID object */
195 	__u8		fr_name_len;
196 	char		fr_name[];
197 } __attribute__((__packed__));
198 
199 /*
200  * RFF_ID request - register FC-4 Features for ID.
201  */
202 struct fc_ns_rff_id {
203 	struct fc_ns_fid fr_fid;	/* port ID object */
204 	__u8		fr_resvd[2];
205 	__u8		fr_feat;	/* FC-4 Feature bits */
206 	__u8		fr_type;	/* FC-4 type */
207 } __attribute__((__packed__));
208 
209 #endif /* _FC_NS_H_ */
210