This source file includes following definitions.
- dpaa2_dq_flags
- dpaa2_dq_is_pull
- dpaa2_dq_is_pull_complete
- dpaa2_dq_seqnum
- dpaa2_dq_odpid
- dpaa2_dq_fqid
- dpaa2_dq_byte_count
- dpaa2_dq_frame_count
- dpaa2_dq_fqd_ctx
- dpaa2_dq_fd
- dpaa2_cscn_state_congested
1
2
3
4
5
6
7 #ifndef __FSL_DPAA2_GLOBAL_H
8 #define __FSL_DPAA2_GLOBAL_H
9
10 #include <linux/types.h>
11 #include <linux/cpumask.h>
12 #include "dpaa2-fd.h"
13
14 struct dpaa2_dq {
15 union {
16 struct common {
17 u8 verb;
18 u8 reserved[63];
19 } common;
20 struct dq {
21 u8 verb;
22 u8 stat;
23 __le16 seqnum;
24 __le16 oprid;
25 u8 reserved;
26 u8 tok;
27 __le32 fqid;
28 u32 reserved2;
29 __le32 fq_byte_cnt;
30 __le32 fq_frm_cnt;
31 __le64 fqd_ctx;
32 u8 fd[32];
33 } dq;
34 struct scn {
35 u8 verb;
36 u8 stat;
37 u8 state;
38 u8 reserved;
39 __le32 rid_tok;
40 __le64 ctx;
41 } scn;
42 };
43 };
44
45
46
47 #define DPAA2_DQ_STAT_FQEMPTY 0x80
48
49 #define DPAA2_DQ_STAT_HELDACTIVE 0x40
50
51 #define DPAA2_DQ_STAT_FORCEELIGIBLE 0x20
52
53 #define DPAA2_DQ_STAT_VALIDFRAME 0x10
54
55 #define DPAA2_DQ_STAT_ODPVALID 0x04
56
57 #define DPAA2_DQ_STAT_VOLATILE 0x02
58
59 #define DPAA2_DQ_STAT_EXPIRED 0x01
60
61 #define DQ_FQID_MASK 0x00FFFFFF
62 #define DQ_FRAME_COUNT_MASK 0x00FFFFFF
63
64
65
66
67
68 static inline u32 dpaa2_dq_flags(const struct dpaa2_dq *dq)
69 {
70 return dq->dq.stat;
71 }
72
73
74
75
76
77
78
79
80 static inline int dpaa2_dq_is_pull(const struct dpaa2_dq *dq)
81 {
82 return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_VOLATILE);
83 }
84
85
86
87
88
89
90
91 static inline bool dpaa2_dq_is_pull_complete(const struct dpaa2_dq *dq)
92 {
93 return !!(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_EXPIRED);
94 }
95
96
97
98
99
100
101
102
103
104 static inline u16 dpaa2_dq_seqnum(const struct dpaa2_dq *dq)
105 {
106 return le16_to_cpu(dq->dq.seqnum);
107 }
108
109
110
111
112
113
114
115
116
117 static inline u16 dpaa2_dq_odpid(const struct dpaa2_dq *dq)
118 {
119 return le16_to_cpu(dq->dq.oprid);
120 }
121
122
123
124
125
126
127
128 static inline u32 dpaa2_dq_fqid(const struct dpaa2_dq *dq)
129 {
130 return le32_to_cpu(dq->dq.fqid) & DQ_FQID_MASK;
131 }
132
133
134
135
136
137
138
139 static inline u32 dpaa2_dq_byte_count(const struct dpaa2_dq *dq)
140 {
141 return le32_to_cpu(dq->dq.fq_byte_cnt);
142 }
143
144
145
146
147
148
149
150 static inline u32 dpaa2_dq_frame_count(const struct dpaa2_dq *dq)
151 {
152 return le32_to_cpu(dq->dq.fq_frm_cnt) & DQ_FRAME_COUNT_MASK;
153 }
154
155
156
157
158
159
160
161 static inline u64 dpaa2_dq_fqd_ctx(const struct dpaa2_dq *dq)
162 {
163 return le64_to_cpu(dq->dq.fqd_ctx);
164 }
165
166
167
168
169
170
171
172 static inline const struct dpaa2_fd *dpaa2_dq_fd(const struct dpaa2_dq *dq)
173 {
174 return (const struct dpaa2_fd *)&dq->dq.fd[0];
175 }
176
177 #define DPAA2_CSCN_SIZE sizeof(struct dpaa2_dq)
178 #define DPAA2_CSCN_ALIGN 16
179 #define DPAA2_CSCN_STATE_CG BIT(0)
180
181
182
183
184
185
186
187 static inline bool dpaa2_cscn_state_congested(struct dpaa2_dq *cscn)
188 {
189 return !!(cscn->scn.state & DPAA2_CSCN_STATE_CG);
190 }
191
192 #endif