1 #ifndef _IPXE_FCOE_H
2 #define _IPXE_FCOE_H
3 
4 /**
5  * @file
6  *
7  * Fibre Channel over Ethernet
8  *
9  */
10 
11 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
12 
13 #include <stdint.h>
14 #include <ipxe/fc.h>
15 #include <ipxe/if_ether.h>
16 
17 /** An FCoE name */
18 union fcoe_name {
19 	/** Fibre Channel name */
20 	struct fc_name fc;
21 	/** FCoE name */
22 	struct {
23 		/** Naming authority */
24 		uint16_t authority;
25 		/** MAC address */
26 		uint8_t mac[ETH_ALEN];
27 	} __attribute__ (( packed )) fcoe;
28 };
29 
30 /** IEEE 48-bit address */
31 #define FCOE_AUTHORITY_IEEE 0x1000
32 
33 /** IEEE extended */
34 #define FCOE_AUTHORITY_IEEE_EXTENDED 0x2000
35 
36 /** An FCoE MAC address prefix (FC-MAP) */
37 struct fcoe_map {
38 	uint8_t bytes[3];
39 } __attribute__ (( packed ));
40 
41 /** An FCoE (fabric-assigned) MAC address */
42 struct fcoe_mac {
43 	/** MAC address prefix */
44 	struct fcoe_map map;
45 	/** Port ID */
46 	struct fc_port_id port_id;
47 } __attribute__ (( packed ));
48 
49 /** An FCoE header */
50 struct fcoe_header {
51 	/** FCoE frame version */
52 	uint8_t version;
53 	/** Reserved */
54 	uint8_t reserved[12];
55 	/** Start of Frame marker */
56 	uint8_t sof;
57 } __attribute__ (( packed ));
58 
59 /** FCoE frame version */
60 #define FCOE_FRAME_VER 0x00
61 
62 /** Start of Frame marker values */
63 enum fcoe_sof {
64 	FCOE_SOF_F = 0x28,	/**< Start of Frame Class F */
65 	FCOE_SOF_I2 = 0x2d,	/**< Start of Frame Initiate Class 2 */
66 	FCOE_SOF_N2 = 0x35,	/**< Start of Frame Normal Class 2 */
67 	FCOE_SOF_I3 = 0x2e,	/**< Start of Frame Initiate Class 3 */
68 	FCOE_SOF_N3 = 0x36,	/**< Start of Frame Normal Class 3 */
69 };
70 
71 /** An FCoE footer */
72 struct fcoe_footer {
73 	/** CRC */
74 	uint32_t crc;
75 	/** End of frame marker */
76 	uint8_t eof;
77 	/** Reserved */
78 	uint8_t reserved[3];
79 } __attribute__ (( packed ));
80 
81 /** End of Frame marker value */
82 enum fcoe_eof {
83 	FCOE_EOF_N = 0x41,	/**< End of Frame Normal */
84 	FCOE_EOF_T = 0x42,	/**< End of Frame Terminate */
85 	FCOE_EOF_NI = 0x49,	/**< End of Frame Invalid */
86 	FCOE_EOF_A = 0x50,	/**< End of Frame Abort */
87 };
88 
89 /** FCoE VLAN priority */
90 #define FCOE_VLAN_PRIORITY 3
91 
92 #endif /* _IPXE_FCOE_H */
93