162306a36Sopenharmony_ci/***********************license start*************** 262306a36Sopenharmony_ci * Author: Cavium Networks 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Contact: support@caviumnetworks.com 562306a36Sopenharmony_ci * This file is part of the OCTEON SDK 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Copyright (c) 2003-2008 Cavium Networks 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * This file is free software; you can redistribute it and/or modify 1062306a36Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as 1162306a36Sopenharmony_ci * published by the Free Software Foundation. 1262306a36Sopenharmony_ci * 1362306a36Sopenharmony_ci * This file is distributed in the hope that it will be useful, but 1462306a36Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 1562306a36Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 1662306a36Sopenharmony_ci * NONINFRINGEMENT. See the GNU General Public License for more 1762306a36Sopenharmony_ci * details. 1862306a36Sopenharmony_ci * 1962306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License 2062306a36Sopenharmony_ci * along with this file; if not, write to the Free Software 2162306a36Sopenharmony_ci * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 2262306a36Sopenharmony_ci * or visit http://www.gnu.org/licenses/. 2362306a36Sopenharmony_ci * 2462306a36Sopenharmony_ci * This file may also be available under a different license from Cavium. 2562306a36Sopenharmony_ci * Contact Cavium Networks for more information 2662306a36Sopenharmony_ci ***********************license end**************************************/ 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci/** 2962306a36Sopenharmony_ci * 3062306a36Sopenharmony_ci * This header file defines the work queue entry (wqe) data structure. 3162306a36Sopenharmony_ci * Since this is a commonly used structure that depends on structures 3262306a36Sopenharmony_ci * from several hardware blocks, those definitions have been placed 3362306a36Sopenharmony_ci * in this file to create a single point of definition of the wqe 3462306a36Sopenharmony_ci * format. 3562306a36Sopenharmony_ci * Data structures are still named according to the block that they 3662306a36Sopenharmony_ci * relate to. 3762306a36Sopenharmony_ci * 3862306a36Sopenharmony_ci */ 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci#ifndef __CVMX_WQE_H__ 4162306a36Sopenharmony_ci#define __CVMX_WQE_H__ 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci#include <asm/octeon/cvmx-packet.h> 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci#define OCT_TAG_TYPE_STRING(x) \ 4762306a36Sopenharmony_ci (((x) == CVMX_POW_TAG_TYPE_ORDERED) ? "ORDERED" : \ 4862306a36Sopenharmony_ci (((x) == CVMX_POW_TAG_TYPE_ATOMIC) ? "ATOMIC" : \ 4962306a36Sopenharmony_ci (((x) == CVMX_POW_TAG_TYPE_NULL) ? "NULL" : \ 5062306a36Sopenharmony_ci "NULL_NULL"))) 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci/** 5362306a36Sopenharmony_ci * HW decode / err_code in work queue entry 5462306a36Sopenharmony_ci */ 5562306a36Sopenharmony_citypedef union { 5662306a36Sopenharmony_ci uint64_t u64; 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci /* Use this struct if the hardware determines that the packet is IP */ 5962306a36Sopenharmony_ci struct { 6062306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 6162306a36Sopenharmony_ci /* HW sets this to the number of buffers used by this packet */ 6262306a36Sopenharmony_ci uint64_t bufs:8; 6362306a36Sopenharmony_ci /* HW sets to the number of L2 bytes prior to the IP */ 6462306a36Sopenharmony_ci uint64_t ip_offset:8; 6562306a36Sopenharmony_ci /* set to 1 if we found DSA/VLAN in the L2 */ 6662306a36Sopenharmony_ci uint64_t vlan_valid:1; 6762306a36Sopenharmony_ci /* Set to 1 if the DSA/VLAN tag is stacked */ 6862306a36Sopenharmony_ci uint64_t vlan_stacked:1; 6962306a36Sopenharmony_ci uint64_t unassigned:1; 7062306a36Sopenharmony_ci /* HW sets to the DSA/VLAN CFI flag (valid when vlan_valid) */ 7162306a36Sopenharmony_ci uint64_t vlan_cfi:1; 7262306a36Sopenharmony_ci /* HW sets to the DSA/VLAN_ID field (valid when vlan_valid) */ 7362306a36Sopenharmony_ci uint64_t vlan_id:12; 7462306a36Sopenharmony_ci /* Ring Identifier (if PCIe). Requires PIP_GBL_CTL[RING_EN]=1 */ 7562306a36Sopenharmony_ci uint64_t pr:4; 7662306a36Sopenharmony_ci uint64_t unassigned2:8; 7762306a36Sopenharmony_ci /* the packet needs to be decompressed */ 7862306a36Sopenharmony_ci uint64_t dec_ipcomp:1; 7962306a36Sopenharmony_ci /* the packet is either TCP or UDP */ 8062306a36Sopenharmony_ci uint64_t tcp_or_udp:1; 8162306a36Sopenharmony_ci /* the packet needs to be decrypted (ESP or AH) */ 8262306a36Sopenharmony_ci uint64_t dec_ipsec:1; 8362306a36Sopenharmony_ci /* the packet is IPv6 */ 8462306a36Sopenharmony_ci uint64_t is_v6:1; 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci /* 8762306a36Sopenharmony_ci * (rcv_error, not_IP, IP_exc, is_frag, L4_error, 8862306a36Sopenharmony_ci * software, etc.). 8962306a36Sopenharmony_ci */ 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci /* 9262306a36Sopenharmony_ci * reserved for software use, hardware will clear on 9362306a36Sopenharmony_ci * packet creation. 9462306a36Sopenharmony_ci */ 9562306a36Sopenharmony_ci uint64_t software:1; 9662306a36Sopenharmony_ci /* exceptional conditions below */ 9762306a36Sopenharmony_ci /* the receive interface hardware detected an L4 error 9862306a36Sopenharmony_ci * (only applies if !is_frag) (only applies if 9962306a36Sopenharmony_ci * !rcv_error && !not_IP && !IP_exc && !is_frag) 10062306a36Sopenharmony_ci * failure indicated in err_code below, decode: 10162306a36Sopenharmony_ci * 10262306a36Sopenharmony_ci * - 1 = Malformed L4 10362306a36Sopenharmony_ci * - 2 = L4 Checksum Error: the L4 checksum value is 10462306a36Sopenharmony_ci * - 3 = UDP Length Error: The UDP length field would 10562306a36Sopenharmony_ci * make the UDP data longer than what remains in 10662306a36Sopenharmony_ci * the IP packet (as defined by the IP header 10762306a36Sopenharmony_ci * length field). 10862306a36Sopenharmony_ci * - 4 = Bad L4 Port: either the source or destination 10962306a36Sopenharmony_ci * TCP/UDP port is 0. 11062306a36Sopenharmony_ci * - 8 = TCP FIN Only: the packet is TCP and only the 11162306a36Sopenharmony_ci * FIN flag set. 11262306a36Sopenharmony_ci * - 9 = TCP No Flags: the packet is TCP and no flags 11362306a36Sopenharmony_ci * are set. 11462306a36Sopenharmony_ci * - 10 = TCP FIN RST: the packet is TCP and both FIN 11562306a36Sopenharmony_ci * and RST are set. 11662306a36Sopenharmony_ci * - 11 = TCP SYN URG: the packet is TCP and both SYN 11762306a36Sopenharmony_ci * and URG are set. 11862306a36Sopenharmony_ci * - 12 = TCP SYN RST: the packet is TCP and both SYN 11962306a36Sopenharmony_ci * and RST are set. 12062306a36Sopenharmony_ci * - 13 = TCP SYN FIN: the packet is TCP and both SYN 12162306a36Sopenharmony_ci * and FIN are set. 12262306a36Sopenharmony_ci */ 12362306a36Sopenharmony_ci uint64_t L4_error:1; 12462306a36Sopenharmony_ci /* set if the packet is a fragment */ 12562306a36Sopenharmony_ci uint64_t is_frag:1; 12662306a36Sopenharmony_ci /* the receive interface hardware detected an IP error 12762306a36Sopenharmony_ci * / exception (only applies if !rcv_error && !not_IP) 12862306a36Sopenharmony_ci * failure indicated in err_code below, decode: 12962306a36Sopenharmony_ci * 13062306a36Sopenharmony_ci * - 1 = Not IP: the IP version field is neither 4 nor 13162306a36Sopenharmony_ci * 6. 13262306a36Sopenharmony_ci * - 2 = IPv4 Header Checksum Error: the IPv4 header 13362306a36Sopenharmony_ci * has a checksum violation. 13462306a36Sopenharmony_ci * - 3 = IP Malformed Header: the packet is not long 13562306a36Sopenharmony_ci * enough to contain the IP header. 13662306a36Sopenharmony_ci * - 4 = IP Malformed: the packet is not long enough 13762306a36Sopenharmony_ci * to contain the bytes indicated by the IP 13862306a36Sopenharmony_ci * header. Pad is allowed. 13962306a36Sopenharmony_ci * - 5 = IP TTL Hop: the IPv4 TTL field or the IPv6 14062306a36Sopenharmony_ci * Hop Count field are zero. 14162306a36Sopenharmony_ci * - 6 = IP Options 14262306a36Sopenharmony_ci */ 14362306a36Sopenharmony_ci uint64_t IP_exc:1; 14462306a36Sopenharmony_ci /* 14562306a36Sopenharmony_ci * Set if the hardware determined that the packet is a 14662306a36Sopenharmony_ci * broadcast. 14762306a36Sopenharmony_ci */ 14862306a36Sopenharmony_ci uint64_t is_bcast:1; 14962306a36Sopenharmony_ci /* 15062306a36Sopenharmony_ci * St if the hardware determined that the packet is a 15162306a36Sopenharmony_ci * multi-cast. 15262306a36Sopenharmony_ci */ 15362306a36Sopenharmony_ci uint64_t is_mcast:1; 15462306a36Sopenharmony_ci /* 15562306a36Sopenharmony_ci * Set if the packet may not be IP (must be zero in 15662306a36Sopenharmony_ci * this case). 15762306a36Sopenharmony_ci */ 15862306a36Sopenharmony_ci uint64_t not_IP:1; 15962306a36Sopenharmony_ci /* 16062306a36Sopenharmony_ci * The receive interface hardware detected a receive 16162306a36Sopenharmony_ci * error (must be zero in this case). 16262306a36Sopenharmony_ci */ 16362306a36Sopenharmony_ci uint64_t rcv_error:1; 16462306a36Sopenharmony_ci /* lower err_code = first-level descriptor of the 16562306a36Sopenharmony_ci * work */ 16662306a36Sopenharmony_ci /* zero for packet submitted by hardware that isn't on 16762306a36Sopenharmony_ci * the slow path */ 16862306a36Sopenharmony_ci /* type is cvmx_pip_err_t */ 16962306a36Sopenharmony_ci uint64_t err_code:8; 17062306a36Sopenharmony_ci#else 17162306a36Sopenharmony_ci uint64_t err_code:8; 17262306a36Sopenharmony_ci uint64_t rcv_error:1; 17362306a36Sopenharmony_ci uint64_t not_IP:1; 17462306a36Sopenharmony_ci uint64_t is_mcast:1; 17562306a36Sopenharmony_ci uint64_t is_bcast:1; 17662306a36Sopenharmony_ci uint64_t IP_exc:1; 17762306a36Sopenharmony_ci uint64_t is_frag:1; 17862306a36Sopenharmony_ci uint64_t L4_error:1; 17962306a36Sopenharmony_ci uint64_t software:1; 18062306a36Sopenharmony_ci uint64_t is_v6:1; 18162306a36Sopenharmony_ci uint64_t dec_ipsec:1; 18262306a36Sopenharmony_ci uint64_t tcp_or_udp:1; 18362306a36Sopenharmony_ci uint64_t dec_ipcomp:1; 18462306a36Sopenharmony_ci uint64_t unassigned2:4; 18562306a36Sopenharmony_ci uint64_t unassigned2a:4; 18662306a36Sopenharmony_ci uint64_t pr:4; 18762306a36Sopenharmony_ci uint64_t vlan_id:12; 18862306a36Sopenharmony_ci uint64_t vlan_cfi:1; 18962306a36Sopenharmony_ci uint64_t unassigned:1; 19062306a36Sopenharmony_ci uint64_t vlan_stacked:1; 19162306a36Sopenharmony_ci uint64_t vlan_valid:1; 19262306a36Sopenharmony_ci uint64_t ip_offset:8; 19362306a36Sopenharmony_ci uint64_t bufs:8; 19462306a36Sopenharmony_ci#endif 19562306a36Sopenharmony_ci } s; 19662306a36Sopenharmony_ci struct { 19762306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 19862306a36Sopenharmony_ci uint64_t bufs:8; 19962306a36Sopenharmony_ci uint64_t ip_offset:8; 20062306a36Sopenharmony_ci uint64_t vlan_valid:1; 20162306a36Sopenharmony_ci uint64_t vlan_stacked:1; 20262306a36Sopenharmony_ci uint64_t unassigned:1; 20362306a36Sopenharmony_ci uint64_t vlan_cfi:1; 20462306a36Sopenharmony_ci uint64_t vlan_id:12; 20562306a36Sopenharmony_ci uint64_t port:12; /* MAC/PIP port number. */ 20662306a36Sopenharmony_ci uint64_t dec_ipcomp:1; 20762306a36Sopenharmony_ci uint64_t tcp_or_udp:1; 20862306a36Sopenharmony_ci uint64_t dec_ipsec:1; 20962306a36Sopenharmony_ci uint64_t is_v6:1; 21062306a36Sopenharmony_ci uint64_t software:1; 21162306a36Sopenharmony_ci uint64_t L4_error:1; 21262306a36Sopenharmony_ci uint64_t is_frag:1; 21362306a36Sopenharmony_ci uint64_t IP_exc:1; 21462306a36Sopenharmony_ci uint64_t is_bcast:1; 21562306a36Sopenharmony_ci uint64_t is_mcast:1; 21662306a36Sopenharmony_ci uint64_t not_IP:1; 21762306a36Sopenharmony_ci uint64_t rcv_error:1; 21862306a36Sopenharmony_ci uint64_t err_code:8; 21962306a36Sopenharmony_ci#else 22062306a36Sopenharmony_ci uint64_t err_code:8; 22162306a36Sopenharmony_ci uint64_t rcv_error:1; 22262306a36Sopenharmony_ci uint64_t not_IP:1; 22362306a36Sopenharmony_ci uint64_t is_mcast:1; 22462306a36Sopenharmony_ci uint64_t is_bcast:1; 22562306a36Sopenharmony_ci uint64_t IP_exc:1; 22662306a36Sopenharmony_ci uint64_t is_frag:1; 22762306a36Sopenharmony_ci uint64_t L4_error:1; 22862306a36Sopenharmony_ci uint64_t software:1; 22962306a36Sopenharmony_ci uint64_t is_v6:1; 23062306a36Sopenharmony_ci uint64_t dec_ipsec:1; 23162306a36Sopenharmony_ci uint64_t tcp_or_udp:1; 23262306a36Sopenharmony_ci uint64_t dec_ipcomp:1; 23362306a36Sopenharmony_ci uint64_t port:12; 23462306a36Sopenharmony_ci uint64_t vlan_id:12; 23562306a36Sopenharmony_ci uint64_t vlan_cfi:1; 23662306a36Sopenharmony_ci uint64_t unassigned:1; 23762306a36Sopenharmony_ci uint64_t vlan_stacked:1; 23862306a36Sopenharmony_ci uint64_t vlan_valid:1; 23962306a36Sopenharmony_ci uint64_t ip_offset:8; 24062306a36Sopenharmony_ci uint64_t bufs:8; 24162306a36Sopenharmony_ci#endif 24262306a36Sopenharmony_ci } s_cn68xx; 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci /* use this to get at the 16 vlan bits */ 24562306a36Sopenharmony_ci struct { 24662306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 24762306a36Sopenharmony_ci uint64_t unused1:16; 24862306a36Sopenharmony_ci uint64_t vlan:16; 24962306a36Sopenharmony_ci uint64_t unused2:32; 25062306a36Sopenharmony_ci#else 25162306a36Sopenharmony_ci uint64_t unused2:32; 25262306a36Sopenharmony_ci uint64_t vlan:16; 25362306a36Sopenharmony_ci uint64_t unused1:16; 25462306a36Sopenharmony_ci 25562306a36Sopenharmony_ci#endif 25662306a36Sopenharmony_ci } svlan; 25762306a36Sopenharmony_ci 25862306a36Sopenharmony_ci /* 25962306a36Sopenharmony_ci * use this struct if the hardware could not determine that 26062306a36Sopenharmony_ci * the packet is ip. 26162306a36Sopenharmony_ci */ 26262306a36Sopenharmony_ci struct { 26362306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 26462306a36Sopenharmony_ci /* 26562306a36Sopenharmony_ci * HW sets this to the number of buffers used by this 26662306a36Sopenharmony_ci * packet. 26762306a36Sopenharmony_ci */ 26862306a36Sopenharmony_ci uint64_t bufs:8; 26962306a36Sopenharmony_ci uint64_t unused:8; 27062306a36Sopenharmony_ci /* set to 1 if we found DSA/VLAN in the L2 */ 27162306a36Sopenharmony_ci uint64_t vlan_valid:1; 27262306a36Sopenharmony_ci /* Set to 1 if the DSA/VLAN tag is stacked */ 27362306a36Sopenharmony_ci uint64_t vlan_stacked:1; 27462306a36Sopenharmony_ci uint64_t unassigned:1; 27562306a36Sopenharmony_ci /* 27662306a36Sopenharmony_ci * HW sets to the DSA/VLAN CFI flag (valid when 27762306a36Sopenharmony_ci * vlan_valid) 27862306a36Sopenharmony_ci */ 27962306a36Sopenharmony_ci uint64_t vlan_cfi:1; 28062306a36Sopenharmony_ci /* 28162306a36Sopenharmony_ci * HW sets to the DSA/VLAN_ID field (valid when 28262306a36Sopenharmony_ci * vlan_valid). 28362306a36Sopenharmony_ci */ 28462306a36Sopenharmony_ci uint64_t vlan_id:12; 28562306a36Sopenharmony_ci /* 28662306a36Sopenharmony_ci * Ring Identifier (if PCIe). Requires 28762306a36Sopenharmony_ci * PIP_GBL_CTL[RING_EN]=1 28862306a36Sopenharmony_ci */ 28962306a36Sopenharmony_ci uint64_t pr:4; 29062306a36Sopenharmony_ci uint64_t unassigned2:12; 29162306a36Sopenharmony_ci /* 29262306a36Sopenharmony_ci * reserved for software use, hardware will clear on 29362306a36Sopenharmony_ci * packet creation. 29462306a36Sopenharmony_ci */ 29562306a36Sopenharmony_ci uint64_t software:1; 29662306a36Sopenharmony_ci uint64_t unassigned3:1; 29762306a36Sopenharmony_ci /* 29862306a36Sopenharmony_ci * set if the hardware determined that the packet is 29962306a36Sopenharmony_ci * rarp. 30062306a36Sopenharmony_ci */ 30162306a36Sopenharmony_ci uint64_t is_rarp:1; 30262306a36Sopenharmony_ci /* 30362306a36Sopenharmony_ci * set if the hardware determined that the packet is 30462306a36Sopenharmony_ci * arp 30562306a36Sopenharmony_ci */ 30662306a36Sopenharmony_ci uint64_t is_arp:1; 30762306a36Sopenharmony_ci /* 30862306a36Sopenharmony_ci * set if the hardware determined that the packet is a 30962306a36Sopenharmony_ci * broadcast. 31062306a36Sopenharmony_ci */ 31162306a36Sopenharmony_ci uint64_t is_bcast:1; 31262306a36Sopenharmony_ci /* 31362306a36Sopenharmony_ci * set if the hardware determined that the packet is a 31462306a36Sopenharmony_ci * multi-cast 31562306a36Sopenharmony_ci */ 31662306a36Sopenharmony_ci uint64_t is_mcast:1; 31762306a36Sopenharmony_ci /* 31862306a36Sopenharmony_ci * set if the packet may not be IP (must be one in 31962306a36Sopenharmony_ci * this case) 32062306a36Sopenharmony_ci */ 32162306a36Sopenharmony_ci uint64_t not_IP:1; 32262306a36Sopenharmony_ci /* The receive interface hardware detected a receive 32362306a36Sopenharmony_ci * error. Failure indicated in err_code below, 32462306a36Sopenharmony_ci * decode: 32562306a36Sopenharmony_ci * 32662306a36Sopenharmony_ci * - 1 = partial error: a packet was partially 32762306a36Sopenharmony_ci * received, but internal buffering / bandwidth 32862306a36Sopenharmony_ci * was not adequate to receive the entire 32962306a36Sopenharmony_ci * packet. 33062306a36Sopenharmony_ci * - 2 = jabber error: the RGMII packet was too large 33162306a36Sopenharmony_ci * and is truncated. 33262306a36Sopenharmony_ci * - 3 = overrun error: the RGMII packet is longer 33362306a36Sopenharmony_ci * than allowed and had an FCS error. 33462306a36Sopenharmony_ci * - 4 = oversize error: the RGMII packet is longer 33562306a36Sopenharmony_ci * than allowed. 33662306a36Sopenharmony_ci * - 5 = alignment error: the RGMII packet is not an 33762306a36Sopenharmony_ci * integer number of bytes 33862306a36Sopenharmony_ci * and had an FCS error (100M and 10M only). 33962306a36Sopenharmony_ci * - 6 = fragment error: the RGMII packet is shorter 34062306a36Sopenharmony_ci * than allowed and had an FCS error. 34162306a36Sopenharmony_ci * - 7 = GMX FCS error: the RGMII packet had an FCS 34262306a36Sopenharmony_ci * error. 34362306a36Sopenharmony_ci * - 8 = undersize error: the RGMII packet is shorter 34462306a36Sopenharmony_ci * than allowed. 34562306a36Sopenharmony_ci * - 9 = extend error: the RGMII packet had an extend 34662306a36Sopenharmony_ci * error. 34762306a36Sopenharmony_ci * - 10 = length mismatch error: the RGMII packet had 34862306a36Sopenharmony_ci * a length that did not match the length field 34962306a36Sopenharmony_ci * in the L2 HDR. 35062306a36Sopenharmony_ci * - 11 = RGMII RX error/SPI4 DIP4 Error: the RGMII 35162306a36Sopenharmony_ci * packet had one or more data reception errors 35262306a36Sopenharmony_ci * (RXERR) or the SPI4 packet had one or more 35362306a36Sopenharmony_ci * DIP4 errors. 35462306a36Sopenharmony_ci * - 12 = RGMII skip error/SPI4 Abort Error: the RGMII 35562306a36Sopenharmony_ci * packet was not large enough to cover the 35662306a36Sopenharmony_ci * skipped bytes or the SPI4 packet was 35762306a36Sopenharmony_ci * terminated with an About EOPS. 35862306a36Sopenharmony_ci * - 13 = RGMII nibble error/SPI4 Port NXA Error: the 35962306a36Sopenharmony_ci * RGMII packet had a studder error (data not 36062306a36Sopenharmony_ci * repeated - 10/100M only) or the SPI4 packet 36162306a36Sopenharmony_ci * was sent to an NXA. 36262306a36Sopenharmony_ci * - 16 = FCS error: a SPI4.2 packet had an FCS error. 36362306a36Sopenharmony_ci * - 17 = Skip error: a packet was not large enough to 36462306a36Sopenharmony_ci * cover the skipped bytes. 36562306a36Sopenharmony_ci * - 18 = L2 header malformed: the packet is not long 36662306a36Sopenharmony_ci * enough to contain the L2. 36762306a36Sopenharmony_ci */ 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci uint64_t rcv_error:1; 37062306a36Sopenharmony_ci /* 37162306a36Sopenharmony_ci * lower err_code = first-level descriptor of the 37262306a36Sopenharmony_ci * work 37362306a36Sopenharmony_ci */ 37462306a36Sopenharmony_ci /* 37562306a36Sopenharmony_ci * zero for packet submitted by hardware that isn't on 37662306a36Sopenharmony_ci * the slow path 37762306a36Sopenharmony_ci */ 37862306a36Sopenharmony_ci /* type is cvmx_pip_err_t (union, so can't use directly */ 37962306a36Sopenharmony_ci uint64_t err_code:8; 38062306a36Sopenharmony_ci#else 38162306a36Sopenharmony_ci uint64_t err_code:8; 38262306a36Sopenharmony_ci uint64_t rcv_error:1; 38362306a36Sopenharmony_ci uint64_t not_IP:1; 38462306a36Sopenharmony_ci uint64_t is_mcast:1; 38562306a36Sopenharmony_ci uint64_t is_bcast:1; 38662306a36Sopenharmony_ci uint64_t is_arp:1; 38762306a36Sopenharmony_ci uint64_t is_rarp:1; 38862306a36Sopenharmony_ci uint64_t unassigned3:1; 38962306a36Sopenharmony_ci uint64_t software:1; 39062306a36Sopenharmony_ci uint64_t unassigned2:4; 39162306a36Sopenharmony_ci uint64_t unassigned2a:8; 39262306a36Sopenharmony_ci uint64_t pr:4; 39362306a36Sopenharmony_ci uint64_t vlan_id:12; 39462306a36Sopenharmony_ci uint64_t vlan_cfi:1; 39562306a36Sopenharmony_ci uint64_t unassigned:1; 39662306a36Sopenharmony_ci uint64_t vlan_stacked:1; 39762306a36Sopenharmony_ci uint64_t vlan_valid:1; 39862306a36Sopenharmony_ci uint64_t unused:8; 39962306a36Sopenharmony_ci uint64_t bufs:8; 40062306a36Sopenharmony_ci#endif 40162306a36Sopenharmony_ci } snoip; 40262306a36Sopenharmony_ci 40362306a36Sopenharmony_ci} cvmx_pip_wqe_word2; 40462306a36Sopenharmony_ci 40562306a36Sopenharmony_ciunion cvmx_pip_wqe_word0 { 40662306a36Sopenharmony_ci struct { 40762306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 40862306a36Sopenharmony_ci /** 40962306a36Sopenharmony_ci * raw chksum result generated by the HW 41062306a36Sopenharmony_ci */ 41162306a36Sopenharmony_ci uint16_t hw_chksum; 41262306a36Sopenharmony_ci /** 41362306a36Sopenharmony_ci * Field unused by hardware - available for software 41462306a36Sopenharmony_ci */ 41562306a36Sopenharmony_ci uint8_t unused; 41662306a36Sopenharmony_ci /** 41762306a36Sopenharmony_ci * Next pointer used by hardware for list maintenance. 41862306a36Sopenharmony_ci * May be written/read by HW before the work queue 41962306a36Sopenharmony_ci * entry is scheduled to a PP (Only 36 bits used in 42062306a36Sopenharmony_ci * Octeon 1) 42162306a36Sopenharmony_ci */ 42262306a36Sopenharmony_ci uint64_t next_ptr:40; 42362306a36Sopenharmony_ci#else 42462306a36Sopenharmony_ci uint64_t next_ptr:40; 42562306a36Sopenharmony_ci uint8_t unused; 42662306a36Sopenharmony_ci uint16_t hw_chksum; 42762306a36Sopenharmony_ci#endif 42862306a36Sopenharmony_ci } cn38xx; 42962306a36Sopenharmony_ci struct { 43062306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 43162306a36Sopenharmony_ci uint64_t l4ptr:8; /* 56..63 */ 43262306a36Sopenharmony_ci uint64_t unused0:8; /* 48..55 */ 43362306a36Sopenharmony_ci uint64_t l3ptr:8; /* 40..47 */ 43462306a36Sopenharmony_ci uint64_t l2ptr:8; /* 32..39 */ 43562306a36Sopenharmony_ci uint64_t unused1:18; /* 14..31 */ 43662306a36Sopenharmony_ci uint64_t bpid:6; /* 8..13 */ 43762306a36Sopenharmony_ci uint64_t unused2:2; /* 6..7 */ 43862306a36Sopenharmony_ci uint64_t pknd:6; /* 0..5 */ 43962306a36Sopenharmony_ci#else 44062306a36Sopenharmony_ci uint64_t pknd:6; /* 0..5 */ 44162306a36Sopenharmony_ci uint64_t unused2:2; /* 6..7 */ 44262306a36Sopenharmony_ci uint64_t bpid:6; /* 8..13 */ 44362306a36Sopenharmony_ci uint64_t unused1:18; /* 14..31 */ 44462306a36Sopenharmony_ci uint64_t l2ptr:8; /* 32..39 */ 44562306a36Sopenharmony_ci uint64_t l3ptr:8; /* 40..47 */ 44662306a36Sopenharmony_ci uint64_t unused0:8; /* 48..55 */ 44762306a36Sopenharmony_ci uint64_t l4ptr:8; /* 56..63 */ 44862306a36Sopenharmony_ci#endif 44962306a36Sopenharmony_ci } cn68xx; 45062306a36Sopenharmony_ci}; 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_ciunion cvmx_wqe_word0 { 45362306a36Sopenharmony_ci uint64_t u64; 45462306a36Sopenharmony_ci union cvmx_pip_wqe_word0 pip; 45562306a36Sopenharmony_ci}; 45662306a36Sopenharmony_ci 45762306a36Sopenharmony_ciunion cvmx_wqe_word1 { 45862306a36Sopenharmony_ci uint64_t u64; 45962306a36Sopenharmony_ci struct { 46062306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 46162306a36Sopenharmony_ci uint64_t len:16; 46262306a36Sopenharmony_ci uint64_t varies:14; 46362306a36Sopenharmony_ci /** 46462306a36Sopenharmony_ci * the type of the tag (ORDERED, ATOMIC, NULL) 46562306a36Sopenharmony_ci */ 46662306a36Sopenharmony_ci uint64_t tag_type:2; 46762306a36Sopenharmony_ci uint64_t tag:32; 46862306a36Sopenharmony_ci#else 46962306a36Sopenharmony_ci uint64_t tag:32; 47062306a36Sopenharmony_ci uint64_t tag_type:2; 47162306a36Sopenharmony_ci uint64_t varies:14; 47262306a36Sopenharmony_ci uint64_t len:16; 47362306a36Sopenharmony_ci#endif 47462306a36Sopenharmony_ci }; 47562306a36Sopenharmony_ci struct { 47662306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 47762306a36Sopenharmony_ci uint64_t len:16; 47862306a36Sopenharmony_ci uint64_t zero_0:1; 47962306a36Sopenharmony_ci /** 48062306a36Sopenharmony_ci * HW sets this to what it thought the priority of 48162306a36Sopenharmony_ci * the input packet was 48262306a36Sopenharmony_ci */ 48362306a36Sopenharmony_ci uint64_t qos:3; 48462306a36Sopenharmony_ci 48562306a36Sopenharmony_ci uint64_t zero_1:1; 48662306a36Sopenharmony_ci /** 48762306a36Sopenharmony_ci * the group that the work queue entry will be scheduled to 48862306a36Sopenharmony_ci */ 48962306a36Sopenharmony_ci uint64_t grp:6; 49062306a36Sopenharmony_ci uint64_t zero_2:3; 49162306a36Sopenharmony_ci uint64_t tag_type:2; 49262306a36Sopenharmony_ci uint64_t tag:32; 49362306a36Sopenharmony_ci#else 49462306a36Sopenharmony_ci uint64_t tag:32; 49562306a36Sopenharmony_ci uint64_t tag_type:2; 49662306a36Sopenharmony_ci uint64_t zero_2:3; 49762306a36Sopenharmony_ci uint64_t grp:6; 49862306a36Sopenharmony_ci uint64_t zero_1:1; 49962306a36Sopenharmony_ci uint64_t qos:3; 50062306a36Sopenharmony_ci uint64_t zero_0:1; 50162306a36Sopenharmony_ci uint64_t len:16; 50262306a36Sopenharmony_ci#endif 50362306a36Sopenharmony_ci } cn68xx; 50462306a36Sopenharmony_ci struct { 50562306a36Sopenharmony_ci#ifdef __BIG_ENDIAN_BITFIELD 50662306a36Sopenharmony_ci /** 50762306a36Sopenharmony_ci * HW sets to the total number of bytes in the packet 50862306a36Sopenharmony_ci */ 50962306a36Sopenharmony_ci uint64_t len:16; 51062306a36Sopenharmony_ci /** 51162306a36Sopenharmony_ci * HW sets this to input physical port 51262306a36Sopenharmony_ci */ 51362306a36Sopenharmony_ci uint64_t ipprt:6; 51462306a36Sopenharmony_ci 51562306a36Sopenharmony_ci /** 51662306a36Sopenharmony_ci * HW sets this to what it thought the priority of 51762306a36Sopenharmony_ci * the input packet was 51862306a36Sopenharmony_ci */ 51962306a36Sopenharmony_ci uint64_t qos:3; 52062306a36Sopenharmony_ci 52162306a36Sopenharmony_ci /** 52262306a36Sopenharmony_ci * the group that the work queue entry will be scheduled to 52362306a36Sopenharmony_ci */ 52462306a36Sopenharmony_ci uint64_t grp:4; 52562306a36Sopenharmony_ci /** 52662306a36Sopenharmony_ci * the type of the tag (ORDERED, ATOMIC, NULL) 52762306a36Sopenharmony_ci */ 52862306a36Sopenharmony_ci uint64_t tag_type:3; 52962306a36Sopenharmony_ci /** 53062306a36Sopenharmony_ci * the synchronization/ordering tag 53162306a36Sopenharmony_ci */ 53262306a36Sopenharmony_ci uint64_t tag:32; 53362306a36Sopenharmony_ci#else 53462306a36Sopenharmony_ci uint64_t tag:32; 53562306a36Sopenharmony_ci uint64_t tag_type:2; 53662306a36Sopenharmony_ci uint64_t zero_2:1; 53762306a36Sopenharmony_ci uint64_t grp:4; 53862306a36Sopenharmony_ci uint64_t qos:3; 53962306a36Sopenharmony_ci uint64_t ipprt:6; 54062306a36Sopenharmony_ci uint64_t len:16; 54162306a36Sopenharmony_ci#endif 54262306a36Sopenharmony_ci } cn38xx; 54362306a36Sopenharmony_ci}; 54462306a36Sopenharmony_ci 54562306a36Sopenharmony_ci/** 54662306a36Sopenharmony_ci * Work queue entry format 54762306a36Sopenharmony_ci * 54862306a36Sopenharmony_ci * must be 8-byte aligned 54962306a36Sopenharmony_ci */ 55062306a36Sopenharmony_cistruct cvmx_wqe { 55162306a36Sopenharmony_ci 55262306a36Sopenharmony_ci /***************************************************************** 55362306a36Sopenharmony_ci * WORD 0 55462306a36Sopenharmony_ci * HW WRITE: the following 64 bits are filled by HW when a packet arrives 55562306a36Sopenharmony_ci */ 55662306a36Sopenharmony_ci union cvmx_wqe_word0 word0; 55762306a36Sopenharmony_ci 55862306a36Sopenharmony_ci /***************************************************************** 55962306a36Sopenharmony_ci * WORD 1 56062306a36Sopenharmony_ci * HW WRITE: the following 64 bits are filled by HW when a packet arrives 56162306a36Sopenharmony_ci */ 56262306a36Sopenharmony_ci union cvmx_wqe_word1 word1; 56362306a36Sopenharmony_ci 56462306a36Sopenharmony_ci /** 56562306a36Sopenharmony_ci * WORD 2 HW WRITE: the following 64-bits are filled in by 56662306a36Sopenharmony_ci * hardware when a packet arrives This indicates a variety of 56762306a36Sopenharmony_ci * status and error conditions. 56862306a36Sopenharmony_ci */ 56962306a36Sopenharmony_ci cvmx_pip_wqe_word2 word2; 57062306a36Sopenharmony_ci 57162306a36Sopenharmony_ci /** 57262306a36Sopenharmony_ci * Pointer to the first segment of the packet. 57362306a36Sopenharmony_ci */ 57462306a36Sopenharmony_ci union cvmx_buf_ptr packet_ptr; 57562306a36Sopenharmony_ci 57662306a36Sopenharmony_ci /** 57762306a36Sopenharmony_ci * HW WRITE: octeon will fill in a programmable amount from the 57862306a36Sopenharmony_ci * packet, up to (at most, but perhaps less) the amount 57962306a36Sopenharmony_ci * needed to fill the work queue entry to 128 bytes 58062306a36Sopenharmony_ci * 58162306a36Sopenharmony_ci * If the packet is recognized to be IP, the hardware starts 58262306a36Sopenharmony_ci * (except that the IPv4 header is padded for appropriate 58362306a36Sopenharmony_ci * alignment) writing here where the IP header starts. If the 58462306a36Sopenharmony_ci * packet is not recognized to be IP, the hardware starts 58562306a36Sopenharmony_ci * writing the beginning of the packet here. 58662306a36Sopenharmony_ci */ 58762306a36Sopenharmony_ci uint8_t packet_data[96]; 58862306a36Sopenharmony_ci 58962306a36Sopenharmony_ci /** 59062306a36Sopenharmony_ci * If desired, SW can make the work Q entry any length. For the 59162306a36Sopenharmony_ci * purposes of discussion here, Assume 128B always, as this is all that 59262306a36Sopenharmony_ci * the hardware deals with. 59362306a36Sopenharmony_ci * 59462306a36Sopenharmony_ci */ 59562306a36Sopenharmony_ci 59662306a36Sopenharmony_ci} CVMX_CACHE_LINE_ALIGNED; 59762306a36Sopenharmony_ci 59862306a36Sopenharmony_cistatic inline int cvmx_wqe_get_port(struct cvmx_wqe *work) 59962306a36Sopenharmony_ci{ 60062306a36Sopenharmony_ci int port; 60162306a36Sopenharmony_ci 60262306a36Sopenharmony_ci if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE)) 60362306a36Sopenharmony_ci port = work->word2.s_cn68xx.port; 60462306a36Sopenharmony_ci else 60562306a36Sopenharmony_ci port = work->word1.cn38xx.ipprt; 60662306a36Sopenharmony_ci 60762306a36Sopenharmony_ci return port; 60862306a36Sopenharmony_ci} 60962306a36Sopenharmony_ci 61062306a36Sopenharmony_cistatic inline void cvmx_wqe_set_port(struct cvmx_wqe *work, int port) 61162306a36Sopenharmony_ci{ 61262306a36Sopenharmony_ci if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE)) 61362306a36Sopenharmony_ci work->word2.s_cn68xx.port = port; 61462306a36Sopenharmony_ci else 61562306a36Sopenharmony_ci work->word1.cn38xx.ipprt = port; 61662306a36Sopenharmony_ci} 61762306a36Sopenharmony_ci 61862306a36Sopenharmony_cistatic inline int cvmx_wqe_get_grp(struct cvmx_wqe *work) 61962306a36Sopenharmony_ci{ 62062306a36Sopenharmony_ci int grp; 62162306a36Sopenharmony_ci 62262306a36Sopenharmony_ci if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE)) 62362306a36Sopenharmony_ci grp = work->word1.cn68xx.grp; 62462306a36Sopenharmony_ci else 62562306a36Sopenharmony_ci grp = work->word1.cn38xx.grp; 62662306a36Sopenharmony_ci 62762306a36Sopenharmony_ci return grp; 62862306a36Sopenharmony_ci} 62962306a36Sopenharmony_ci 63062306a36Sopenharmony_cistatic inline void cvmx_wqe_set_grp(struct cvmx_wqe *work, int grp) 63162306a36Sopenharmony_ci{ 63262306a36Sopenharmony_ci if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE)) 63362306a36Sopenharmony_ci work->word1.cn68xx.grp = grp; 63462306a36Sopenharmony_ci else 63562306a36Sopenharmony_ci work->word1.cn38xx.grp = grp; 63662306a36Sopenharmony_ci} 63762306a36Sopenharmony_ci 63862306a36Sopenharmony_cistatic inline int cvmx_wqe_get_qos(struct cvmx_wqe *work) 63962306a36Sopenharmony_ci{ 64062306a36Sopenharmony_ci int qos; 64162306a36Sopenharmony_ci 64262306a36Sopenharmony_ci if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE)) 64362306a36Sopenharmony_ci qos = work->word1.cn68xx.qos; 64462306a36Sopenharmony_ci else 64562306a36Sopenharmony_ci qos = work->word1.cn38xx.qos; 64662306a36Sopenharmony_ci 64762306a36Sopenharmony_ci return qos; 64862306a36Sopenharmony_ci} 64962306a36Sopenharmony_ci 65062306a36Sopenharmony_cistatic inline void cvmx_wqe_set_qos(struct cvmx_wqe *work, int qos) 65162306a36Sopenharmony_ci{ 65262306a36Sopenharmony_ci if (octeon_has_feature(OCTEON_FEATURE_CN68XX_WQE)) 65362306a36Sopenharmony_ci work->word1.cn68xx.qos = qos; 65462306a36Sopenharmony_ci else 65562306a36Sopenharmony_ci work->word1.cn38xx.qos = qos; 65662306a36Sopenharmony_ci} 65762306a36Sopenharmony_ci 65862306a36Sopenharmony_ci#endif /* __CVMX_WQE_H__ */ 659