1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#ifndef _FC_FS_H_
21#define _FC_FS_H_
22
23#include <linux/types.h>
24
25
26
27
28
29
30
31
32
33struct fc_frame_header {
34 __u8 fh_r_ctl;
35 __u8 fh_d_id[3];
36
37 __u8 fh_cs_ctl;
38 __u8 fh_s_id[3];
39
40 __u8 fh_type;
41 __u8 fh_f_ctl[3];
42
43 __u8 fh_seq_id;
44 __u8 fh_df_ctl;
45 __be16 fh_seq_cnt;
46
47 __be16 fh_ox_id;
48 __be16 fh_rx_id;
49 __be32 fh_parm_offset;
50};
51
52#define FC_FRAME_HEADER_LEN 24
53
54#define FC_MAX_PAYLOAD 2112U
55#define FC_MIN_MAX_PAYLOAD 256U
56
57#define FC_MAX_FRAME (FC_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
58#define FC_MIN_MAX_FRAME (FC_MIN_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
59
60
61
62
63
64
65
66enum fc_rctl {
67 FC_RCTL_DD_UNCAT = 0x00,
68 FC_RCTL_DD_SOL_DATA = 0x01,
69 FC_RCTL_DD_UNSOL_CTL = 0x02,
70 FC_RCTL_DD_SOL_CTL = 0x03,
71 FC_RCTL_DD_UNSOL_DATA = 0x04,
72 FC_RCTL_DD_DATA_DESC = 0x05,
73 FC_RCTL_DD_UNSOL_CMD = 0x06,
74 FC_RCTL_DD_CMD_STATUS = 0x07,
75
76#define FC_RCTL_ILS_REQ FC_RCTL_DD_UNSOL_CTL
77#define FC_RCTL_ILS_REP FC_RCTL_DD_SOL_CTL
78
79
80
81
82 FC_RCTL_ELS_REQ = 0x22,
83 FC_RCTL_ELS_REP = 0x23,
84 FC_RCTL_ELS4_REQ = 0x32,
85 FC_RCTL_ELS4_REP = 0x33,
86
87
88
89 FC_RCTL_VFTH = 0x50,
90 FC_RCTL_IFRH = 0x51,
91 FC_RCTL_ENCH = 0x52,
92
93
94
95 FC_RCTL_BA_NOP = 0x80,
96 FC_RCTL_BA_ABTS = 0x81,
97 FC_RCTL_BA_RMC = 0x82,
98 FC_RCTL_BA_ACC = 0x84,
99 FC_RCTL_BA_RJT = 0x85,
100 FC_RCTL_BA_PRMT = 0x86,
101
102
103
104 FC_RCTL_ACK_1 = 0xc0,
105 FC_RCTL_ACK_0 = 0xc1,
106 FC_RCTL_P_RJT = 0xc2,
107 FC_RCTL_F_RJT = 0xc3,
108 FC_RCTL_P_BSY = 0xc4,
109 FC_RCTL_F_BSY = 0xc5,
110 FC_RCTL_F_BSYL = 0xc6,
111 FC_RCTL_LCR = 0xc7,
112 FC_RCTL_END = 0xc9,
113};
114
115
116
117
118
119
120#define FC_RCTL_NAMES_INIT { \
121 [FC_RCTL_DD_UNCAT] = "uncat", \
122 [FC_RCTL_DD_SOL_DATA] = "sol data", \
123 [FC_RCTL_DD_UNSOL_CTL] = "unsol ctl", \
124 [FC_RCTL_DD_SOL_CTL] = "sol ctl/reply", \
125 [FC_RCTL_DD_UNSOL_DATA] = "unsol data", \
126 [FC_RCTL_DD_DATA_DESC] = "data desc", \
127 [FC_RCTL_DD_UNSOL_CMD] = "unsol cmd", \
128 [FC_RCTL_DD_CMD_STATUS] = "cmd status", \
129 [FC_RCTL_ELS_REQ] = "ELS req", \
130 [FC_RCTL_ELS_REP] = "ELS rep", \
131 [FC_RCTL_ELS4_REQ] = "FC-4 ELS req", \
132 [FC_RCTL_ELS4_REP] = "FC-4 ELS rep", \
133 [FC_RCTL_BA_NOP] = "BLS NOP", \
134 [FC_RCTL_BA_ABTS] = "BLS abort", \
135 [FC_RCTL_BA_RMC] = "BLS remove connection", \
136 [FC_RCTL_BA_ACC] = "BLS accept", \
137 [FC_RCTL_BA_RJT] = "BLS reject", \
138 [FC_RCTL_BA_PRMT] = "BLS dedicated connection preempted", \
139 [FC_RCTL_ACK_1] = "LC ACK_1", \
140 [FC_RCTL_ACK_0] = "LC ACK_0", \
141 [FC_RCTL_P_RJT] = "LC port reject", \
142 [FC_RCTL_F_RJT] = "LC fabric reject", \
143 [FC_RCTL_P_BSY] = "LC port busy", \
144 [FC_RCTL_F_BSY] = "LC fabric busy to data frame", \
145 [FC_RCTL_F_BSYL] = "LC fabric busy to link control frame",\
146 [FC_RCTL_LCR] = "LC link credit reset", \
147 [FC_RCTL_END] = "LC end", \
148}
149
150
151
152
153enum fc_well_known_fid {
154 FC_FID_NONE = 0x000000,
155 FC_FID_BCAST = 0xffffff,
156 FC_FID_FLOGI = 0xfffffe,
157 FC_FID_FCTRL = 0xfffffd,
158 FC_FID_DIR_SERV = 0xfffffc,
159 FC_FID_TIME_SERV = 0xfffffb,
160 FC_FID_MGMT_SERV = 0xfffffa,
161 FC_FID_QOS = 0xfffff9,
162 FC_FID_ALIASES = 0xfffff8,
163 FC_FID_SEC_KEY = 0xfffff7,
164 FC_FID_CLOCK = 0xfffff6,
165 FC_FID_MCAST_SERV = 0xfffff5,
166};
167
168#define FC_FID_WELL_KNOWN_MAX 0xffffff
169#define FC_FID_WELL_KNOWN_BASE 0xfffff5
170
171
172
173
174#define FC_FID_DOM_MGR 0xfffc00
175
176
177
178
179#define FC_FID_DOMAIN 0
180#define FC_FID_PORT 1
181#define FC_FID_LINK 2
182
183
184
185
186enum fc_fh_type {
187 FC_TYPE_BLS = 0x00,
188 FC_TYPE_ELS = 0x01,
189 FC_TYPE_IP = 0x05,
190 FC_TYPE_FCP = 0x08,
191 FC_TYPE_CT = 0x20,
192 FC_TYPE_ILS = 0x22,
193};
194
195
196
197
198
199#define FC_TYPE_NAMES_INIT { \
200 [FC_TYPE_BLS] = "BLS", \
201 [FC_TYPE_ELS] = "ELS", \
202 [FC_TYPE_IP] = "IP", \
203 [FC_TYPE_FCP] = "FCP", \
204 [FC_TYPE_CT] = "CT", \
205 [FC_TYPE_ILS] = "ILS", \
206}
207
208
209
210
211#define FC_XID_UNKNOWN 0xffff
212#define FC_XID_MIN 0x0
213#define FC_XID_MAX 0xfffe
214
215
216
217
218#define FC_FC_EX_CTX (1 << 23)
219#define FC_FC_SEQ_CTX (1 << 22)
220#define FC_FC_FIRST_SEQ (1 << 21)
221#define FC_FC_LAST_SEQ (1 << 20)
222#define FC_FC_END_SEQ (1 << 19)
223#define FC_FC_END_CONN (1 << 18)
224#define FC_FC_RES_B17 (1 << 17)
225#define FC_FC_SEQ_INIT (1 << 16)
226#define FC_FC_X_ID_REASS (1 << 15)
227#define FC_FC_X_ID_INVAL (1 << 14)
228
229#define FC_FC_ACK_1 (1 << 12)
230#define FC_FC_ACK_N (2 << 12)
231#define FC_FC_ACK_0 (3 << 12)
232
233#define FC_FC_RES_B11 (1 << 11)
234#define FC_FC_RES_B10 (1 << 10)
235#define FC_FC_RETX_SEQ (1 << 9)
236#define FC_FC_UNI_TX (1 << 8)
237#define FC_FC_CONT_SEQ(i) ((i) << 6)
238#define FC_FC_ABT_SEQ(i) ((i) << 4)
239#define FC_FC_REL_OFF (1 << 3)
240#define FC_FC_RES2 (1 << 2)
241#define FC_FC_FILL(i) ((i) & 3)
242
243
244
245
246struct fc_ba_acc {
247 __u8 ba_seq_id_val;
248#define FC_BA_SEQ_ID_VAL 0x80
249 __u8 ba_seq_id;
250 __u8 ba_resvd[2];
251 __be16 ba_ox_id;
252 __be16 ba_rx_id;
253 __be16 ba_low_seq_cnt;
254 __be16 ba_high_seq_cnt;
255};
256
257
258
259
260struct fc_ba_rjt {
261 __u8 br_resvd;
262 __u8 br_reason;
263 __u8 br_explan;
264 __u8 br_vendor;
265};
266
267
268
269
270
271enum fc_ba_rjt_reason {
272 FC_BA_RJT_NONE = 0,
273 FC_BA_RJT_INVL_CMD = 0x01,
274 FC_BA_RJT_LOG_ERR = 0x03,
275 FC_BA_RJT_LOG_BUSY = 0x05,
276 FC_BA_RJT_PROTO_ERR = 0x07,
277 FC_BA_RJT_UNABLE = 0x09,
278 FC_BA_RJT_VENDOR = 0xff,
279};
280
281
282
283
284enum fc_ba_rjt_explan {
285 FC_BA_RJT_EXP_NONE = 0x00,
286 FC_BA_RJT_INV_XID = 0x03,
287 FC_BA_RJT_ABT = 0x05,
288};
289
290
291
292
293struct fc_pf_rjt {
294 __u8 rj_action;
295 __u8 rj_reason;
296 __u8 rj_resvd;
297 __u8 rj_vendor;
298};
299
300
301
302
303enum fc_pf_rjt_reason {
304 FC_RJT_NONE = 0,
305 FC_RJT_INVL_DID = 0x01,
306 FC_RJT_INVL_SID = 0x02,
307 FC_RJT_P_UNAV_T = 0x03,
308 FC_RJT_P_UNAV = 0x04,
309 FC_RJT_CLS_UNSUP = 0x05,
310 FC_RJT_DEL_USAGE = 0x06,
311 FC_RJT_TYPE_UNSUP = 0x07,
312 FC_RJT_LINK_CTL = 0x08,
313 FC_RJT_R_CTL = 0x09,
314 FC_RJT_F_CTL = 0x0a,
315 FC_RJT_OX_ID = 0x0b,
316 FC_RJT_RX_ID = 0x0c,
317 FC_RJT_SEQ_ID = 0x0d,
318 FC_RJT_DF_CTL = 0x0e,
319 FC_RJT_SEQ_CNT = 0x0f,
320 FC_RJT_PARAM = 0x10,
321 FC_RJT_EXCH_ERR = 0x11,
322 FC_RJT_PROTO = 0x12,
323 FC_RJT_LEN = 0x13,
324 FC_RJT_UNEXP_ACK = 0x14,
325 FC_RJT_FAB_CLASS = 0x15,
326 FC_RJT_LOGI_REQ = 0x16,
327 FC_RJT_SEQ_XS = 0x17,
328 FC_RJT_EXCH_EST = 0x18,
329 FC_RJT_FAB_UNAV = 0x1a,
330 FC_RJT_VC_ID = 0x1b,
331 FC_RJT_CS_CTL = 0x1c,
332 FC_RJT_INSUF_RES = 0x1d,
333 FC_RJT_INVL_CLS = 0x1f,
334 FC_RJT_PREEMT_RJT = 0x20,
335 FC_RJT_PREEMT_DIS = 0x21,
336 FC_RJT_MCAST_ERR = 0x22,
337 FC_RJT_MCAST_ET = 0x23,
338 FC_RJT_PRLI_REQ = 0x24,
339 FC_RJT_INVL_ATT = 0x25,
340 FC_RJT_VENDOR = 0xff,
341};
342
343
344
345#define FC_DEF_E_D_TOV 2000UL
346#define FC_DEF_R_A_TOV 10000UL
347
348#endif
349