diff options
Diffstat (limited to 'include/scsi/fc')
-rw-r--r-- | include/scsi/fc/fc_fcoe.h | 11 | ||||
-rw-r--r-- | include/scsi/fc/fc_fip.h | 237 | ||||
-rw-r--r-- | include/scsi/fc/fc_fs.h | 6 |
3 files changed, 243 insertions, 11 deletions
diff --git a/include/scsi/fc/fc_fcoe.h b/include/scsi/fc/fc_fcoe.h index 57aaa8f0d613..ccb3dbe90463 100644 --- a/include/scsi/fc/fc_fcoe.h +++ b/include/scsi/fc/fc_fcoe.h | |||
@@ -25,17 +25,6 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | /* | 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. | 28 | * FC_FCOE_OUI hasn't been standardized yet. XXX TBD. |
40 | */ | 29 | */ |
41 | #ifndef FC_FCOE_OUI | 30 | #ifndef FC_FCOE_OUI |
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h new file mode 100644 index 000000000000..0627a9ae6347 --- /dev/null +++ b/include/scsi/fc/fc_fip.h | |||
@@ -0,0 +1,237 @@ | |||
1 | /* | ||
2 | * Copyright 2008 Cisco Systems, Inc. All rights reserved. | ||
3 | * | ||
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. | ||
7 | * | ||
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. | ||
16 | */ | ||
17 | #ifndef _FC_FIP_H_ | ||
18 | #define _FC_FIP_H_ | ||
19 | |||
20 | /* | ||
21 | * This version is based on: | ||
22 | * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf | ||
23 | */ | ||
24 | |||
25 | /* | ||
26 | * The FIP ethertype eventually goes in net/if_ether.h. | ||
27 | */ | ||
28 | #ifndef ETH_P_FIP | ||
29 | #define ETH_P_FIP 0x8914 /* FIP Ethertype */ | ||
30 | #endif | ||
31 | |||
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) */ | ||
37 | |||
38 | /* | ||
39 | * Multicast MAC addresses. T11-adopted. | ||
40 | */ | ||
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 }) | ||
44 | |||
45 | #define FIP_VER 1 /* version for fip_header */ | ||
46 | |||
47 | struct 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)); | ||
56 | |||
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 */ | ||
61 | |||
62 | /* | ||
63 | * fip_op. | ||
64 | */ | ||
65 | enum fip_opcode { | ||
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 */ | ||
72 | }; | ||
73 | |||
74 | /* | ||
75 | * Subcodes for FIP_OP_DISC. | ||
76 | */ | ||
77 | enum fip_disc_subcode { | ||
78 | FIP_SC_SOL = 1, /* solicitation */ | ||
79 | FIP_SC_ADV = 2, /* advertisement */ | ||
80 | }; | ||
81 | |||
82 | /* | ||
83 | * Subcodes for FIP_OP_LS. | ||
84 | */ | ||
85 | enum fip_trans_subcode { | ||
86 | FIP_SC_REQ = 1, /* request */ | ||
87 | FIP_SC_REP = 2, /* reply */ | ||
88 | }; | ||
89 | |||
90 | /* | ||
91 | * Subcodes for FIP_OP_RESET. | ||
92 | */ | ||
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 */ | ||
96 | }; | ||
97 | |||
98 | /* | ||
99 | * Subcodes for FIP_OP_VLAN. | ||
100 | */ | ||
101 | enum fip_vlan_subcode { | ||
102 | FIP_SC_VL_REQ = 1, /* request */ | ||
103 | FIP_SC_VL_REP = 2, /* reply */ | ||
104 | }; | ||
105 | |||
106 | /* | ||
107 | * flags in header fip_flags. | ||
108 | */ | ||
109 | enum fip_flag { | ||
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 */ | ||
115 | }; | ||
116 | |||
117 | /* | ||
118 | * Common descriptor header format. | ||
119 | */ | ||
120 | struct fip_desc { | ||
121 | __u8 fip_dtype; /* type - see below */ | ||
122 | __u8 fip_dlen; /* length - in 32-bit words */ | ||
123 | }; | ||
124 | |||
125 | enum fip_desc_type { | ||
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 */ | ||
142 | }; | ||
143 | |||
144 | /* | ||
145 | * FIP_DT_PRI - priority descriptor. | ||
146 | */ | ||
147 | struct fip_pri_desc { | ||
148 | struct fip_desc fd_desc; | ||
149 | __u8 fd_resvd; | ||
150 | __u8 fd_pri; /* FCF priority: higher is better */ | ||
151 | } __attribute__((packed)); | ||
152 | |||
153 | /* | ||
154 | * FIP_DT_MAC - MAC address descriptor. | ||
155 | */ | ||
156 | struct fip_mac_desc { | ||
157 | struct fip_desc fd_desc; | ||
158 | __u8 fd_mac[ETH_ALEN]; | ||
159 | } __attribute__((packed)); | ||
160 | |||
161 | /* | ||
162 | * FIP_DT_MAP - descriptor. | ||
163 | */ | ||
164 | struct fip_map_desc { | ||
165 | struct fip_desc fd_desc; | ||
166 | __u8 fd_resvd[3]; | ||
167 | __u8 fd_map[3]; | ||
168 | } __attribute__((packed)); | ||
169 | |||
170 | /* | ||
171 | * FIP_DT_NAME descriptor. | ||
172 | */ | ||
173 | struct fip_wwn_desc { | ||
174 | struct fip_desc fd_desc; | ||
175 | __u8 fd_resvd[2]; | ||
176 | __be64 fd_wwn; /* 64-bit WWN, unaligned */ | ||
177 | } __attribute__((packed)); | ||
178 | |||
179 | /* | ||
180 | * FIP_DT_FAB descriptor. | ||
181 | */ | ||
182 | struct fip_fab_desc { | ||
183 | struct fip_desc fd_desc; | ||
184 | __be16 fd_vfid; /* virtual fabric ID */ | ||
185 | __u8 fd_resvd; | ||
186 | __u8 fd_map[3]; /* FC-MAP value */ | ||
187 | __be64 fd_wwn; /* fabric name, unaligned */ | ||
188 | } __attribute__((packed)); | ||
189 | |||
190 | /* | ||
191 | * FIP_DT_FCOE_SIZE descriptor. | ||
192 | */ | ||
193 | struct fip_size_desc { | ||
194 | struct fip_desc fd_desc; | ||
195 | __be16 fd_size; | ||
196 | } __attribute__((packed)); | ||
197 | |||
198 | /* | ||
199 | * Descriptor that encapsulates an ELS or ILS frame. | ||
200 | * The encapsulated frame immediately follows this header, without | ||
201 | * SOF, EOF, or CRC. | ||
202 | */ | ||
203 | struct fip_encaps { | ||
204 | struct fip_desc fd_desc; | ||
205 | __u8 fd_resvd[2]; | ||
206 | } __attribute__((packed)); | ||
207 | |||
208 | /* | ||
209 | * FIP_DT_VN_ID - VN_Node Identifier descriptor. | ||
210 | */ | ||
211 | struct fip_vn_desc { | ||
212 | struct fip_desc fd_desc; | ||
213 | __u8 fd_mac[ETH_ALEN]; | ||
214 | __u8 fd_resvd; | ||
215 | __u8 fd_fc_id[3]; | ||
216 | __be64 fd_wwpn; /* port name, unaligned */ | ||
217 | } __attribute__((packed)); | ||
218 | |||
219 | /* | ||
220 | * FIP_DT_FKA - Advertisement keep-alive period. | ||
221 | */ | ||
222 | struct fip_fka_desc { | ||
223 | struct fip_desc fd_desc; | ||
224 | __u8 fd_resvd[2]; | ||
225 | __be32 fd_fka_period; /* adv./keep-alive period in mS */ | ||
226 | } __attribute__((packed)); | ||
227 | |||
228 | /* | ||
229 | * FIP_DT_VENDOR descriptor. | ||
230 | */ | ||
231 | struct fip_vendor_desc { | ||
232 | struct fip_desc fd_desc; | ||
233 | __u8 fd_resvd[2]; | ||
234 | __u8 fd_vendor_id[8]; | ||
235 | } __attribute__((packed)); | ||
236 | |||
237 | #endif /* _FC_FIP_H_ */ | ||
diff --git a/include/scsi/fc/fc_fs.h b/include/scsi/fc/fc_fs.h index 3e4801d2bdbb..ac4cd38c860e 100644 --- a/include/scsi/fc/fc_fs.h +++ b/include/scsi/fc/fc_fs.h | |||
@@ -149,6 +149,7 @@ enum fc_rctl { | |||
149 | * Well-known fabric addresses. | 149 | * Well-known fabric addresses. |
150 | */ | 150 | */ |
151 | enum fc_well_known_fid { | 151 | enum fc_well_known_fid { |
152 | FC_FID_NONE = 0x000000, /* No destination */ | ||
152 | FC_FID_BCAST = 0xffffff, /* broadcast */ | 153 | FC_FID_BCAST = 0xffffff, /* broadcast */ |
153 | FC_FID_FLOGI = 0xfffffe, /* fabric login */ | 154 | FC_FID_FLOGI = 0xfffffe, /* fabric login */ |
154 | FC_FID_FCTRL = 0xfffffd, /* fabric controller */ | 155 | FC_FID_FCTRL = 0xfffffd, /* fabric controller */ |
@@ -337,4 +338,9 @@ enum fc_pf_rjt_reason { | |||
337 | FC_RJT_VENDOR = 0xff, /* vendor specific reject */ | 338 | FC_RJT_VENDOR = 0xff, /* vendor specific reject */ |
338 | }; | 339 | }; |
339 | 340 | ||
341 | /* default timeout values */ | ||
342 | |||
343 | #define FC_DEF_E_D_TOV 2000UL | ||
344 | #define FC_DEF_R_A_TOV 10000UL | ||
345 | |||
340 | #endif /* _FC_FS_H_ */ | 346 | #endif /* _FC_FS_H_ */ |