diff options
author | Paul Martin <paul.martin@codethink.co.uk> | 2015-03-30 12:00:56 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-04-01 11:22:14 -0400 |
commit | 11db04c8f3f2353b45848ceda2e6e3440520f7cb (patch) | |
tree | 1c2acd6c46f0444f0e3cb19e7051c3baf3a78ebf /arch/mips/include/asm/octeon/cvmx-wqe.h | |
parent | 0a1cd2c5887cc87178adf9f58191a18cca8c55c0 (diff) |
MIPS: Octeon: Turn hardware bitfields and structures inside out.
Although the proper way to do this for bitfields would be to use
the macro that Ralf has provided, this is a little easier to
understand as a diff.
Signed-off-by: Paul Martin <paul.martin@codethink.co.uk>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9628/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include/asm/octeon/cvmx-wqe.h')
-rw-r--r-- | arch/mips/include/asm/octeon/cvmx-wqe.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/arch/mips/include/asm/octeon/cvmx-wqe.h b/arch/mips/include/asm/octeon/cvmx-wqe.h index aa0d3d0de75c..2d6d0c7127a7 100644 --- a/arch/mips/include/asm/octeon/cvmx-wqe.h +++ b/arch/mips/include/asm/octeon/cvmx-wqe.h | |||
@@ -57,6 +57,7 @@ typedef union { | |||
57 | 57 | ||
58 | /* Use this struct if the hardware determines that the packet is IP */ | 58 | /* Use this struct if the hardware determines that the packet is IP */ |
59 | struct { | 59 | struct { |
60 | #ifdef __BIG_ENDIAN_BITFIELD | ||
60 | /* HW sets this to the number of buffers used by this packet */ | 61 | /* HW sets this to the number of buffers used by this packet */ |
61 | uint64_t bufs:8; | 62 | uint64_t bufs:8; |
62 | /* HW sets to the number of L2 bytes prior to the IP */ | 63 | /* HW sets to the number of L2 bytes prior to the IP */ |
@@ -166,13 +167,45 @@ typedef union { | |||
166 | * the slow path */ | 167 | * the slow path */ |
167 | /* type is cvmx_pip_err_t */ | 168 | /* type is cvmx_pip_err_t */ |
168 | uint64_t err_code:8; | 169 | uint64_t err_code:8; |
170 | #else | ||
171 | uint64_t err_code:8; | ||
172 | uint64_t rcv_error:1; | ||
173 | uint64_t not_IP:1; | ||
174 | uint64_t is_mcast:1; | ||
175 | uint64_t is_bcast:1; | ||
176 | uint64_t IP_exc:1; | ||
177 | uint64_t is_frag:1; | ||
178 | uint64_t L4_error:1; | ||
179 | uint64_t software:1; | ||
180 | uint64_t is_v6:1; | ||
181 | uint64_t dec_ipsec:1; | ||
182 | uint64_t tcp_or_udp:1; | ||
183 | uint64_t dec_ipcomp:1; | ||
184 | uint64_t unassigned2:4; | ||
185 | uint64_t unassigned2a:4; | ||
186 | uint64_t pr:4; | ||
187 | uint64_t vlan_id:12; | ||
188 | uint64_t vlan_cfi:1; | ||
189 | uint64_t unassigned:1; | ||
190 | uint64_t vlan_stacked:1; | ||
191 | uint64_t vlan_valid:1; | ||
192 | uint64_t ip_offset:8; | ||
193 | uint64_t bufs:8; | ||
194 | #endif | ||
169 | } s; | 195 | } s; |
170 | 196 | ||
171 | /* use this to get at the 16 vlan bits */ | 197 | /* use this to get at the 16 vlan bits */ |
172 | struct { | 198 | struct { |
199 | #ifdef __BIG_ENDIAN_BITFIELD | ||
173 | uint64_t unused1:16; | 200 | uint64_t unused1:16; |
174 | uint64_t vlan:16; | 201 | uint64_t vlan:16; |
175 | uint64_t unused2:32; | 202 | uint64_t unused2:32; |
203 | #else | ||
204 | uint64_t unused2:32; | ||
205 | uint64_t vlan:16; | ||
206 | uint64_t unused1:16; | ||
207 | |||
208 | #endif | ||
176 | } svlan; | 209 | } svlan; |
177 | 210 | ||
178 | /* | 211 | /* |
@@ -180,6 +213,7 @@ typedef union { | |||
180 | * the packet is ip. | 213 | * the packet is ip. |
181 | */ | 214 | */ |
182 | struct { | 215 | struct { |
216 | #ifdef __BIG_ENDIAN_BITFIELD | ||
183 | /* | 217 | /* |
184 | * HW sets this to the number of buffers used by this | 218 | * HW sets this to the number of buffers used by this |
185 | * packet. | 219 | * packet. |
@@ -296,6 +330,27 @@ typedef union { | |||
296 | */ | 330 | */ |
297 | /* type is cvmx_pip_err_t (union, so can't use directly */ | 331 | /* type is cvmx_pip_err_t (union, so can't use directly */ |
298 | uint64_t err_code:8; | 332 | uint64_t err_code:8; |
333 | #else | ||
334 | uint64_t err_code:8; | ||
335 | uint64_t rcv_error:1; | ||
336 | uint64_t not_IP:1; | ||
337 | uint64_t is_mcast:1; | ||
338 | uint64_t is_bcast:1; | ||
339 | uint64_t is_arp:1; | ||
340 | uint64_t is_rarp:1; | ||
341 | uint64_t unassigned3:1; | ||
342 | uint64_t software:1; | ||
343 | uint64_t unassigned2:4; | ||
344 | uint64_t unassigned2a:8; | ||
345 | uint64_t pr:4; | ||
346 | uint64_t vlan_id:12; | ||
347 | uint64_t vlan_cfi:1; | ||
348 | uint64_t unassigned:1; | ||
349 | uint64_t vlan_stacked:1; | ||
350 | uint64_t vlan_valid:1; | ||
351 | uint64_t unused:8; | ||
352 | uint64_t bufs:8; | ||
353 | #endif | ||
299 | } snoip; | 354 | } snoip; |
300 | 355 | ||
301 | } cvmx_pip_wqe_word2; | 356 | } cvmx_pip_wqe_word2; |
@@ -312,6 +367,7 @@ typedef struct { | |||
312 | * HW WRITE: the following 64 bits are filled by HW when a packet arrives | 367 | * HW WRITE: the following 64 bits are filled by HW when a packet arrives |
313 | */ | 368 | */ |
314 | 369 | ||
370 | #ifdef __BIG_ENDIAN_BITFIELD | ||
315 | /** | 371 | /** |
316 | * raw chksum result generated by the HW | 372 | * raw chksum result generated by the HW |
317 | */ | 373 | */ |
@@ -327,12 +383,18 @@ typedef struct { | |||
327 | * (Only 36 bits used in Octeon 1) | 383 | * (Only 36 bits used in Octeon 1) |
328 | */ | 384 | */ |
329 | uint64_t next_ptr:40; | 385 | uint64_t next_ptr:40; |
386 | #else | ||
387 | uint64_t next_ptr:40; | ||
388 | uint8_t unused; | ||
389 | uint16_t hw_chksum; | ||
390 | #endif | ||
330 | 391 | ||
331 | /***************************************************************** | 392 | /***************************************************************** |
332 | * WORD 1 | 393 | * WORD 1 |
333 | * HW WRITE: the following 64 bits are filled by HW when a packet arrives | 394 | * HW WRITE: the following 64 bits are filled by HW when a packet arrives |
334 | */ | 395 | */ |
335 | 396 | ||
397 | #ifdef __BIG_ENDIAN_BITFIELD | ||
336 | /** | 398 | /** |
337 | * HW sets to the total number of bytes in the packet | 399 | * HW sets to the total number of bytes in the packet |
338 | */ | 400 | */ |
@@ -359,6 +421,15 @@ typedef struct { | |||
359 | * the synchronization/ordering tag | 421 | * the synchronization/ordering tag |
360 | */ | 422 | */ |
361 | uint64_t tag:32; | 423 | uint64_t tag:32; |
424 | #else | ||
425 | uint64_t tag:32; | ||
426 | uint64_t tag_type:2; | ||
427 | uint64_t zero_2:1; | ||
428 | uint64_t grp:4; | ||
429 | uint64_t qos:3; | ||
430 | uint64_t ipprt:6; | ||
431 | uint64_t len:16; | ||
432 | #endif | ||
362 | 433 | ||
363 | /** | 434 | /** |
364 | * WORD 2 HW WRITE: the following 64-bits are filled in by | 435 | * WORD 2 HW WRITE: the following 64-bits are filled in by |