1 /* 2 * BSD LICENSE 3 * 4 * Copyright (C) Cavium Inc. 2017. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * * Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * * Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in 14 * the documentation and/or other materials provided with the 15 * distribution. 16 * * Neither the name of Cavium networks nor the names of its 17 * contributors may be used to endorse or promote products derived 18 * from this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 #ifndef __OCTEONTX_PKI_VAR_H__ 34 #define __OCTEONTX_PKI_VAR_H__ 35 36 #include <rte_byteorder.h> 37 38 #define OCTTX_PACKET_WQE_SKIP 128 39 #define OCTTX_PACKET_FIRST_SKIP 240 40 #define OCTTX_PACKET_LATER_SKIP 128 41 42 /* WQE descriptor */ 43 typedef union octtx_wqe_s { 44 uint64_t w[6]; 45 46 struct { 47 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN 48 struct { 49 uint64_t pknd : 6; 50 uint64_t rsvd0 : 10; 51 uint64_t style : 8; 52 uint64_t bufs : 8; 53 uint64_t chan : 12; 54 uint64_t apad : 3; 55 uint64_t rsvd1 : 1; 56 uint64_t aura : 12; 57 uint64_t rsvd2 : 4; 58 } w0; 59 60 struct { 61 uint64_t tag : 32; 62 uint64_t tt : 2; 63 uint64_t grp : 10; 64 uint64_t rsvd0 : 2; 65 uint64_t rsvd1 : 2; 66 uint64_t len : 16; 67 } w1; 68 69 struct { 70 uint64_t op_code : 8; 71 uint64_t err_lev : 3; 72 uint64_t raw : 1; 73 uint64_t l2m : 1; 74 uint64_t l2b : 1; 75 uint64_t l3m : 1; 76 uint64_t l3b : 1; 77 uint64_t l3fr : 1; 78 uint64_t pf1 : 1; 79 uint64_t pf2 : 1; 80 uint64_t pf3 : 1; 81 uint64_t pf4 : 1; 82 uint64_t sh : 1; 83 uint64_t vs : 1; 84 uint64_t vv : 1; 85 uint64_t rsvd0 : 8; 86 uint64_t lae : 1; 87 uint64_t lbty : 5; 88 uint64_t lcty : 5; 89 uint64_t ldty : 5; 90 uint64_t lety : 5; 91 uint64_t lfty : 5; 92 uint64_t lgty : 5; 93 uint64_t sw : 1; 94 } w2; 95 96 struct { 97 uint64_t addr; /* Byte addr of start-of-pkt */ 98 } w3; 99 100 struct { 101 uint64_t laptr : 8; 102 uint64_t lbptr : 8; 103 uint64_t lcptr : 8; 104 uint64_t ldprt : 8; 105 uint64_t leptr : 8; 106 uint64_t lfptr : 8; 107 uint64_t lgptr : 8; 108 uint64_t vlptr : 8; 109 } w4; 110 111 struct { 112 uint64_t rsvd0 : 47; 113 uint64_t dwd : 1; 114 uint64_t size : 16; 115 } w5; 116 #else 117 struct { 118 uint64_t rsvd2 : 4; 119 uint64_t aura : 12; 120 uint64_t rsvd1 : 1; 121 uint64_t apad : 3; 122 uint64_t chan : 12; 123 uint64_t bufs : 8; 124 uint64_t style : 8; 125 uint64_t rsvd0 : 10; 126 uint64_t pknd : 6; 127 } w0; 128 129 struct { 130 uint64_t len : 16; 131 uint64_t rsvd1 : 2; 132 uint64_t rsvd0 : 2; 133 uint64_t grp : 10; 134 uint64_t tt : 2; 135 uint64_t tag : 32; 136 } w1; 137 138 struct { 139 uint64_t sw : 1; 140 uint64_t lgty : 5; 141 uint64_t lfty : 5; 142 uint64_t lety : 5; 143 uint64_t ldty : 5; 144 uint64_t lcty : 5; 145 uint64_t lbty : 5; 146 uint64_t lae : 1; 147 uint64_t rsvd0 : 8; 148 uint64_t vv : 1; 149 uint64_t vs : 1; 150 uint64_t sh : 1; 151 uint64_t pf4 : 1; 152 uint64_t pf3 : 1; 153 uint64_t pf2 : 1; 154 uint64_t pf1 : 1; 155 uint64_t l3fr : 1; 156 uint64_t l3b : 1; 157 uint64_t l3m : 1; 158 uint64_t l2b : 1; 159 uint64_t l2m : 1; 160 uint64_t raw : 1; 161 uint64_t err_lev : 3; 162 uint64_t op_code : 8; 163 } w2; 164 165 struct { 166 uint64_t addr; /* Byte addr of start-of-pkt */ 167 } w3; 168 169 struct { 170 uint64_t vlptr : 8; 171 uint64_t lgptr : 8; 172 uint64_t lfptr : 8; 173 uint64_t leptr : 8; 174 uint64_t ldprt : 8; 175 uint64_t lcptr : 8; 176 uint64_t lbptr : 8; 177 uint64_t laptr : 8; 178 } w4; 179 #endif 180 } s; 181 182 } __rte_packed octtx_wqe_t; 183 184 enum occtx_pki_ltype_e { 185 OCCTX_PKI_LTYPE_NONE = 0, 186 OCCTX_PKI_LTYPE_ENET = 1, 187 OCCTX_PKI_LTYPE_VLAN = 2, 188 OCCTX_PKI_LTYPE_SNAP_PAYLD = 5, 189 OCCTX_PKI_LTYPE_ARP = 6, 190 OCCTX_PKI_LTYPE_RARP = 7, 191 OCCTX_PKI_LTYPE_IP4 = 8, 192 OCCTX_PKI_LTYPE_IP4_OPT = 9, 193 OCCTX_PKI_LTYPE_IP6 = 0xa, 194 OCCTX_PKI_LTYPE_IP6_OPT = 0xb, 195 OCCTX_PKI_LTYPE_IPSEC_ESP = 0xc, 196 OCCTX_PKI_LTYPE_IPFRAG = 0xd, 197 OCCTX_PKI_LTYPE_IPCOMP = 0xe, 198 OCCTX_PKI_LTYPE_TCP = 0x10, 199 OCCTX_PKI_LTYPE_UDP = 0x11, 200 OCCTX_PKI_LTYPE_SCTP = 0x12, 201 OCCTX_PKI_LTYPE_UDP_VXLAN = 0x13, 202 OCCTX_PKI_LTYPE_GRE = 0x14, 203 OCCTX_PKI_LTYPE_NVGRE = 0x15, 204 OCCTX_PKI_LTYPE_GTP = 0x16, 205 OCCTX_PKI_LTYPE_UDP_GENEVE = 0x17, 206 OCCTX_PKI_LTYPE_SW28 = 0x1c, 207 OCCTX_PKI_LTYPE_SW29 = 0x1d, 208 OCCTX_PKI_LTYPE_SW30 = 0x1e, 209 OCCTX_PKI_LTYPE_SW31 = 0x1f, 210 OCCTX_PKI_LTYPE_LAST 211 }; 212 213 enum lc_type_e { 214 LC_NONE = OCCTX_PKI_LTYPE_NONE, 215 LC_IPV4 = OCCTX_PKI_LTYPE_IP4, 216 LC_IPV4_OPT = OCCTX_PKI_LTYPE_IP4_OPT, 217 LC_IPV6 = OCCTX_PKI_LTYPE_IP6, 218 LC_IPV6_OPT = OCCTX_PKI_LTYPE_IP6_OPT, 219 }; 220 221 enum le_type_e { 222 LE_NONE = OCCTX_PKI_LTYPE_NONE, 223 }; 224 225 enum lf_type_e { 226 LF_NONE = OCCTX_PKI_LTYPE_NONE, 227 LF_IPSEC_ESP = OCCTX_PKI_LTYPE_IPSEC_ESP, 228 LF_IPFRAG = OCCTX_PKI_LTYPE_IPFRAG, 229 LF_IPCOMP = OCCTX_PKI_LTYPE_IPCOMP, 230 LF_TCP = OCCTX_PKI_LTYPE_TCP, 231 LF_UDP = OCCTX_PKI_LTYPE_UDP, 232 LF_GRE = OCCTX_PKI_LTYPE_GRE, 233 LF_UDP_GENEVE = OCCTX_PKI_LTYPE_UDP_GENEVE, 234 LF_UDP_VXLAN = OCCTX_PKI_LTYPE_UDP_VXLAN, 235 LF_NVGRE = OCCTX_PKI_LTYPE_NVGRE, 236 }; 237 #endif /* __OCTEONTX_PKI_VAR_H__ */ 238