aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/fc/fc_fcoe.h
diff options
context:
space:
mode:
authorRobert Love <robert.w.love@intel.com>2008-12-09 18:10:11 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-12-29 12:24:32 -0500
commitf032c2f7cdaae0e8907cd3b26426fc651dc5c275 (patch)
treea8ee4e4aee28c9d5173cd2c39d83dbbc0b7ebcdb /include/scsi/fc/fc_fcoe.h
parent21465eda9eafa275ed11c27779d90aa95559b6f6 (diff)
[SCSI] FC protocol definition header files
Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include/scsi/fc/fc_fcoe.h')
-rw-r--r--include/scsi/fc/fc_fcoe.h114
1 files changed, 114 insertions, 0 deletions
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h
new file mode 100644
index 000000000000..57aaa8f0d613
--- /dev/null
+++ b/include/scsi/fc/fc_fcoe.h
@@ -0,0 +1,114 @@
1/*
2 * Copyright(c) 2007 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Maintained at www.Open-FCoE.org
18 */
19
20#ifndef _FC_FCOE_H_
21#define _FC_FCOE_H_
22
23/*
24 * FCoE - Fibre Channel over Ethernet.
25 */
26
27/*
28 * The FCoE ethertype eventually goes in net/if_ether.h.
29 */
30#ifndef ETH_P_FCOE
31#define ETH_P_FCOE 0x8906 /* FCOE ether type */
32#endif
33
34#ifndef ETH_P_8021Q
35#define ETH_P_8021Q 0x8100
36#endif
37
38/*
39 * FC_FCOE_OUI hasn't been standardized yet. XXX TBD.
40 */
41#ifndef FC_FCOE_OUI
42#define FC_FCOE_OUI 0x0efc00 /* upper 24 bits of FCOE dest MAC TBD */
43#endif
44
45/*
46 * The destination MAC address for the fabric login may get a different OUI.
47 * This isn't standardized yet.
48 */
49#ifndef FC_FCOE_FLOGI_MAC
50/* gateway MAC - TBD */
51#define FC_FCOE_FLOGI_MAC { 0x0e, 0xfc, 0x00, 0xff, 0xff, 0xfe }
52#endif
53
54#define FC_FCOE_VER 0 /* version */
55
56/*
57 * Ethernet Addresses based on FC S_ID and D_ID.
58 * Generated by FC_FCOE_OUI | S_ID/D_ID
59 */
60#define FC_FCOE_ENCAPS_ID(n) (((u64) FC_FCOE_OUI << 24) | (n))
61#define FC_FCOE_DECAPS_ID(n) ((n) >> 24)
62
63/*
64 * FCoE frame header - 14 bytes
65 *
66 * This is the August 2007 version of the FCoE header as defined by T11.
67 * This follows the VLAN header, which includes the ethertype.
68 */
69struct fcoe_hdr {
70 __u8 fcoe_ver; /* version field - upper 4 bits */
71 __u8 fcoe_resvd[12]; /* reserved - send zero and ignore */
72 __u8 fcoe_sof; /* start of frame per RFC 3643 */
73};
74
75#define FC_FCOE_DECAPS_VER(hp) ((hp)->fcoe_ver >> 4)
76#define FC_FCOE_ENCAPS_VER(hp, ver) ((hp)->fcoe_ver = (ver) << 4)
77
78/*
79 * FCoE CRC & EOF - 8 bytes.
80 */
81struct fcoe_crc_eof {
82 __le32 fcoe_crc32; /* CRC for FC packet */
83 __u8 fcoe_eof; /* EOF from RFC 3643 */
84 __u8 fcoe_resvd[3]; /* reserved - send zero and ignore */
85} __attribute__((packed));
86
87/*
88 * Minimum FCoE + FC header length
89 * 14 bytes FCoE header + 24 byte FC header = 38 bytes
90 */
91#define FCOE_HEADER_LEN 38
92
93/*
94 * Minimum FCoE frame size
95 * 14 bytes FCoE header + 24 byte FC header + 8 byte FCoE trailer = 46 bytes
96 */
97#define FCOE_MIN_FRAME 46
98
99/*
100 * fc_fcoe_set_mac - Store OUI + DID into MAC address field.
101 * @mac: mac address to be set
102 * @did: fc dest id to use
103 */
104static inline void fc_fcoe_set_mac(u8 *mac, u8 *did)
105{
106 mac[0] = (u8) (FC_FCOE_OUI >> 16);
107 mac[1] = (u8) (FC_FCOE_OUI >> 8);
108 mac[2] = (u8) FC_FCOE_OUI;
109 mac[3] = did[0];
110 mac[4] = did[1];
111 mac[5] = did[2];
112}
113
114#endif /* _FC_FCOE_H_ */