1 /***********************license start***************
2 * Author: Cavium Networks
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
7 * Copyright (c) 2003-2008 Cavium Networks
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
30 * This header file defines the work queue entry (wqe) data structure.
31 * Since this is a commonly used structure that depends on structures
32 * from several hardware blocks, those definitions have been placed
33 * in this file to create a single point of definition of the wqe
35 * Data structures are still named according to the block that they
40 #ifndef __CVMX_WQE_H__
41 #define __CVMX_WQE_H__
43 #include "cvmx-packet.h"
46 #define OCT_TAG_TYPE_STRING(x) \
47 (((x) == CVMX_POW_TAG_TYPE_ORDERED) ? "ORDERED" : \
48 (((x) == CVMX_POW_TAG_TYPE_ATOMIC) ? "ATOMIC" : \
49 (((x) == CVMX_POW_TAG_TYPE_NULL) ? "NULL" : \
53 * HW decode / err_code in work queue entry
58 /* Use this struct if the hardware determines that the packet is IP */
60 /* HW sets this to the number of buffers used by this packet */
62 /* HW sets to the number of L2 bytes prior to the IP */
64 /* set to 1 if we found DSA/VLAN in the L2 */
65 uint64_t vlan_valid:1;
66 /* Set to 1 if the DSA/VLAN tag is stacked */
67 uint64_t vlan_stacked:1;
68 uint64_t unassigned:1;
69 /* HW sets to the DSA/VLAN CFI flag (valid when vlan_valid) */
71 /* HW sets to the DSA/VLAN_ID field (valid when vlan_valid) */
73 /* Ring Identifier (if PCIe). Requires PIP_GBL_CTL[RING_EN]=1 */
75 uint64_t unassigned2:8;
76 /* the packet needs to be decompressed */
77 uint64_t dec_ipcomp:1;
78 /* the packet is either TCP or UDP */
79 uint64_t tcp_or_udp:1;
80 /* the packet needs to be decrypted (ESP or AH) */
82 /* the packet is IPv6 */
86 * (rcv_error, not_IP, IP_exc, is_frag, L4_error,
91 * reserved for software use, hardware will clear on
95 /* exceptional conditions below */
96 /* the receive interface hardware detected an L4 error
97 * (only applies if !is_frag) (only applies if
98 * !rcv_error && !not_IP && !IP_exc && !is_frag)
99 * failure indicated in err_code below, decode:
102 * - 2 = L4 Checksum Error: the L4 checksum value is
103 * - 3 = UDP Length Error: The UDP length field would
104 * make the UDP data longer than what remains in
105 * the IP packet (as defined by the IP header
107 * - 4 = Bad L4 Port: either the source or destination
109 * - 8 = TCP FIN Only: the packet is TCP and only the
111 * - 9 = TCP No Flags: the packet is TCP and no flags
113 * - 10 = TCP FIN RST: the packet is TCP and both FIN
115 * - 11 = TCP SYN URG: the packet is TCP and both SYN
117 * - 12 = TCP SYN RST: the packet is TCP and both SYN
119 * - 13 = TCP SYN FIN: the packet is TCP and both SYN
123 /* set if the packet is a fragment */
125 /* the receive interface hardware detected an IP error
126 * / exception (only applies if !rcv_error && !not_IP)
127 * failure indicated in err_code below, decode:
129 * - 1 = Not IP: the IP version field is neither 4 nor
131 * - 2 = IPv4 Header Checksum Error: the IPv4 header
132 * has a checksum violation.
133 * - 3 = IP Malformed Header: the packet is not long
134 * enough to contain the IP header.
135 * - 4 = IP Malformed: the packet is not long enough
136 * to contain the bytes indicated by the IP
137 * header. Pad is allowed.
138 * - 5 = IP TTL Hop: the IPv4 TTL field or the IPv6
139 * Hop Count field are zero.
144 * Set if the hardware determined that the packet is a
149 * St if the hardware determined that the packet is a
154 * Set if the packet may not be IP (must be zero in
159 * The receive interface hardware detected a receive
160 * error (must be zero in this case).
162 uint64_t rcv_error:1;
163 /* lower err_code = first-level descriptor of the
165 /* zero for packet submitted by hardware that isn't on
167 /* type is cvmx_pip_err_t */
171 /* use this to get at the 16 vlan bits */
179 * use this struct if the hardware could not determine that
184 * HW sets this to the number of buffers used by this
189 /* set to 1 if we found DSA/VLAN in the L2 */
190 uint64_t vlan_valid:1;
191 /* Set to 1 if the DSA/VLAN tag is stacked */
192 uint64_t vlan_stacked:1;
193 uint64_t unassigned:1;
195 * HW sets to the DSA/VLAN CFI flag (valid when
200 * HW sets to the DSA/VLAN_ID field (valid when
205 * Ring Identifier (if PCIe). Requires
206 * PIP_GBL_CTL[RING_EN]=1
209 uint64_t unassigned2:12;
211 * reserved for software use, hardware will clear on
215 uint64_t unassigned3:1;
217 * set if the hardware determined that the packet is
222 * set if the hardware determined that the packet is
227 * set if the hardware determined that the packet is a
232 * set if the hardware determined that the packet is a
237 * set if the packet may not be IP (must be one in
241 /* The receive interface hardware detected a receive
242 * error. Failure indicated in err_code below,
245 * - 1 = partial error: a packet was partially
246 * received, but internal buffering / bandwidth
247 * was not adequate to receive the entire
249 * - 2 = jabber error: the RGMII packet was too large
251 * - 3 = overrun error: the RGMII packet is longer
252 * than allowed and had an FCS error.
253 * - 4 = oversize error: the RGMII packet is longer
255 * - 5 = alignment error: the RGMII packet is not an
256 * integer number of bytes
257 * and had an FCS error (100M and 10M only).
258 * - 6 = fragment error: the RGMII packet is shorter
259 * than allowed and had an FCS error.
260 * - 7 = GMX FCS error: the RGMII packet had an FCS
262 * - 8 = undersize error: the RGMII packet is shorter
264 * - 9 = extend error: the RGMII packet had an extend
266 * - 10 = length mismatch error: the RGMII packet had
267 * a length that did not match the length field
269 * - 11 = RGMII RX error/SPI4 DIP4 Error: the RGMII
270 * packet had one or more data reception errors
271 * (RXERR) or the SPI4 packet had one or more
273 * - 12 = RGMII skip error/SPI4 Abort Error: the RGMII
274 * packet was not large enough to cover the
275 * skipped bytes or the SPI4 packet was
276 * terminated with an About EOPS.
277 * - 13 = RGMII nibble error/SPI4 Port NXA Error: the
278 * RGMII packet had a studder error (data not
279 * repeated - 10/100M only) or the SPI4 packet
280 * was sent to an NXA.
281 * - 16 = FCS error: a SPI4.2 packet had an FCS error.
282 * - 17 = Skip error: a packet was not large enough to
283 * cover the skipped bytes.
284 * - 18 = L2 header malformed: the packet is not long
285 * enough to contain the L2.
288 uint64_t rcv_error:1;
290 * lower err_code = first-level descriptor of the
294 * zero for packet submitted by hardware that isn't on
297 /* type is cvmx_pip_err_t (union, so can't use directly */
301 } cvmx_pip_wqe_word2;
304 * Work queue entry format
306 * must be 8-byte aligned
310 /*****************************************************************
312 * HW WRITE: the following 64 bits are filled by HW when a packet arrives
316 * raw chksum result generated by the HW
320 * Field unused by hardware - available for software
324 * Next pointer used by hardware for list maintenance.
325 * May be written/read by HW before the work queue
326 * entry is scheduled to a PP
327 * (Only 36 bits used in Octeon 1)
329 uint64_t next_ptr:40;
331 /*****************************************************************
333 * HW WRITE: the following 64 bits are filled by HW when a packet arrives
337 * HW sets to the total number of bytes in the packet
341 * HW sets this to input physical port
346 * HW sets this to what it thought the priority of the input packet was
351 * the group that the work queue entry will be scheduled to
355 * the type of the tag (ORDERED, ATOMIC, NULL)
359 * the synchronization/ordering tag
364 * WORD 2 HW WRITE: the following 64-bits are filled in by
365 * hardware when a packet arrives This indicates a variety of
366 * status and error conditions.
368 cvmx_pip_wqe_word2 word2;
371 * Pointer to the first segment of the packet.
373 union cvmx_buf_ptr packet_ptr;
376 * HW WRITE: octeon will fill in a programmable amount from the
377 * packet, up to (at most, but perhaps less) the amount
378 * needed to fill the work queue entry to 128 bytes
380 * If the packet is recognized to be IP, the hardware starts
381 * (except that the IPv4 header is padded for appropriate
382 * alignment) writing here where the IP header starts. If the
383 * packet is not recognized to be IP, the hardware starts
384 * writing the beginning of the packet here.
386 uint8_t packet_data[96];
389 * If desired, SW can make the work Q entry any length. For the
390 * purposes of discussion here, Assume 128B always, as this is all that
391 * the hardware deals with.
395 } CVMX_CACHE_LINE_ALIGNED cvmx_wqe_t;
397 #endif /* __CVMX_WQE_H__ */