This source file includes following definitions.
- cq_desc_dec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #ifndef _CQ_DESC_H_
21 #define _CQ_DESC_H_
22
23
24
25
26 enum cq_desc_types {
27 CQ_DESC_TYPE_WQ_ENET = 0,
28 CQ_DESC_TYPE_DESC_COPY = 1,
29 CQ_DESC_TYPE_WQ_EXCH = 2,
30 CQ_DESC_TYPE_RQ_ENET = 3,
31 CQ_DESC_TYPE_RQ_FCP = 4,
32 };
33
34
35
36
37
38
39
40 struct cq_desc {
41 __le16 completed_index;
42 __le16 q_number;
43 u8 type_specfic[11];
44 u8 type_color;
45 };
46
47 #define CQ_DESC_TYPE_BITS 4
48 #define CQ_DESC_TYPE_MASK ((1 << CQ_DESC_TYPE_BITS) - 1)
49 #define CQ_DESC_COLOR_MASK 1
50 #define CQ_DESC_COLOR_SHIFT 7
51 #define CQ_DESC_Q_NUM_BITS 10
52 #define CQ_DESC_Q_NUM_MASK ((1 << CQ_DESC_Q_NUM_BITS) - 1)
53 #define CQ_DESC_COMP_NDX_BITS 12
54 #define CQ_DESC_COMP_NDX_MASK ((1 << CQ_DESC_COMP_NDX_BITS) - 1)
55
56 static inline void cq_desc_dec(const struct cq_desc *desc_arg,
57 u8 *type, u8 *color, u16 *q_number, u16 *completed_index)
58 {
59 const struct cq_desc *desc = desc_arg;
60 const u8 type_color = desc->type_color;
61
62 *color = (type_color >> CQ_DESC_COLOR_SHIFT) & CQ_DESC_COLOR_MASK;
63
64
65
66
67
68
69
70
71
72 rmb();
73
74 *type = type_color & CQ_DESC_TYPE_MASK;
75 *q_number = le16_to_cpu(desc->q_number) & CQ_DESC_Q_NUM_MASK;
76 *completed_index = le16_to_cpu(desc->completed_index) &
77 CQ_DESC_COMP_NDX_MASK;
78 }
79
80 #endif