This source file includes following definitions.
- rhf_to_cpu
- rhf_err_flags
- rhf_rcv_type
- rhf_rcv_type_err
- rhf_pkt_len
- rhf_egr_index
- rhf_rcv_seq
- rhf_hdrq_offset
- rhf_use_egr_bfr
- rhf_dc_info
- rhf_egr_buf_offset
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 #ifndef _COMMON_H
49 #define _COMMON_H
50
51 #include <rdma/hfi/hfi1_user.h>
52
53
54
55
56
57
58
59
60
61
62 #define IPS_PROTO_VERSION 2
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80 #define DEFAULT_KDETH_QP 0x80
81
82
83 #define HFI1_CAP_USER_SHIFT 24
84 #define HFI1_CAP_MASK ((1UL << HFI1_CAP_USER_SHIFT) - 1)
85
86 #define HFI1_CAP_LOCKED_SHIFT 63
87 #define HFI1_CAP_LOCKED_MASK 0x1ULL
88 #define HFI1_CAP_LOCKED_SMASK (HFI1_CAP_LOCKED_MASK << HFI1_CAP_LOCKED_SHIFT)
89
90 #define HFI1_CAP_MISC_SHIFT (HFI1_CAP_USER_SHIFT * 2)
91 #define HFI1_CAP_MISC_MASK ((1ULL << (HFI1_CAP_LOCKED_SHIFT - \
92 HFI1_CAP_MISC_SHIFT)) - 1)
93
94 #define HFI1_CAP_KSET(cap) ({ hfi1_cap_mask |= HFI1_CAP_##cap; hfi1_cap_mask; })
95 #define HFI1_CAP_KCLEAR(cap) \
96 ({ \
97 hfi1_cap_mask &= ~HFI1_CAP_##cap; \
98 hfi1_cap_mask; \
99 })
100 #define HFI1_CAP_USET(cap) \
101 ({ \
102 hfi1_cap_mask |= (HFI1_CAP_##cap << HFI1_CAP_USER_SHIFT); \
103 hfi1_cap_mask; \
104 })
105 #define HFI1_CAP_UCLEAR(cap) \
106 ({ \
107 hfi1_cap_mask &= ~(HFI1_CAP_##cap << HFI1_CAP_USER_SHIFT); \
108 hfi1_cap_mask; \
109 })
110 #define HFI1_CAP_SET(cap) \
111 ({ \
112 hfi1_cap_mask |= (HFI1_CAP_##cap | (HFI1_CAP_##cap << \
113 HFI1_CAP_USER_SHIFT)); \
114 hfi1_cap_mask; \
115 })
116 #define HFI1_CAP_CLEAR(cap) \
117 ({ \
118 hfi1_cap_mask &= ~(HFI1_CAP_##cap | \
119 (HFI1_CAP_##cap << HFI1_CAP_USER_SHIFT)); \
120 hfi1_cap_mask; \
121 })
122 #define HFI1_CAP_LOCK() \
123 ({ hfi1_cap_mask |= HFI1_CAP_LOCKED_SMASK; hfi1_cap_mask; })
124 #define HFI1_CAP_LOCKED() (!!(hfi1_cap_mask & HFI1_CAP_LOCKED_SMASK))
125
126
127
128
129
130
131 #define HFI1_CAP_WRITABLE_MASK (HFI1_CAP_SDMA_AHG | \
132 HFI1_CAP_HDRSUPP | \
133 HFI1_CAP_MULTI_PKT_EGR | \
134 HFI1_CAP_NODROP_RHQ_FULL | \
135 HFI1_CAP_NODROP_EGR_FULL | \
136 HFI1_CAP_ALLOW_PERM_JKEY | \
137 HFI1_CAP_STATIC_RATE_CTRL | \
138 HFI1_CAP_PRINT_UNIMPL | \
139 HFI1_CAP_TID_UNMAP | \
140 HFI1_CAP_OPFN)
141
142
143
144
145 #define HFI1_CAP_RESERVED_MASK ((HFI1_CAP_SDMA | \
146 HFI1_CAP_USE_SDMA_HEAD | \
147 HFI1_CAP_EXTENDED_PSN | \
148 HFI1_CAP_PRINT_UNIMPL | \
149 HFI1_CAP_NO_INTEGRITY | \
150 HFI1_CAP_PKEY_CHECK | \
151 HFI1_CAP_TID_RDMA | \
152 HFI1_CAP_OPFN) << \
153 HFI1_CAP_USER_SHIFT)
154
155
156
157
158 #define HFI1_CAP_MUST_HAVE_KERN (HFI1_CAP_STATIC_RATE_CTRL)
159
160 #define HFI1_CAP_MASK_DEFAULT (HFI1_CAP_HDRSUPP | \
161 HFI1_CAP_NODROP_RHQ_FULL | \
162 HFI1_CAP_NODROP_EGR_FULL | \
163 HFI1_CAP_SDMA | \
164 HFI1_CAP_PRINT_UNIMPL | \
165 HFI1_CAP_STATIC_RATE_CTRL | \
166 HFI1_CAP_PKEY_CHECK | \
167 HFI1_CAP_MULTI_PKT_EGR | \
168 HFI1_CAP_EXTENDED_PSN | \
169 ((HFI1_CAP_HDRSUPP | \
170 HFI1_CAP_MULTI_PKT_EGR | \
171 HFI1_CAP_STATIC_RATE_CTRL | \
172 HFI1_CAP_PKEY_CHECK | \
173 HFI1_CAP_EARLY_CREDIT_RETURN) << \
174 HFI1_CAP_USER_SHIFT))
175
176
177
178
179 #define HFI1_CAP_K2U (HFI1_CAP_SDMA | \
180 HFI1_CAP_EXTENDED_PSN | \
181 HFI1_CAP_PKEY_CHECK | \
182 HFI1_CAP_NO_INTEGRITY)
183
184 #define HFI1_USER_SWVERSION ((HFI1_USER_SWMAJOR << HFI1_SWMAJOR_SHIFT) | \
185 HFI1_USER_SWMINOR)
186
187 #ifndef HFI1_KERN_TYPE
188 #define HFI1_KERN_TYPE 0
189 #endif
190
191
192
193
194
195
196
197
198
199
200
201
202 #define HFI1_KERN_SWVERSION ((HFI1_KERN_TYPE << 31) | HFI1_USER_SWVERSION)
203
204
205
206
207
208 #ifndef HFI1_DRIVER_VERSION_BASE
209 #define HFI1_DRIVER_VERSION_BASE "0.9-294"
210 #endif
211
212
213 #ifdef HFI1_IDSTR
214 #define HFI1_DRIVER_VERSION HFI1_DRIVER_VERSION_BASE " " HFI1_IDSTR
215 #else
216 #define HFI1_DRIVER_VERSION HFI1_DRIVER_VERSION_BASE
217 #endif
218
219
220
221
222
223
224
225
226 #define _DIAG_PKT_VERS 1
227 struct diag_pkt {
228 __u16 version;
229 __u16 unit;
230 __u16 sw_index;
231 __u16 len;
232 __u16 port;
233 __u16 unused;
234 __u32 flags;
235 __u64 data;
236 __u64 pbc;
237 };
238
239
240 #define F_DIAGPKT_WAIT 0x1
241
242
243
244
245
246
247
248
249
250 #define RHF_PKT_LEN_SHIFT 0
251 #define RHF_PKT_LEN_MASK 0xfffull
252 #define RHF_PKT_LEN_SMASK (RHF_PKT_LEN_MASK << RHF_PKT_LEN_SHIFT)
253
254 #define RHF_RCV_TYPE_SHIFT 12
255 #define RHF_RCV_TYPE_MASK 0x7ull
256 #define RHF_RCV_TYPE_SMASK (RHF_RCV_TYPE_MASK << RHF_RCV_TYPE_SHIFT)
257
258 #define RHF_USE_EGR_BFR_SHIFT 15
259 #define RHF_USE_EGR_BFR_MASK 0x1ull
260 #define RHF_USE_EGR_BFR_SMASK (RHF_USE_EGR_BFR_MASK << RHF_USE_EGR_BFR_SHIFT)
261
262 #define RHF_EGR_INDEX_SHIFT 16
263 #define RHF_EGR_INDEX_MASK 0x7ffull
264 #define RHF_EGR_INDEX_SMASK (RHF_EGR_INDEX_MASK << RHF_EGR_INDEX_SHIFT)
265
266 #define RHF_DC_INFO_SHIFT 27
267 #define RHF_DC_INFO_MASK 0x1ull
268 #define RHF_DC_INFO_SMASK (RHF_DC_INFO_MASK << RHF_DC_INFO_SHIFT)
269
270 #define RHF_RCV_SEQ_SHIFT 28
271 #define RHF_RCV_SEQ_MASK 0xfull
272 #define RHF_RCV_SEQ_SMASK (RHF_RCV_SEQ_MASK << RHF_RCV_SEQ_SHIFT)
273
274 #define RHF_EGR_OFFSET_SHIFT 32
275 #define RHF_EGR_OFFSET_MASK 0xfffull
276 #define RHF_EGR_OFFSET_SMASK (RHF_EGR_OFFSET_MASK << RHF_EGR_OFFSET_SHIFT)
277 #define RHF_HDRQ_OFFSET_SHIFT 44
278 #define RHF_HDRQ_OFFSET_MASK 0x1ffull
279 #define RHF_HDRQ_OFFSET_SMASK (RHF_HDRQ_OFFSET_MASK << RHF_HDRQ_OFFSET_SHIFT)
280 #define RHF_K_HDR_LEN_ERR (0x1ull << 53)
281 #define RHF_DC_UNC_ERR (0x1ull << 54)
282 #define RHF_DC_ERR (0x1ull << 55)
283 #define RHF_RCV_TYPE_ERR_SHIFT 56
284 #define RHF_RCV_TYPE_ERR_MASK 0x7ul
285 #define RHF_RCV_TYPE_ERR_SMASK (RHF_RCV_TYPE_ERR_MASK << RHF_RCV_TYPE_ERR_SHIFT)
286 #define RHF_TID_ERR (0x1ull << 59)
287 #define RHF_LEN_ERR (0x1ull << 60)
288 #define RHF_ECC_ERR (0x1ull << 61)
289 #define RHF_RESERVED (0x1ull << 62)
290 #define RHF_ICRC_ERR (0x1ull << 63)
291
292 #define RHF_ERROR_SMASK 0xffe0000000000000ull
293
294
295 #define RHF_RCV_TYPE_EXPECTED 0
296 #define RHF_RCV_TYPE_EAGER 1
297 #define RHF_RCV_TYPE_IB 2
298 #define RHF_RCV_TYPE_ERROR 3
299 #define RHF_RCV_TYPE_BYPASS 4
300 #define RHF_RCV_TYPE_INVALID5 5
301 #define RHF_RCV_TYPE_INVALID6 6
302 #define RHF_RCV_TYPE_INVALID7 7
303
304
305 #define RHF_RTE_EXPECTED_FLOW_SEQ_ERR 0x2
306 #define RHF_RTE_EXPECTED_FLOW_GEN_ERR 0x4
307
308
309 #define RHF_RTE_EAGER_NO_ERR 0x0
310
311
312 #define RHF_RTE_IB_NO_ERR 0x0
313
314
315 #define RHF_RTE_ERROR_NO_ERR 0x0
316 #define RHF_RTE_ERROR_OP_CODE_ERR 0x1
317 #define RHF_RTE_ERROR_KHDR_MIN_LEN_ERR 0x2
318 #define RHF_RTE_ERROR_KHDR_HCRC_ERR 0x3
319 #define RHF_RTE_ERROR_KHDR_KVER_ERR 0x4
320 #define RHF_RTE_ERROR_CONTEXT_ERR 0x5
321 #define RHF_RTE_ERROR_KHDR_TID_ERR 0x6
322
323
324 #define RHF_RTE_BYPASS_NO_ERR 0x0
325
326
327 #define HFI1_LRH_GRH 0x0003
328 #define HFI1_LRH_BTH 0x0002
329
330
331 #define SC15_PACKET 0xF
332 #define SIZE_OF_CRC 1
333 #define SIZE_OF_LT 1
334 #define MAX_16B_PADDING 12
335
336 #define LIM_MGMT_P_KEY 0x7FFF
337 #define FULL_MGMT_P_KEY 0xFFFF
338
339 #define DEFAULT_P_KEY LIM_MGMT_P_KEY
340
341 #define HFI1_PSM_IOC_BASE_SEQ 0x0
342
343
344 #define HFI1_KDETH_BTH_SEQ_SHIFT 11
345 #define HFI1_KDETH_BTH_SEQ_MASK (BIT(HFI1_KDETH_BTH_SEQ_SHIFT) - 1)
346
347 static inline __u64 rhf_to_cpu(const __le32 *rbuf)
348 {
349 return __le64_to_cpu(*((__le64 *)rbuf));
350 }
351
352 static inline u64 rhf_err_flags(u64 rhf)
353 {
354 return rhf & RHF_ERROR_SMASK;
355 }
356
357 static inline u32 rhf_rcv_type(u64 rhf)
358 {
359 return (rhf >> RHF_RCV_TYPE_SHIFT) & RHF_RCV_TYPE_MASK;
360 }
361
362 static inline u32 rhf_rcv_type_err(u64 rhf)
363 {
364 return (rhf >> RHF_RCV_TYPE_ERR_SHIFT) & RHF_RCV_TYPE_ERR_MASK;
365 }
366
367
368 static inline u32 rhf_pkt_len(u64 rhf)
369 {
370 return ((rhf & RHF_PKT_LEN_SMASK) >> RHF_PKT_LEN_SHIFT) << 2;
371 }
372
373 static inline u32 rhf_egr_index(u64 rhf)
374 {
375 return (rhf >> RHF_EGR_INDEX_SHIFT) & RHF_EGR_INDEX_MASK;
376 }
377
378 static inline u32 rhf_rcv_seq(u64 rhf)
379 {
380 return (rhf >> RHF_RCV_SEQ_SHIFT) & RHF_RCV_SEQ_MASK;
381 }
382
383
384 static inline u32 rhf_hdrq_offset(u64 rhf)
385 {
386 return (rhf >> RHF_HDRQ_OFFSET_SHIFT) & RHF_HDRQ_OFFSET_MASK;
387 }
388
389 static inline u64 rhf_use_egr_bfr(u64 rhf)
390 {
391 return rhf & RHF_USE_EGR_BFR_SMASK;
392 }
393
394 static inline u64 rhf_dc_info(u64 rhf)
395 {
396 return rhf & RHF_DC_INFO_SMASK;
397 }
398
399 static inline u32 rhf_egr_buf_offset(u64 rhf)
400 {
401 return (rhf >> RHF_EGR_OFFSET_SHIFT) & RHF_EGR_OFFSET_MASK;
402 }
403 #endif