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 */
29 struct 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 */
50 enum fip_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 */
82 enum 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 */
91 struct fip_common {
92  /** Type */
94  /** Length in 32-bit words */
96  /** Reserved */
98 } __attribute__ (( packed ));
99 
100 /** FIP descriptor types */
101 enum fip_type {
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 */
124 struct fip_priority {
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 */
155 struct fip_fc_map {
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 */
167 struct fip_name_id {
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 */
179 struct fip_fabric {
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 */
205 struct 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 */
219 struct 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 */
261 struct 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 */
277 struct fip_ls_rjt {
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 */
301  struct fc_port_id id;
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 */
338 struct 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 */
364  struct fip_els flogi;
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 */
402  struct fip_vlan vlan;
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 */
fip_type
FIP descriptor types.
Definition: fip.h:101
#define __attribute__(x)
Definition: compiler.h:10
struct fc_login_frame els
ELS frame.
Definition: fip.h:229
struct fip_login flogi_ls_acc
FLOGI LS_ACC descriptor.
Definition: fip.h:368
struct fc_name name
Port name.
Definition: fip.h:303
A FIP descriptor containing an encapsulated login frame.
Definition: fip.h:219
Fibre Channel ELS frame common parameters.
Definition: fcels.h:22
A FIP descriptor containing an encapsulated LOGO request frame.
Definition: fip.h:233
unsigned short uint16_t
Definition: stdint.h:11
uint8_t reserved[2]
Reserved.
Definition: fip.h:211
fip_els_subcode
FIP protocol subcode for extended link services.
Definition: fip.h:64
Reserved.
Definition: fip.h:102
struct fip_vx_port_id vx_port_id
Vx port identification descriptor.
Definition: fip.h:396
A FIP fabric descriptor.
Definition: fip.h:179
Discovery advertisement.
Definition: fip.h:60
uint8_t reserved[2]
Reserved.
Definition: fip.h:253
uint8_t type
Type.
Definition: fip.h:93
struct fc_logout_request_frame els
ELS frame.
Definition: fip.h:243
uint8_t type
Type.
Definition: fip.h:309
A FIP priority descriptor.
Definition: fip.h:124
#define FIP_DESCRIPTOR(type, name)
Define a function to extract a specific FIP descriptor type from a list.
Definition: fip.h:418
struct fc_logout_response_frame els
ELS frame.
Definition: fip.h:257
struct fip_vlan vlan
VLAN descriptor.
Definition: fip.h:402
Vx port identification.
Definition: fip.h:113
uint8_t reserved[2]
Reserved.
Definition: fip.h:97
uint8_t len
Length in 32-bit words.
Definition: fip.h:95
uint8_t flags
Flags.
Definition: fip.h:315
fip_flags
FIP flags.
Definition: fip.h:82
uint8_t len
Length in 32-bit words.
Definition: fip.h:251
struct fc_frame_header fc
Fibre Channel frame header.
Definition: fip.h:255
uint8_t reserved_b
Reserved.
Definition: fip.h:37
uint8_t type
Type.
Definition: fip.h:197
MAC address.
Definition: fip.h:104
uint8_t len
Length in 32-bit words.
Definition: fip.h:295
FLOGI.
Definition: fip.h:109
uint8_t len
Length in 32-bit words.
Definition: fip.h:171
struct fc_port_id id
Address identifier.
Definition: fip.h:301
Max FCoE size.
Definition: fip.h:108
A FIP Vx port identification descriptor.
Definition: fip.h:291
Forwarder.
Definition: fip.h:87
Available for login.
Definition: fip.h:85
uint8_t len
Length in 32-bit words.
Definition: fip.h:265
struct fip_common common
Common fields.
Definition: fip.h:350
uint8_t priority
Priority.
Definition: fip.h:135
uint8_t type
Type.
Definition: fip.h:147
uint8_t len
Length in 32-bit words.
Definition: fip.h:223
uint8_t type
Type.
Definition: fip.h:328
struct fip_ls_rjt logo_ls_rjt
LOGO LS_RJT descriptor.
Definition: fip.h:386
A FIP descriptor containing an encapsulated ELP frame.
Definition: fip.h:261
uint8_t type
Type.
Definition: fip.h:279
A FIP VLAN descriptor.
Definition: fip.h:338
uint16_t mtu
Maximum FCoE size.
Definition: fip.h:201
Keep alive.
Definition: fip.h:71
uint8_t reserved[2]
Reserved.
Definition: fip.h:267
uint8_t type
Type.
Definition: fip.h:126
struct fip_mac_address mac_address
MAC address descriptor.
Definition: fip.h:354
uint16_t code
Protocol code.
Definition: fip.h:35
Fibre Channel over Ethernet.
struct fc_frame_header fc
Fibre Channel frame header.
Definition: fip.h:227
struct fip_name_id name_id
Name identifier descriptor.
Definition: fip.h:358
Clear virtual links.
Definition: fip.h:72
A FIP frame header.
Definition: fip.h:29
struct fip_els npiv_fdisc
NPIV FDISC descriptor.
Definition: fip.h:372
fip_fka_adv_p_flags
FIP FKA ADV period flags.
Definition: fip.h:321
uint8_t vendor_id[3]
Definition: ib_mad.h:22
uint8_t reserved
Reserved.
Definition: fip.h:187
uint16_t vf_id
Virtual Fabric ID, if any.
Definition: fip.h:185
Discovery solicitation.
Definition: fip.h:59
struct fc_frame_header fc
Fibre Channel frame header.
Definition: fip.h:269
A Fibre Channel port identifier.
Definition: fc.h:37
struct fip_elp elp_request
ELP request descriptor.
Definition: fip.h:390
A FIP vendor ID descriptor.
Definition: fip.h:326
struct fip_els logo
LOGO descriptor.
Definition: fip.h:380
struct fcoe_map map
FC-MAP.
Definition: fip.h:189
uint8_t reserved[2]
Reserved.
Definition: fip.h:173
struct fip_ls_rjt flogi_ls_rjt
FLOGI LS_RJT descriptor.
Definition: fip.h:370
fip_vlan_subcode
FIP protocol subcode for VLAN.
Definition: fip.h:76
A FIP descriptor containing an encapsulated LS_RJT frame.
Definition: fip.h:277
uint16_t flags
Flags.
Definition: fip.h:43
struct fc_els_frame_common els
ELS frame.
Definition: fip.h:215
uint8_t reserved[2]
Reserved.
Definition: fip.h:332
uint8_t len
Length in 32-bit words.
Definition: fip.h:330
LOGO.
Definition: fip.h:111
fip_vitality_subcode
FIP protocol subcode for keep alive / clear links.
Definition: fip.h:70
struct fc_frame_header fc
Fibre Channel frame header.
Definition: fip.h:285
uint8_t version
Frame version.
Definition: fip.h:31
uint8_t reserved[2]
Reserved.
Definition: fip.h:283
uint16_t vlan
VLAN ID.
Definition: fip.h:344
Maintain virtual links.
Definition: fip.h:53
uint32_t dull[25]
Uninteresting content.
Definition: fip.h:273
struct fc_name name
Name identifier.
Definition: fip.h:175
FIP descriptor common fields.
Definition: fip.h:91
uint8_t vendor[8]
Vendor ID.
Definition: fip.h:334
uint8_t reserved[2]
Reserved.
Definition: fip.h:239
uint8_t len
Length in 32-bit words.
Definition: fip.h:149
uint8_t type
Type.
Definition: fip.h:169
struct fip_logo_request logo_request
LOGO request descriptor.
Definition: fip.h:382
A FIP descriptor set.
Definition: fip.h:406
uint8_t type
Type.
Definition: fip.h:157
VLAN.
Definition: fip.h:54
uint16_t len
Descriptor list length in 32-bit words.
Definition: fip.h:41
ELS response.
Definition: fip.h:66
Name identifier.
Definition: fip.h:106
VLAN.
Definition: fip.h:116
Fabric.
Definition: fip.h:107
A FIP MAC address descriptor.
Definition: fip.h:145
struct fip_logo_response logo_ls_acc
LOGO LS_ACC descriptor.
Definition: fip.h:384
struct fc_els_frame_common els
ELS frame.
Definition: fip.h:271
unsigned char uint8_t
Definition: stdint.h:10
A FIP max FCoE size descriptor.
Definition: fip.h:195
struct fip_priority priority
Priority descriptor.
Definition: fip.h:352
uint8_t reserved
Reserved.
Definition: fip.h:299
struct fip_ls_rjt npiv_fdisc_ls_rjt
NPIV FDISC LS_RJT descriptor.
Definition: fip.h:378
A FIP FC-MAP descriptor.
Definition: fip.h:155
struct fip_els flogi
FLOGI descriptor.
Definition: fip.h:364
uint8_t type
Type.
Definition: fip.h:293
#define ETH_ALEN
Definition: if_ether.h:8
Fibre Channel.
uint8_t reserved
Reserved.
Definition: fip.h:130
uint8_t reserved[2]
Reserved.
Definition: fip.h:225
A FIP FKA ADV period descriptor.
Definition: fip.h:307
unsigned int uint32_t
Definition: stdint.h:12
struct fcoe_map map
FC-MAP.
Definition: fip.h:163
Vendor ID.
Definition: fip.h:115
FC-MAP.
Definition: fip.h:105
A FIP descriptor containing an encapsulated LOGO response frame.
Definition: fip.h:247
union fip_descriptor * desc[FIP_NUM_DESCRIPTOR_TYPES]
Descriptors, indexed by type.
Definition: fip.h:408
uint8_t len
Length in 32-bit words.
Definition: fip.h:342
A Fibre Channel LOGO response frame.
Definition: fcels.h:244
A FIP descriptor containing an encapsulated ELS frame.
Definition: fip.h:205
uint8_t len
Length in 32-bit words.
Definition: fip.h:237
A Fibre Channel name.
Definition: fc.h:29
uint8_t len
Length in 32-bit words.
Definition: fip.h:128
Solicited.
Definition: fip.h:86
uint8_t type
Type.
Definition: fip.h:181
uint8_t len
Length in 32-bit words.
Definition: fip.h:159
VLAN request.
Definition: fip.h:77
Extended link services.
Definition: fip.h:52
uint8_t reserved_a
Reserved.
Definition: fip.h:33
VLAN notification.
Definition: fip.h:78
uint8_t reserved[3]
Reserved.
Definition: fip.h:161
A Fibre Channel LS_RJT frame.
Definition: fcels.h:43
struct fip_login flogi_request
FLOGI request descriptor.
Definition: fip.h:366
uint16_t priority
Priotity.
Definition: stp.h:12
uint8_t type
Type.
Definition: fip.h:235
struct fip_fc_map fc_map
FC-MAP descriptor.
Definition: fip.h:356
uint8_t type
Type.
Definition: fip.h:340
struct fip_login npiv_fdisc_ls_acc
NPIV FDISC LS_ACC descriptor.
Definition: fip.h:376
fip_code
FIP protocol code.
Definition: fip.h:50
struct fip_login npiv_fdisc_request
NPIV FDISC request descriptor.
Definition: fip.h:374
uint8_t mac[ETH_ALEN]
MAC address.
Definition: fip.h:151
uint8_t mac[ETH_ALEN]
MAC address.
Definition: fip.h:297
struct fc_name name
Fabric name.
Definition: fip.h:191
struct fip_fka_adv_p fka_adv_p
FKA ADV period descriptor.
Definition: fip.h:398
An FCoE MAC address prefix (FC-MAP)
Definition: fcoe.h:37
struct fc_ls_rjt_frame els
ELS frame.
Definition: fip.h:287
fip_discovery_subcode
FIP protocol subcode for discovery.
Definition: fip.h:58
struct fip_vendor_id vendor_id
Vendor ID descriptor.
Definition: fip.h:400
Priority.
Definition: fip.h:103
uint8_t type
Type.
Definition: fip.h:207
uint8_t reserved
Reserved.
Definition: fip.h:313
ELP.
Definition: fip.h:112
uint8_t len
Length in 32-bit words.
Definition: fip.h:281
uint8_t type
Type.
Definition: fip.h:249
struct fip_ls_rjt elp_ls_rjt
ELP LS_RJT descriptor.
Definition: fip.h:394
NPIV FDISC.
Definition: fip.h:110
Fabric-provided MAC address.
Definition: fip.h:83
uint8_t subcode
Subcode.
Definition: fip.h:39
struct fc_frame_header fc
Fibre Channel frame header.
Definition: fip.h:241
uint8_t len
Length in 32-bit words.
Definition: fip.h:199
ELS request.
Definition: fip.h:65
struct fc_frame_header fc
Fibre Channel frame header.
Definition: fip.h:213
A FIP descriptor.
Definition: fip.h:348
uint8_t type
Type.
Definition: fip.h:221
FKA ADV period.
Definition: fip.h:114
uint8_t len
Length in 32-bit words.
Definition: fip.h:183
struct fip_max_fcoe_size max_fcoe_size
Max FCoE size descriptor.
Definition: fip.h:362
A FIP name identifier descriptor.
Definition: fip.h:167
A Fibre Channel FLOGI/PLOGI frame.
Definition: fcels.h:208
Discovery.
Definition: fip.h:51
struct fip_fabric fabric
Fabric descriptor.
Definition: fip.h:360
uint8_t type
Type.
Definition: fip.h:263
Do not send keepalives.
Definition: fip.h:322
struct fip_els elp
ELS descriptor.
Definition: fip.h:388
A Fibre Channel LOGO request frame.
Definition: fcels.h:232
uint8_t len
Length in 32-bit words.
Definition: fip.h:209
uint32_t period
Keep alive advertisement period in milliseconds.
Definition: fip.h:317
struct fip_elp elp_ls_acc
ELP LS_ACC descriptor.
Definition: fip.h:392
Server-provided MAC address.
Definition: fip.h:84
uint8_t len
Length in 32-bit words.
Definition: fip.h:311
Fibre Channel Extended Link Services.
A Fibre Channel Frame Header.
Definition: fc.h:120