7 * Fibre Channel name server lookups
11 FILE_LICENCE ( GPL2_OR_LATER );
16 /** A Fibre Channel Common Transport header */
20 /** Original requestor ID */
21 struct fc_port_id in_id;
22 /** Generic service type */
24 /** Generic service subtype */
30 /** Command/response code */
32 /** Maximum/residual size */
38 /** Reason code explanation */
40 /** Vendor specific */
42 } __attribute__ (( packed ));
44 /** Fibre Channel Common Transport revision */
45 #define FC_CT_REVISION 1
47 /** Fibre Channel generic service type */
49 /** Directory service */
53 /** Fibre Channel generic service response codes */
54 enum fc_gs_response_code {
56 FC_GS_ACCEPT = 0x8002,
58 FC_GS_REJECT = 0x8001,
61 /** Fibre Channel generic service rejection reason codes */
62 enum fc_gs_reason_code {
63 /** Invalid command code */
64 FC_GS_BAD_COMMAND = 0x01,
65 /** Invalid version level */
66 FC_GS_BAD_VERSION = 0x02,
69 /** Invalid CT_IU size */
70 FC_GS_BAD_SIZE = 0x04,
75 /** Unable to perform command request */
77 /** Command not supported */
79 /** Server not available */
80 FC_GS_UNAVAILABLE = 0x0d,
81 /** Session could not be established */
85 /** Fibre Channel directory service subtype */
88 FC_DS_SUBTYPE_NAME = 0x02,
91 /** Fibre Channel name server commands */
92 enum fc_ns_command_nibble {
98 FC_NS_DEREGISTER = 0x3,
101 /** Fibre Channel name server objects */
102 enum fc_ns_object_nibble {
106 FC_NS_PORT_NAME = 0x2,
108 FC_NS_NODE_NAME = 0x3,
110 FC_NS_FC4_TYPES = 0x7,
111 /** Symbolic port name */
112 FC_NS_SYM_PORT_NAME = 0x8,
113 /** Symbolic node name */
114 FC_NS_SYM_NODE_NAME = 0x9,
116 FC_NS_FC4_FEATURES = 0xf,
119 /** Construct Fibre Channel name server command code
121 * @v command Name server command
122 * @v key Name server key
123 * @v value Name server value
124 * @ret code Name server command code
126 #define FC_NS_CODE( command, key, value ) \
127 ( ( (command) << 8 ) | ( (key) << 4 ) | ( (value) << 0 ) )
129 /** Construct Fibre Channel name server "get" command code
131 * @v key Name server key
132 * @v value Name server value to get
133 * @ret code Name server command code
135 #define FC_NS_GET( key, value ) FC_NS_CODE ( FC_NS_GET, key, value )
137 /** Construct Fibre Channel name server "register" command code
139 * @v key Name server key
140 * @v value Name server value to register
141 * @ret code Name server command code
143 #define FC_NS_REGISTER( key, value ) FC_NS_CODE ( FC_NS_REGISTER, key, value )
145 /** Extract Fibre Channel name server command
147 * @v code Name server command code
148 * @ret command Name server command
150 #define FC_NS_COMMAND( code ) ( ( (code) >> 8 ) & 0xf )
152 /** Extract Fibre Channel name server key
154 * @v code Name server command code
155 * @ret key Name server key
157 #define FC_NS_KEY( code ) ( ( (code) >> 4 ) & 0xf )
159 /** Extract Fibre Channel name server value
161 * @v code Name server command code
162 * @ret value NAme server value
164 #define FC_NS_VALUE( code ) ( ( (code) >> 0 ) & 0xf )
166 /** A Fibre Channel name server port ID */
167 struct fc_ns_port_id {
171 struct fc_port_id port_id;
172 } __attribute__ (( packed ));
174 /** A Fibre Channel name server GID_PN request */
175 struct fc_ns_gid_pn_request {
176 /** Common Transport header */
177 struct fc_ct_header ct;
179 struct fc_name port_wwn;
180 } __attribute__ (( packed ));
182 /** A Fibre Channel name server request */
183 union fc_ns_request {
184 /** Get ID by port name */
185 struct fc_ns_gid_pn_request gid_pn;
188 /** A Fibre Channel name server rejection response */
189 struct fc_ns_reject_response {
190 /** Common Transport header */
191 struct fc_ct_header ct;
192 } __attribute__ (( packed ));
194 /** A Fibre Channel name server GID_PN response */
195 struct fc_ns_gid_pn_response {
196 /** Common Transport header */
197 struct fc_ct_header ct;
199 struct fc_ns_port_id port_id;
200 } __attribute__ (( packed ));
202 /** A Fibre Channel name server response */
203 union fc_ns_response {
204 /** Common Transport header */
205 struct fc_ct_header ct;
207 struct fc_ns_reject_response reject;
208 /** Get ID by port name */
209 struct fc_ns_gid_pn_response gid_pn;
212 extern int fc_ns_query ( struct fc_peer *peer, struct fc_port *port,
213 int ( * done ) ( struct fc_peer *peer,
214 struct fc_port *port,
215 struct fc_port_id *peer_port_id ) );
217 #endif /* _IPXE_FCNS_H */