AFS: Use i_generation not i_version for the vnode uniquifier
[linux-2.6/libata-dev.git] / include / scsi / fc / fc_fip.h
blobae25d4ab25486311c59d1954219c4a52eeea0f34
1 /*
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
15 * SOFTWARE.
17 #ifndef _FC_FIP_H_
18 #define _FC_FIP_H_
20 #include <scsi/fc/fc_ns.h>
23 * This version is based on:
24 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf
25 * and T11 FC-BB-6 10-019v4.pdf (June 2010 VN2VN proposal)
28 #define FIP_DEF_PRI 128 /* default selection priority */
29 #define FIP_DEF_FC_MAP 0x0efc00 /* default FCoE MAP (MAC OUI) value */
30 #define FIP_DEF_FKA 8000 /* default FCF keep-alive/advert period (mS) */
31 #define FIP_VN_KA_PERIOD 90000 /* required VN_port keep-alive period (mS) */
32 #define FIP_FCF_FUZZ 100 /* random time added by FCF (mS) */
35 * VN2VN proposed-standard values.
37 #define FIP_VN_FC_MAP 0x0efd00 /* MAC OUI for VN2VN use */
38 #define FIP_VN_PROBE_WAIT 100 /* interval between VN2VN probes (ms) */
39 #define FIP_VN_ANN_WAIT 400 /* interval between VN2VN announcements (ms) */
40 #define FIP_VN_RLIM_INT 10000 /* interval between probes when rate limited */
41 #define FIP_VN_RLIM_COUNT 10 /* number of probes before rate limiting */
42 #define FIP_VN_BEACON_INT 8000 /* interval between VN2VN beacons */
43 #define FIP_VN_BEACON_FUZZ 100 /* random time to add to beacon period (ms) */
46 * Multicast MAC addresses. T11-adopted.
48 #define FIP_ALL_FCOE_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 0 })
49 #define FIP_ALL_ENODE_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 1 })
50 #define FIP_ALL_FCF_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
51 #define FIP_ALL_VN2VN_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 4 })
52 #define FIP_ALL_P2P_MACS ((__u8[6]) { 1, 0x10, 0x18, 1, 0, 5 })
54 #define FIP_VER 1 /* version for fip_header */
56 struct fip_header {
57 __u8 fip_ver; /* upper 4 bits are the version */
58 __u8 fip_resv1; /* reserved */
59 __be16 fip_op; /* operation code */
60 __u8 fip_resv2; /* reserved */
61 __u8 fip_subcode; /* lower 4 bits are sub-code */
62 __be16 fip_dl_len; /* length of descriptors in words */
63 __be16 fip_flags; /* header flags */
64 } __attribute__((packed));
66 #define FIP_VER_SHIFT 4
67 #define FIP_VER_ENCAPS(v) ((v) << FIP_VER_SHIFT)
68 #define FIP_VER_DECAPS(v) ((v) >> FIP_VER_SHIFT)
69 #define FIP_BPW 4 /* bytes per word for lengths */
72 * fip_op.
74 enum fip_opcode {
75 FIP_OP_DISC = 1, /* discovery, advertisement, etc. */
76 FIP_OP_LS = 2, /* Link Service request or reply */
77 FIP_OP_CTRL = 3, /* Keep Alive / Link Reset */
78 FIP_OP_VLAN = 4, /* VLAN discovery */
79 FIP_OP_VN2VN = 5, /* VN2VN operation */
80 FIP_OP_VENDOR_MIN = 0xfff8, /* min vendor-specific opcode */
81 FIP_OP_VENDOR_MAX = 0xfffe, /* max vendor-specific opcode */
85 * Subcodes for FIP_OP_DISC.
87 enum fip_disc_subcode {
88 FIP_SC_SOL = 1, /* solicitation */
89 FIP_SC_ADV = 2, /* advertisement */
93 * Subcodes for FIP_OP_LS.
95 enum fip_trans_subcode {
96 FIP_SC_REQ = 1, /* request */
97 FIP_SC_REP = 2, /* reply */
101 * Subcodes for FIP_OP_RESET.
103 enum fip_reset_subcode {
104 FIP_SC_KEEP_ALIVE = 1, /* keep-alive from VN_Port */
105 FIP_SC_CLR_VLINK = 2, /* clear virtual link from VF_Port */
109 * Subcodes for FIP_OP_VLAN.
111 enum fip_vlan_subcode {
112 FIP_SC_VL_REQ = 1, /* request */
113 FIP_SC_VL_REP = 2, /* reply */
117 * Subcodes for FIP_OP_VN2VN.
119 enum fip_vn2vn_subcode {
120 FIP_SC_VN_PROBE_REQ = 1, /* probe request */
121 FIP_SC_VN_PROBE_REP = 2, /* probe reply */
122 FIP_SC_VN_CLAIM_NOTIFY = 3, /* claim notification */
123 FIP_SC_VN_CLAIM_REP = 4, /* claim response */
124 FIP_SC_VN_BEACON = 5, /* beacon */
128 * flags in header fip_flags.
130 enum fip_flag {
131 FIP_FL_FPMA = 0x8000, /* supports FPMA fabric-provided MACs */
132 FIP_FL_SPMA = 0x4000, /* supports SPMA server-provided MACs */
133 FIP_FL_REC_OR_P2P = 0x0008, /* configured addr or point-to-point */
134 FIP_FL_AVAIL = 0x0004, /* available for FLOGI/ELP */
135 FIP_FL_SOL = 0x0002, /* this is a solicited message */
136 FIP_FL_FPORT = 0x0001, /* sent from an F port */
140 * Common descriptor header format.
142 struct fip_desc {
143 __u8 fip_dtype; /* type - see below */
144 __u8 fip_dlen; /* length - in 32-bit words */
147 enum fip_desc_type {
148 FIP_DT_PRI = 1, /* priority for forwarder selection */
149 FIP_DT_MAC = 2, /* MAC address */
150 FIP_DT_MAP_OUI = 3, /* FC-MAP OUI */
151 FIP_DT_NAME = 4, /* switch name or node name */
152 FIP_DT_FAB = 5, /* fabric descriptor */
153 FIP_DT_FCOE_SIZE = 6, /* max FCoE frame size */
154 FIP_DT_FLOGI = 7, /* FLOGI request or response */
155 FIP_DT_FDISC = 8, /* FDISC request or response */
156 FIP_DT_LOGO = 9, /* LOGO request or response */
157 FIP_DT_ELP = 10, /* ELP request or response */
158 FIP_DT_VN_ID = 11, /* VN_Node Identifier */
159 FIP_DT_FKA = 12, /* advertisement keep-alive period */
160 FIP_DT_VENDOR = 13, /* vendor ID */
161 FIP_DT_VLAN = 14, /* vlan number */
162 FIP_DT_FC4F = 15, /* FC-4 features */
163 FIP_DT_LIMIT, /* max defined desc_type + 1 */
164 FIP_DT_VENDOR_BASE = 128, /* first vendor-specific desc_type */
168 * FIP_DT_PRI - priority descriptor.
170 struct fip_pri_desc {
171 struct fip_desc fd_desc;
172 __u8 fd_resvd;
173 __u8 fd_pri; /* FCF priority: higher is better */
174 } __attribute__((packed));
177 * FIP_DT_MAC - MAC address descriptor.
179 struct fip_mac_desc {
180 struct fip_desc fd_desc;
181 __u8 fd_mac[ETH_ALEN];
182 } __attribute__((packed));
185 * FIP_DT_MAP - descriptor.
187 struct fip_map_desc {
188 struct fip_desc fd_desc;
189 __u8 fd_resvd[3];
190 __u8 fd_map[3];
191 } __attribute__((packed));
194 * FIP_DT_NAME descriptor.
196 struct fip_wwn_desc {
197 struct fip_desc fd_desc;
198 __u8 fd_resvd[2];
199 __be64 fd_wwn; /* 64-bit WWN, unaligned */
200 } __attribute__((packed));
203 * FIP_DT_FAB descriptor.
205 struct fip_fab_desc {
206 struct fip_desc fd_desc;
207 __be16 fd_vfid; /* virtual fabric ID */
208 __u8 fd_resvd;
209 __u8 fd_map[3]; /* FC-MAP value */
210 __be64 fd_wwn; /* fabric name, unaligned */
211 } __attribute__((packed));
214 * FIP_DT_FCOE_SIZE descriptor.
216 struct fip_size_desc {
217 struct fip_desc fd_desc;
218 __be16 fd_size;
219 } __attribute__((packed));
222 * Descriptor that encapsulates an ELS or ILS frame.
223 * The encapsulated frame immediately follows this header, without
224 * SOF, EOF, or CRC.
226 struct fip_encaps {
227 struct fip_desc fd_desc;
228 __u8 fd_resvd[2];
229 } __attribute__((packed));
232 * FIP_DT_VN_ID - VN_Node Identifier descriptor.
234 struct fip_vn_desc {
235 struct fip_desc fd_desc;
236 __u8 fd_mac[ETH_ALEN];
237 __u8 fd_resvd;
238 __u8 fd_fc_id[3];
239 __be64 fd_wwpn; /* port name, unaligned */
240 } __attribute__((packed));
243 * FIP_DT_FKA - Advertisement keep-alive period.
245 struct fip_fka_desc {
246 struct fip_desc fd_desc;
247 __u8 fd_resvd;
248 __u8 fd_flags; /* bit0 is fka disable flag */
249 __be32 fd_fka_period; /* adv./keep-alive period in mS */
250 } __attribute__((packed));
253 * flags for fip_fka_desc.fd_flags
255 enum fip_fka_flags {
256 FIP_FKA_ADV_D = 0x01, /* no need for FKA from ENode */
259 /* FIP_DT_FKA flags */
262 * FIP_DT_FC4F - FC-4 features.
264 struct fip_fc4_feat {
265 struct fip_desc fd_desc;
266 __u8 fd_resvd[2];
267 struct fc_ns_fts fd_fts;
268 struct fc_ns_ff fd_ff;
269 } __attribute__((packed));
272 * FIP_DT_VENDOR descriptor.
274 struct fip_vendor_desc {
275 struct fip_desc fd_desc;
276 __u8 fd_resvd[2];
277 __u8 fd_vendor_id[8];
278 } __attribute__((packed));
280 #endif /* _FC_FIP_H_ */