2 * Copyright 2008 Cisco Systems, Inc. All rights reserved.
4 * This program is free software; you may redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * This version is based on:
22 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf
26 * The FIP ethertype eventually goes in net/if_ether.h.
29 #define ETH_P_FIP 0x8914 /* FIP Ethertype */
32 #define FIP_DEF_PRI 128 /* default selection priority */
33 #define FIP_DEF_FC_MAP 0x0efc00 /* default FCoE MAP (MAC OUI) value */
34 #define FIP_DEF_FKA 8000 /* default FCF keep-alive/advert period (mS) */
35 #define FIP_VN_KA_PERIOD 90000 /* required VN_port keep-alive period (mS) */
36 #define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */
39 * Multicast MAC addresses. T11-adopted.
41 #define FIP_ALL_FCOE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 0 })
42 #define FIP_ALL_ENODE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 1 })
43 #define FIP_ALL_FCF_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
45 #define FIP_VER 1 /* version for fip_header */
48 __u8 fip_ver
; /* upper 4 bits are the version */
49 __u8 fip_resv1
; /* reserved */
50 __be16 fip_op
; /* operation code */
51 __u8 fip_resv2
; /* reserved */
52 __u8 fip_subcode
; /* lower 4 bits are sub-code */
53 __be16 fip_dl_len
; /* length of descriptors in words */
54 __be16 fip_flags
; /* header flags */
55 } __attribute__((packed
));
57 #define FIP_VER_SHIFT 4
58 #define FIP_VER_ENCAPS(v) ((v) << FIP_VER_SHIFT)
59 #define FIP_VER_DECAPS(v) ((v) >> FIP_VER_SHIFT)
60 #define FIP_BPW 4 /* bytes per word for lengths */
66 FIP_OP_DISC
= 1, /* discovery, advertisement, etc. */
67 FIP_OP_LS
= 2, /* Link Service request or reply */
68 FIP_OP_CTRL
= 3, /* Keep Alive / Link Reset */
69 FIP_OP_VLAN
= 4, /* VLAN discovery */
70 FIP_OP_VENDOR_MIN
= 0xfff8, /* min vendor-specific opcode */
71 FIP_OP_VENDOR_MAX
= 0xfffe, /* max vendor-specific opcode */
75 * Subcodes for FIP_OP_DISC.
77 enum fip_disc_subcode
{
78 FIP_SC_SOL
= 1, /* solicitation */
79 FIP_SC_ADV
= 2, /* advertisement */
83 * Subcodes for FIP_OP_LS.
85 enum fip_trans_subcode
{
86 FIP_SC_REQ
= 1, /* request */
87 FIP_SC_REP
= 2, /* reply */
91 * Subcodes for FIP_OP_RESET.
93 enum fip_reset_subcode
{
94 FIP_SC_KEEP_ALIVE
= 1, /* keep-alive from VN_Port */
95 FIP_SC_CLR_VLINK
= 2, /* clear virtual link from VF_Port */
99 * Subcodes for FIP_OP_VLAN.
101 enum fip_vlan_subcode
{
102 FIP_SC_VL_REQ
= 1, /* request */
103 FIP_SC_VL_REP
= 2, /* reply */
107 * flags in header fip_flags.
110 FIP_FL_FPMA
= 0x8000, /* supports FPMA fabric-provided MACs */
111 FIP_FL_SPMA
= 0x4000, /* supports SPMA server-provided MACs */
112 FIP_FL_AVAIL
= 0x0004, /* available for FLOGI/ELP */
113 FIP_FL_SOL
= 0x0002, /* this is a solicited message */
114 FIP_FL_FPORT
= 0x0001, /* sent from an F port */
118 * Common descriptor header format.
121 __u8 fip_dtype
; /* type - see below */
122 __u8 fip_dlen
; /* length - in 32-bit words */
126 FIP_DT_PRI
= 1, /* priority for forwarder selection */
127 FIP_DT_MAC
= 2, /* MAC address */
128 FIP_DT_MAP_OUI
= 3, /* FC-MAP OUI */
129 FIP_DT_NAME
= 4, /* switch name or node name */
130 FIP_DT_FAB
= 5, /* fabric descriptor */
131 FIP_DT_FCOE_SIZE
= 6, /* max FCoE frame size */
132 FIP_DT_FLOGI
= 7, /* FLOGI request or response */
133 FIP_DT_FDISC
= 8, /* FDISC request or response */
134 FIP_DT_LOGO
= 9, /* LOGO request or response */
135 FIP_DT_ELP
= 10, /* ELP request or response */
136 FIP_DT_VN_ID
= 11, /* VN_Node Identifier */
137 FIP_DT_FKA
= 12, /* advertisement keep-alive period */
138 FIP_DT_VENDOR
= 13, /* vendor ID */
139 FIP_DT_VLAN
= 14, /* vlan number */
140 FIP_DT_LIMIT
, /* max defined desc_type + 1 */
141 FIP_DT_VENDOR_BASE
= 128, /* first vendor-specific desc_type */
145 * FIP_DT_PRI - priority descriptor.
147 struct fip_pri_desc
{
148 struct fip_desc fd_desc
;
150 __u8 fd_pri
; /* FCF priority: higher is better */
151 } __attribute__((packed
));
154 * FIP_DT_MAC - MAC address descriptor.
156 struct fip_mac_desc
{
157 struct fip_desc fd_desc
;
158 __u8 fd_mac
[ETH_ALEN
];
159 } __attribute__((packed
));
162 * FIP_DT_MAP - descriptor.
164 struct fip_map_desc
{
165 struct fip_desc fd_desc
;
168 } __attribute__((packed
));
171 * FIP_DT_NAME descriptor.
173 struct fip_wwn_desc
{
174 struct fip_desc fd_desc
;
176 __be64 fd_wwn
; /* 64-bit WWN, unaligned */
177 } __attribute__((packed
));
180 * FIP_DT_FAB descriptor.
182 struct fip_fab_desc
{
183 struct fip_desc fd_desc
;
184 __be16 fd_vfid
; /* virtual fabric ID */
186 __u8 fd_map
[3]; /* FC-MAP value */
187 __be64 fd_wwn
; /* fabric name, unaligned */
188 } __attribute__((packed
));
191 * FIP_DT_FCOE_SIZE descriptor.
193 struct fip_size_desc
{
194 struct fip_desc fd_desc
;
196 } __attribute__((packed
));
199 * Descriptor that encapsulates an ELS or ILS frame.
200 * The encapsulated frame immediately follows this header, without
204 struct fip_desc fd_desc
;
206 } __attribute__((packed
));
209 * FIP_DT_VN_ID - VN_Node Identifier descriptor.
212 struct fip_desc fd_desc
;
213 __u8 fd_mac
[ETH_ALEN
];
216 __be64 fd_wwpn
; /* port name, unaligned */
217 } __attribute__((packed
));
220 * FIP_DT_FKA - Advertisement keep-alive period.
222 struct fip_fka_desc
{
223 struct fip_desc fd_desc
;
225 __be32 fd_fka_period
; /* adv./keep-alive period in mS */
226 } __attribute__((packed
));
229 * FIP_DT_VENDOR descriptor.
231 struct fip_vendor_desc
{
232 struct fip_desc fd_desc
;
234 __u8 fd_vendor_id
[8];
235 } __attribute__((packed
));
237 #endif /* _FC_FIP_H_ */