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
25 #define FIP_DEF_PRI 128 /* default selection priority */
26 #define FIP_DEF_FC_MAP 0x0efc00 /* default FCoE MAP (MAC OUI) value */
27 #define FIP_DEF_FKA 8000 /* default FCF keep-alive/advert period (mS) */
28 #define FIP_VN_KA_PERIOD 90000 /* required VN_port keep-alive period (mS) */
29 #define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */
32 * Multicast MAC addresses. T11-adopted.
34 #define FIP_ALL_FCOE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 0 })
35 #define FIP_ALL_ENODE_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 1 })
36 #define FIP_ALL_FCF_MACS ((u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
38 #define FIP_VER 1 /* version for fip_header */
41 __u8 fip_ver; /* upper 4 bits are the version */
42 __u8 fip_resv1; /* reserved */
43 __be16 fip_op; /* operation code */
44 __u8 fip_resv2; /* reserved */
45 __u8 fip_subcode; /* lower 4 bits are sub-code */
46 __be16 fip_dl_len; /* length of descriptors in words */
47 __be16 fip_flags; /* header flags */
48 } __attribute__((packed));
50 #define FIP_VER_SHIFT 4
51 #define FIP_VER_ENCAPS(v) ((v) << FIP_VER_SHIFT)
52 #define FIP_VER_DECAPS(v) ((v) >> FIP_VER_SHIFT)
53 #define FIP_BPW 4 /* bytes per word for lengths */
59 FIP_OP_DISC = 1, /* discovery, advertisement, etc. */
60 FIP_OP_LS = 2, /* Link Service request or reply */
61 FIP_OP_CTRL = 3, /* Keep Alive / Link Reset */
62 FIP_OP_VLAN = 4, /* VLAN discovery */
63 FIP_OP_VENDOR_MIN = 0xfff8, /* min vendor-specific opcode */
64 FIP_OP_VENDOR_MAX = 0xfffe, /* max vendor-specific opcode */
68 * Subcodes for FIP_OP_DISC.
70 enum fip_disc_subcode {
71 FIP_SC_SOL = 1, /* solicitation */
72 FIP_SC_ADV = 2, /* advertisement */
76 * Subcodes for FIP_OP_LS.
78 enum fip_trans_subcode {
79 FIP_SC_REQ = 1, /* request */
80 FIP_SC_REP = 2, /* reply */
84 * Subcodes for FIP_OP_RESET.
86 enum fip_reset_subcode {
87 FIP_SC_KEEP_ALIVE = 1, /* keep-alive from VN_Port */
88 FIP_SC_CLR_VLINK = 2, /* clear virtual link from VF_Port */
92 * Subcodes for FIP_OP_VLAN.
94 enum fip_vlan_subcode {
95 FIP_SC_VL_REQ = 1, /* request */
96 FIP_SC_VL_REP = 2, /* reply */
100 * flags in header fip_flags.
103 FIP_FL_FPMA = 0x8000, /* supports FPMA fabric-provided MACs */
104 FIP_FL_SPMA = 0x4000, /* supports SPMA server-provided MACs */
105 FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */
106 FIP_FL_SOL = 0x0002, /* this is a solicited message */
107 FIP_FL_FPORT = 0x0001, /* sent from an F port */
111 * Common descriptor header format.
114 __u8 fip_dtype; /* type - see below */
115 __u8 fip_dlen; /* length - in 32-bit words */
119 FIP_DT_PRI = 1, /* priority for forwarder selection */
120 FIP_DT_MAC = 2, /* MAC address */
121 FIP_DT_MAP_OUI = 3, /* FC-MAP OUI */
122 FIP_DT_NAME = 4, /* switch name or node name */
123 FIP_DT_FAB = 5, /* fabric descriptor */
124 FIP_DT_FCOE_SIZE = 6, /* max FCoE frame size */
125 FIP_DT_FLOGI = 7, /* FLOGI request or response */
126 FIP_DT_FDISC = 8, /* FDISC request or response */
127 FIP_DT_LOGO = 9, /* LOGO request or response */
128 FIP_DT_ELP = 10, /* ELP request or response */
129 FIP_DT_VN_ID = 11, /* VN_Node Identifier */
130 FIP_DT_FKA = 12, /* advertisement keep-alive period */
131 FIP_DT_VENDOR = 13, /* vendor ID */
132 FIP_DT_VLAN = 14, /* vlan number */
133 FIP_DT_LIMIT, /* max defined desc_type + 1 */
134 FIP_DT_VENDOR_BASE = 128, /* first vendor-specific desc_type */
138 * FIP_DT_PRI - priority descriptor.
140 struct fip_pri_desc {
141 struct fip_desc fd_desc;
143 __u8 fd_pri; /* FCF priority: higher is better */
144 } __attribute__((packed));
147 * FIP_DT_MAC - MAC address descriptor.
149 struct fip_mac_desc {
150 struct fip_desc fd_desc;
151 __u8 fd_mac[ETH_ALEN];
152 } __attribute__((packed));
155 * FIP_DT_MAP - descriptor.
157 struct fip_map_desc {
158 struct fip_desc fd_desc;
161 } __attribute__((packed));
164 * FIP_DT_NAME descriptor.
166 struct fip_wwn_desc {
167 struct fip_desc fd_desc;
169 __be64 fd_wwn; /* 64-bit WWN, unaligned */
170 } __attribute__((packed));
173 * FIP_DT_FAB descriptor.
175 struct fip_fab_desc {
176 struct fip_desc fd_desc;
177 __be16 fd_vfid; /* virtual fabric ID */
179 __u8 fd_map[3]; /* FC-MAP value */
180 __be64 fd_wwn; /* fabric name, unaligned */
181 } __attribute__((packed));
184 * FIP_DT_FCOE_SIZE descriptor.
186 struct fip_size_desc {
187 struct fip_desc fd_desc;
189 } __attribute__((packed));
192 * Descriptor that encapsulates an ELS or ILS frame.
193 * The encapsulated frame immediately follows this header, without
197 struct fip_desc fd_desc;
199 } __attribute__((packed));
202 * FIP_DT_VN_ID - VN_Node Identifier descriptor.
205 struct fip_desc fd_desc;
206 __u8 fd_mac[ETH_ALEN];
209 __be64 fd_wwpn; /* port name, unaligned */
210 } __attribute__((packed));
213 * FIP_DT_FKA - Advertisement keep-alive period.
215 struct fip_fka_desc {
216 struct fip_desc fd_desc;
218 __be32 fd_fka_period; /* adv./keep-alive period in mS */
219 } __attribute__((packed));
222 * FIP_DT_VENDOR descriptor.
224 struct fip_vendor_desc {
225 struct fip_desc fd_desc;
227 __u8 fd_vendor_id[8];
228 } __attribute__((packed));
230 #endif /* _FC_FIP_H_ */