iPXE
fip.h
Go to the documentation of this file.
1#ifndef _IPXE_FIP_H
2#define _IPXE_FIP_H
3
4/*
5 * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 */
22
23#include <stdint.h>
24#include <ipxe/fc.h>
25#include <ipxe/fcels.h>
26#include <ipxe/fcoe.h>
27
28/** A FIP frame header */
29struct fip_header {
30 /** Frame version */
32 /** Reserved */
34 /** Protocol code */
36 /** Reserved */
38 /** Subcode */
40 /** Descriptor list length in 32-bit words */
42 /** Flags */
44} __attribute__ (( packed ));
45
46/** FIP frame version */
47#define FIP_VERSION 0x10
48
49/** FIP protocol code */
51 FIP_CODE_DISCOVERY = 0x0001, /**< Discovery */
52 FIP_CODE_ELS = 0x0002, /**< Extended link services */
53 FIP_CODE_MAINTAIN = 0x0003, /**< Maintain virtual links */
54 FIP_CODE_VLAN = 0x0004, /**< VLAN */
55};
56
57/** FIP protocol subcode for discovery */
59 FIP_DISCOVERY_SOLICIT = 0x01, /**< Discovery solicitation */
60 FIP_DISCOVERY_ADVERTISE = 0x02, /**< Discovery advertisement */
61};
62
63/** FIP protocol subcode for extended link services */
65 FIP_ELS_REQUEST = 0x01, /**< ELS request */
66 FIP_ELS_RESPONSE = 0x02, /**< ELS response */
67};
68
69/** FIP protocol subcode for keep alive / clear links */
71 FIP_MAINTAIN_KEEP_ALIVE = 0x01, /**< Keep alive */
72 FIP_MAINTAIN_CLEAR_LINKS = 0x02,/**< Clear virtual links */
73};
74
75/** FIP protocol subcode for VLAN */
77 FIP_VLAN_REQUEST = 0x01, /**< VLAN request */
78 FIP_VLAN_NOTIFY = 0x02, /**< VLAN notification */
79};
80
81/** FIP flags */
83 FIP_FP = 0x8000, /**< Fabric-provided MAC address */
84 FIP_SP = 0x4000, /**< Server-provided MAC address */
85 FIP_A = 0x0004, /**< Available for login */
86 FIP_S = 0x0002, /**< Solicited */
87 FIP_F = 0x0001, /**< Forwarder */
88};
89
90/** FIP descriptor common fields */
91struct fip_common {
92 /** Type */
94 /** Length in 32-bit words */
96 /** Reserved */
98} __attribute__ (( packed ));
99
100/** FIP descriptor types */
102 FIP_RESERVED = 0x00, /**< Reserved */
103 FIP_PRIORITY = 0x01, /**< Priority */
104 FIP_MAC_ADDRESS = 0x02, /**< MAC address */
105 FIP_FC_MAP = 0x03, /**< FC-MAP */
106 FIP_NAME_ID = 0x04, /**< Name identifier */
107 FIP_FABRIC = 0x05, /**< Fabric */
108 FIP_MAX_FCOE_SIZE = 0x06, /**< Max FCoE size */
109 FIP_FLOGI = 0x07, /**< FLOGI */
110 FIP_NPIV_FDISC = 0x08, /**< NPIV FDISC */
111 FIP_LOGO = 0x09, /**< LOGO */
112 FIP_ELP = 0x0a, /**< ELP */
113 FIP_VX_PORT_ID = 0x0b, /**< Vx port identification */
114 FIP_FKA_ADV_P = 0x0c, /**< FKA ADV period */
115 FIP_VENDOR_ID = 0x0d, /**< Vendor ID */
116 FIP_VLAN = 0x0e, /**< VLAN */
118};
119
120/** FIP descriptor type is critical */
121#define FIP_IS_CRITICAL( type ) ( (type) <= 0x7f )
122
123/** A FIP priority descriptor */
125 /** Type */
127 /** Length in 32-bit words */
129 /** Reserved */
131 /** Priority
132 *
133 * A higher value indicates a lower priority.
134 */
136} __attribute__ (( packed ));
137
138/** Default FIP priority */
139#define FIP_DEFAULT_PRIORITY 128
140
141/** Lowest FIP priority */
142#define FIP_LOWEST_PRIORITY 255
143
144/** A FIP MAC address descriptor */
146 /** Type */
148 /** Length in 32-bit words */
150 /** MAC address */
152} __attribute__ (( packed ));
153
154/** A FIP FC-MAP descriptor */
156 /** Type */
158 /** Length in 32-bit words */
160 /** Reserved */
162 /** FC-MAP */
163 struct fcoe_map map;
164} __attribute__ (( packed ));
165
166/** A FIP name identifier descriptor */
168 /** Type */
170 /** Length in 32-bit words */
172 /** Reserved */
174 /** Name identifier */
175 struct fc_name name;
176} __attribute__ (( packed ));
177
178/** A FIP fabric descriptor */
180 /** Type */
182 /** Length in 32-bit words */
184 /** Virtual Fabric ID, if any */
186 /** Reserved */
188 /** FC-MAP */
189 struct fcoe_map map;
190 /** Fabric name */
191 struct fc_name name;
192} __attribute__ (( packed ));
193
194/** A FIP max FCoE size descriptor */
196 /** Type */
198 /** Length in 32-bit words */
200 /** Maximum FCoE size */
202} __attribute__ (( packed ));
203
204/** A FIP descriptor containing an encapsulated ELS frame */
205struct fip_els {
206 /** Type */
208 /** Length in 32-bit words */
210 /** Reserved */
212 /** Fibre Channel frame header */
214 /** ELS frame */
216} __attribute__ (( packed ));
217
218/** A FIP descriptor containing an encapsulated login frame */
219struct fip_login {
220 /** Type */
222 /** Length in 32-bit words */
224 /** Reserved */
226 /** Fibre Channel frame header */
228 /** ELS frame */
230} __attribute__ (( packed ));
231
232/** A FIP descriptor containing an encapsulated LOGO request frame */
234 /** Type */
236 /** Length in 32-bit words */
238 /** Reserved */
240 /** Fibre Channel frame header */
242 /** ELS frame */
244} __attribute__ (( packed ));
245
246/** A FIP descriptor containing an encapsulated LOGO response frame */
248 /** Type */
250 /** Length in 32-bit words */
252 /** Reserved */
254 /** Fibre Channel frame header */
256 /** ELS frame */
258} __attribute__ (( packed ));
259
260/** A FIP descriptor containing an encapsulated ELP frame */
261struct fip_elp {
262 /** Type */
264 /** Length in 32-bit words */
266 /** Reserved */
268 /** Fibre Channel frame header */
270 /** ELS frame */
272 /** Uninteresting content */
274} __attribute__ (( packed ));
275
276/** A FIP descriptor containing an encapsulated LS_RJT frame */
278 /** Type */
280 /** Length in 32-bit words */
282 /** Reserved */
284 /** Fibre Channel frame header */
286 /** ELS frame */
288} __attribute__ (( packed ));
289
290/** A FIP Vx port identification descriptor */
292 /** Type */
294 /** Length in 32-bit words */
296 /** MAC address */
298 /** Reserved */
300 /** Address identifier */
302 /** Port name */
303 struct fc_name name;
304} __attribute__ (( packed ));
305
306/** A FIP FKA ADV period descriptor */
308 /** Type */
310 /** Length in 32-bit words */
312 /** Reserved */
314 /** Flags */
316 /** Keep alive advertisement period in milliseconds */
318} __attribute__ (( packed ));
319
320/** FIP FKA ADV period flags */
322 FIP_NO_KEEPALIVE = 0x01, /**< Do not send keepalives */
323};
324
325/** A FIP vendor ID descriptor */
327 /** Type */
329 /** Length in 32-bit words */
331 /** Reserved */
333 /** Vendor ID */
335} __attribute__ (( packed ));
336
337/** A FIP VLAN descriptor */
338struct fip_vlan {
339 /** Type */
341 /** Length in 32-bit words */
343 /** VLAN ID */
345} __attribute__ (( packed ));
346
347/** A FIP descriptor */
349 /** Common fields */
351 /** Priority descriptor */
353 /** MAC address descriptor */
355 /** FC-MAP descriptor */
357 /** Name identifier descriptor */
359 /** Fabric descriptor */
361 /** Max FCoE size descriptor */
363 /** FLOGI descriptor */
365 /** FLOGI request descriptor */
367 /** FLOGI LS_ACC descriptor */
369 /** FLOGI LS_RJT descriptor */
371 /** NPIV FDISC descriptor */
373 /** NPIV FDISC request descriptor */
375 /** NPIV FDISC LS_ACC descriptor */
377 /** NPIV FDISC LS_RJT descriptor */
379 /** LOGO descriptor */
380 struct fip_els logo;
381 /** LOGO request descriptor */
383 /** LOGO LS_ACC descriptor */
385 /** LOGO LS_RJT descriptor */
387 /** ELS descriptor */
388 struct fip_els elp;
389 /** ELP request descriptor */
391 /** ELP LS_ACC descriptor */
393 /** ELP LS_RJT descriptor */
395 /** Vx port identification descriptor */
397 /** FKA ADV period descriptor */
399 /** Vendor ID descriptor */
401 /** VLAN descriptor */
403} __attribute__ (( packed ));
404
405/** A FIP descriptor set */
407 /** Descriptors, indexed by type */
409};
410
411/**
412 * Define a function to extract a specific FIP descriptor type from a list
413 *
414 * @v type Descriptor type
415 * @v name Descriptor name
416 * @v finder Descriptor finder
417 */
418#define FIP_DESCRIPTOR( type, name ) \
419 static inline __attribute__ (( always_inline )) \
420 typeof ( ( ( union fip_descriptor * ) NULL )->name ) * \
421 fip_ ## name ( struct fip_descriptors *descs ) { \
422 return &(descs->desc[type]->name); \
423 }
450
451#endif /* _IPXE_FIP_H */
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned char uint8_t
Definition stdint.h:10
Fibre Channel.
Fibre Channel Extended Link Services.
Fibre Channel over Ethernet.
fip_vitality_subcode
FIP protocol subcode for keep alive / clear links.
Definition fip.h:70
@ FIP_MAINTAIN_KEEP_ALIVE
Keep alive.
Definition fip.h:71
@ FIP_MAINTAIN_CLEAR_LINKS
Clear virtual links.
Definition fip.h:72
fip_code
FIP protocol code.
Definition fip.h:50
@ FIP_CODE_ELS
Extended link services.
Definition fip.h:52
@ FIP_CODE_DISCOVERY
Discovery.
Definition fip.h:51
@ FIP_CODE_MAINTAIN
Maintain virtual links.
Definition fip.h:53
@ FIP_CODE_VLAN
VLAN.
Definition fip.h:54
fip_els_subcode
FIP protocol subcode for extended link services.
Definition fip.h:64
@ FIP_ELS_REQUEST
ELS request.
Definition fip.h:65
@ FIP_ELS_RESPONSE
ELS response.
Definition fip.h:66
fip_flags
FIP flags.
Definition fip.h:82
@ FIP_SP
Server-provided MAC address.
Definition fip.h:84
@ FIP_FP
Fabric-provided MAC address.
Definition fip.h:83
@ FIP_S
Solicited.
Definition fip.h:86
@ FIP_A
Available for login.
Definition fip.h:85
@ FIP_F
Forwarder.
Definition fip.h:87
fip_vlan_subcode
FIP protocol subcode for VLAN.
Definition fip.h:76
@ FIP_VLAN_REQUEST
VLAN request.
Definition fip.h:77
@ FIP_VLAN_NOTIFY
VLAN notification.
Definition fip.h:78
fip_fka_adv_p_flags
FIP FKA ADV period flags.
Definition fip.h:321
@ FIP_NO_KEEPALIVE
Do not send keepalives.
Definition fip.h:322
#define FIP_DESCRIPTOR(type, name)
Define a function to extract a specific FIP descriptor type from a list.
Definition fip.h:418
fip_type
FIP descriptor types.
Definition fip.h:101
@ FIP_NPIV_FDISC
NPIV FDISC.
Definition fip.h:110
@ FIP_MAX_FCOE_SIZE
Max FCoE size.
Definition fip.h:108
@ FIP_FC_MAP
FC-MAP.
Definition fip.h:105
@ FIP_FKA_ADV_P
FKA ADV period.
Definition fip.h:114
@ FIP_RESERVED
Reserved.
Definition fip.h:102
@ FIP_PRIORITY
Priority.
Definition fip.h:103
@ FIP_VENDOR_ID
Vendor ID.
Definition fip.h:115
@ FIP_ELP
ELP.
Definition fip.h:112
@ FIP_VX_PORT_ID
Vx port identification.
Definition fip.h:113
@ FIP_MAC_ADDRESS
MAC address.
Definition fip.h:104
@ FIP_VLAN
VLAN.
Definition fip.h:116
@ FIP_NUM_DESCRIPTOR_TYPES
Definition fip.h:117
@ FIP_NAME_ID
Name identifier.
Definition fip.h:106
@ FIP_FLOGI
FLOGI.
Definition fip.h:109
@ FIP_FABRIC
Fabric.
Definition fip.h:107
@ FIP_LOGO
LOGO.
Definition fip.h:111
fip_discovery_subcode
FIP protocol subcode for discovery.
Definition fip.h:58
@ FIP_DISCOVERY_SOLICIT
Discovery solicitation.
Definition fip.h:59
@ FIP_DISCOVERY_ADVERTISE
Discovery advertisement.
Definition fip.h:60
uint8_t vendor_id[3]
Definition ib_mad.h:11
#define ETH_ALEN
Definition if_ether.h:9
#define __attribute__(x)
Definition compiler.h:10
uint16_t priority
Priotity.
Definition stp.h:1
Fibre Channel ELS frame common parameters.
Definition fcels.h:23
A Fibre Channel Frame Header.
Definition fc.h:121
A Fibre Channel FLOGI/PLOGI frame.
Definition fcels.h:209
A Fibre Channel LOGO request frame.
Definition fcels.h:233
A Fibre Channel LOGO response frame.
Definition fcels.h:245
A Fibre Channel LS_RJT frame.
Definition fcels.h:44
A Fibre Channel name.
Definition fc.h:30
A Fibre Channel port identifier.
Definition fc.h:38
An FCoE MAC address prefix (FC-MAP)
Definition fcoe.h:37
FIP descriptor common fields.
Definition fip.h:91
uint8_t reserved[2]
Reserved.
Definition fip.h:97
uint8_t type
Type.
Definition fip.h:93
uint8_t len
Length in 32-bit words.
Definition fip.h:95
A FIP descriptor set.
Definition fip.h:406
union fip_descriptor * desc[FIP_NUM_DESCRIPTOR_TYPES]
Descriptors, indexed by type.
Definition fip.h:408
A FIP descriptor containing an encapsulated ELP frame.
Definition fip.h:261
uint8_t type
Type.
Definition fip.h:263
struct fc_frame_header fc
Fibre Channel frame header.
Definition fip.h:269
uint8_t len
Length in 32-bit words.
Definition fip.h:265
uint32_t dull[25]
Uninteresting content.
Definition fip.h:273
uint8_t reserved[2]
Reserved.
Definition fip.h:267
struct fc_els_frame_common els
ELS frame.
Definition fip.h:271
A FIP descriptor containing an encapsulated ELS frame.
Definition fip.h:205
struct fc_els_frame_common els
ELS frame.
Definition fip.h:215
struct fc_frame_header fc
Fibre Channel frame header.
Definition fip.h:213
uint8_t reserved[2]
Reserved.
Definition fip.h:211
uint8_t len
Length in 32-bit words.
Definition fip.h:209
uint8_t type
Type.
Definition fip.h:207
A FIP fabric descriptor.
Definition fip.h:179
struct fc_name name
Fabric name.
Definition fip.h:191
uint8_t len
Length in 32-bit words.
Definition fip.h:183
uint16_t vf_id
Virtual Fabric ID, if any.
Definition fip.h:185
struct fcoe_map map
FC-MAP.
Definition fip.h:189
uint8_t type
Type.
Definition fip.h:181
uint8_t reserved
Reserved.
Definition fip.h:187
A FIP FC-MAP descriptor.
Definition fip.h:155
struct fcoe_map map
FC-MAP.
Definition fip.h:163
uint8_t reserved[3]
Reserved.
Definition fip.h:161
uint8_t len
Length in 32-bit words.
Definition fip.h:159
uint8_t type
Type.
Definition fip.h:157
A FIP FKA ADV period descriptor.
Definition fip.h:307
uint8_t flags
Flags.
Definition fip.h:315
uint8_t reserved
Reserved.
Definition fip.h:313
uint8_t len
Length in 32-bit words.
Definition fip.h:311
uint32_t period
Keep alive advertisement period in milliseconds.
Definition fip.h:317
uint8_t type
Type.
Definition fip.h:309
A FIP frame header.
Definition fip.h:29
uint8_t reserved_b
Reserved.
Definition fip.h:37
uint8_t reserved_a
Reserved.
Definition fip.h:33
uint16_t len
Descriptor list length in 32-bit words.
Definition fip.h:41
uint16_t code
Protocol code.
Definition fip.h:35
uint8_t version
Frame version.
Definition fip.h:31
uint8_t subcode
Subcode.
Definition fip.h:39
uint16_t flags
Flags.
Definition fip.h:43
A FIP descriptor containing an encapsulated login frame.
Definition fip.h:219
uint8_t type
Type.
Definition fip.h:221
struct fc_login_frame els
ELS frame.
Definition fip.h:229
struct fc_frame_header fc
Fibre Channel frame header.
Definition fip.h:227
uint8_t reserved[2]
Reserved.
Definition fip.h:225
uint8_t len
Length in 32-bit words.
Definition fip.h:223
A FIP descriptor containing an encapsulated LOGO request frame.
Definition fip.h:233
uint8_t len
Length in 32-bit words.
Definition fip.h:237
struct fc_logout_request_frame els
ELS frame.
Definition fip.h:243
uint8_t type
Type.
Definition fip.h:235
uint8_t reserved[2]
Reserved.
Definition fip.h:239
struct fc_frame_header fc
Fibre Channel frame header.
Definition fip.h:241
A FIP descriptor containing an encapsulated LOGO response frame.
Definition fip.h:247
uint8_t len
Length in 32-bit words.
Definition fip.h:251
struct fc_logout_response_frame els
ELS frame.
Definition fip.h:257
struct fc_frame_header fc
Fibre Channel frame header.
Definition fip.h:255
uint8_t reserved[2]
Reserved.
Definition fip.h:253
uint8_t type
Type.
Definition fip.h:249
A FIP descriptor containing an encapsulated LS_RJT frame.
Definition fip.h:277
struct fc_frame_header fc
Fibre Channel frame header.
Definition fip.h:285
struct fc_ls_rjt_frame els
ELS frame.
Definition fip.h:287
uint8_t reserved[2]
Reserved.
Definition fip.h:283
uint8_t len
Length in 32-bit words.
Definition fip.h:281
uint8_t type
Type.
Definition fip.h:279
A FIP MAC address descriptor.
Definition fip.h:145
uint8_t mac[ETH_ALEN]
MAC address.
Definition fip.h:151
uint8_t len
Length in 32-bit words.
Definition fip.h:149
uint8_t type
Type.
Definition fip.h:147
A FIP max FCoE size descriptor.
Definition fip.h:195
uint8_t len
Length in 32-bit words.
Definition fip.h:199
uint16_t mtu
Maximum FCoE size.
Definition fip.h:201
uint8_t type
Type.
Definition fip.h:197
A FIP name identifier descriptor.
Definition fip.h:167
uint8_t len
Length in 32-bit words.
Definition fip.h:171
struct fc_name name
Name identifier.
Definition fip.h:175
uint8_t reserved[2]
Reserved.
Definition fip.h:173
uint8_t type
Type.
Definition fip.h:169
A FIP priority descriptor.
Definition fip.h:124
uint8_t priority
Priority.
Definition fip.h:135
uint8_t reserved
Reserved.
Definition fip.h:130
uint8_t len
Length in 32-bit words.
Definition fip.h:128
uint8_t type
Type.
Definition fip.h:126
A FIP vendor ID descriptor.
Definition fip.h:326
uint8_t type
Type.
Definition fip.h:328
uint8_t reserved[2]
Reserved.
Definition fip.h:332
uint8_t len
Length in 32-bit words.
Definition fip.h:330
uint8_t vendor[8]
Vendor ID.
Definition fip.h:334
A FIP VLAN descriptor.
Definition fip.h:338
uint16_t vlan
VLAN ID.
Definition fip.h:344
uint8_t len
Length in 32-bit words.
Definition fip.h:342
uint8_t type
Type.
Definition fip.h:340
A FIP Vx port identification descriptor.
Definition fip.h:291
struct fc_name name
Port name.
Definition fip.h:303
uint8_t len
Length in 32-bit words.
Definition fip.h:295
uint8_t type
Type.
Definition fip.h:293
uint8_t mac[ETH_ALEN]
MAC address.
Definition fip.h:297
uint8_t reserved
Reserved.
Definition fip.h:299
struct fc_port_id id
Address identifier.
Definition fip.h:301
A FIP descriptor.
Definition fip.h:348
struct fip_login flogi_ls_acc
FLOGI LS_ACC descriptor.
Definition fip.h:368
struct fip_vendor_id vendor_id
Vendor ID descriptor.
Definition fip.h:400
struct fip_ls_rjt elp_ls_rjt
ELP LS_RJT descriptor.
Definition fip.h:394
struct fip_fka_adv_p fka_adv_p
FKA ADV period descriptor.
Definition fip.h:398
struct fip_common common
Common fields.
Definition fip.h:350
struct fip_els npiv_fdisc
NPIV FDISC descriptor.
Definition fip.h:372
struct fip_name_id name_id
Name identifier descriptor.
Definition fip.h:358
struct fip_elp elp_request
ELP request descriptor.
Definition fip.h:390
struct fip_logo_request logo_request
LOGO request descriptor.
Definition fip.h:382
struct fip_els flogi
FLOGI descriptor.
Definition fip.h:364
struct fip_ls_rjt flogi_ls_rjt
FLOGI LS_RJT descriptor.
Definition fip.h:370
struct fip_elp elp_ls_acc
ELP LS_ACC descriptor.
Definition fip.h:392
struct fip_login flogi_request
FLOGI request descriptor.
Definition fip.h:366
struct fip_logo_response logo_ls_acc
LOGO LS_ACC descriptor.
Definition fip.h:384
struct fip_priority priority
Priority descriptor.
Definition fip.h:352
struct fip_els logo
LOGO descriptor.
Definition fip.h:380
struct fip_max_fcoe_size max_fcoe_size
Max FCoE size descriptor.
Definition fip.h:362
struct fip_fabric fabric
Fabric descriptor.
Definition fip.h:360
struct fip_ls_rjt logo_ls_rjt
LOGO LS_RJT descriptor.
Definition fip.h:386
struct fip_els elp
ELS descriptor.
Definition fip.h:388
struct fip_vx_port_id vx_port_id
Vx port identification descriptor.
Definition fip.h:396
struct fip_login npiv_fdisc_request
NPIV FDISC request descriptor.
Definition fip.h:374
struct fip_vlan vlan
VLAN descriptor.
Definition fip.h:402
struct fip_ls_rjt npiv_fdisc_ls_rjt
NPIV FDISC LS_RJT descriptor.
Definition fip.h:378
struct fip_login npiv_fdisc_ls_acc
NPIV FDISC LS_ACC descriptor.
Definition fip.h:376
struct fip_mac_address mac_address
MAC address descriptor.
Definition fip.h:354
struct fip_fc_map fc_map
FC-MAP descriptor.
Definition fip.h:356