1 /*- 2 * SPDX-License-Identifier: BSD-3-Clause AND BSD-2-Clause 3 * 4 * Copyright © 2013-2015 Freescale Semiconductor, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright notice, 11 * this list of conditions and the following disclaimer. 12 * 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * 3. Neither the name of the copyright holder nor the names of its 18 * contributors may be used to endorse or promote products derived from this 19 * software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 * 33 * Original source file obtained from: 34 * drivers/net/ethernet/freescale/dpaa2/dpkg.h 35 * 36 * Commit: 4c86114194e644b6da9107d75910635c9e87179e 37 * Repository: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git 38 */ 39 40 /* 41 * Copyright © 2021-2022 Dmitry Salychev 42 * 43 * Redistribution and use in source and binary forms, with or without 44 * modification, are permitted provided that the following conditions 45 * are met: 46 * 1. Redistributions of source code must retain the above copyright 47 * notice, this list of conditions and the following disclaimer. 48 * 2. Redistributions in binary form must reproduce the above copyright 49 * notice, this list of conditions and the following disclaimer in the 50 * documentation and/or other materials provided with the distribution. 51 * 52 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 55 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 62 * SUCH DAMAGE. 63 */ 64 65 #ifndef _DPAA2_NI_DPKG_H 66 #define _DPAA2_NI_DPKG_H 67 68 #define BIT(x) (1ul << (x)) 69 70 /** 71 * DPKG_NUM_OF_MASKS - Number of masks per key extraction 72 */ 73 #define DPKG_NUM_OF_MASKS 4 74 75 /** 76 * DPKG_MAX_NUM_OF_EXTRACTS - Number of extractions per key profile 77 */ 78 #define DPKG_MAX_NUM_OF_EXTRACTS 10 79 80 /** 81 * enum dpkg_extract_from_hdr_type - Selecting extraction by header types 82 * @DPKG_FROM_HDR: Extract selected bytes from header, by offset 83 * @DPKG_FROM_FIELD: Extract selected bytes from header, by offset from field 84 * @DPKG_FULL_FIELD: Extract a full field 85 */ 86 enum dpkg_extract_from_hdr_type { 87 DPKG_FROM_HDR = 0, 88 DPKG_FROM_FIELD = 1, 89 DPKG_FULL_FIELD = 2 90 }; 91 92 /** 93 * enum dpkg_extract_type - Enumeration for selecting extraction type 94 * @DPKG_EXTRACT_FROM_HDR: Extract from the header 95 * @DPKG_EXTRACT_FROM_DATA: Extract from data not in specific header 96 * @DPKG_EXTRACT_FROM_PARSE: Extract from parser-result; 97 * e.g. can be used to extract header existence; 98 * please refer to 'Parse Result definition' section in the parser BG 99 */ 100 enum dpkg_extract_type { 101 DPKG_EXTRACT_FROM_HDR = 0, 102 DPKG_EXTRACT_FROM_DATA = 1, 103 DPKG_EXTRACT_FROM_PARSE = 3 104 }; 105 106 /** 107 * struct dpkg_mask - A structure for defining a single extraction mask 108 * @mask: Byte mask for the extracted content 109 * @offset: Offset within the extracted content 110 */ 111 struct dpkg_mask { 112 uint8_t mask; 113 uint8_t offset; 114 }; 115 116 /* Protocol fields */ 117 118 /* Ethernet fields */ 119 #define NH_FLD_ETH_DA BIT(0) 120 #define NH_FLD_ETH_SA BIT(1) 121 #define NH_FLD_ETH_LENGTH BIT(2) 122 #define NH_FLD_ETH_TYPE BIT(3) 123 #define NH_FLD_ETH_FINAL_CKSUM BIT(4) 124 #define NH_FLD_ETH_PADDING BIT(5) 125 #define NH_FLD_ETH_ALL_FIELDS (BIT(6) - 1) 126 127 /* VLAN fields */ 128 #define NH_FLD_VLAN_VPRI BIT(0) 129 #define NH_FLD_VLAN_CFI BIT(1) 130 #define NH_FLD_VLAN_VID BIT(2) 131 #define NH_FLD_VLAN_LENGTH BIT(3) 132 #define NH_FLD_VLAN_TYPE BIT(4) 133 #define NH_FLD_VLAN_ALL_FIELDS (BIT(5) - 1) 134 135 #define NH_FLD_VLAN_TCI (NH_FLD_VLAN_VPRI | \ 136 NH_FLD_VLAN_CFI | \ 137 NH_FLD_VLAN_VID) 138 139 /* IP (generic) fields */ 140 #define NH_FLD_IP_VER BIT(0) 141 #define NH_FLD_IP_DSCP BIT(2) 142 #define NH_FLD_IP_ECN BIT(3) 143 #define NH_FLD_IP_PROTO BIT(4) 144 #define NH_FLD_IP_SRC BIT(5) 145 #define NH_FLD_IP_DST BIT(6) 146 #define NH_FLD_IP_TOS_TC BIT(7) 147 #define NH_FLD_IP_ID BIT(8) 148 #define NH_FLD_IP_ALL_FIELDS (BIT(9) - 1) 149 150 /* IPV4 fields */ 151 #define NH_FLD_IPV4_VER BIT(0) 152 #define NH_FLD_IPV4_HDR_LEN BIT(1) 153 #define NH_FLD_IPV4_TOS BIT(2) 154 #define NH_FLD_IPV4_TOTAL_LEN BIT(3) 155 #define NH_FLD_IPV4_ID BIT(4) 156 #define NH_FLD_IPV4_FLAG_D BIT(5) 157 #define NH_FLD_IPV4_FLAG_M BIT(6) 158 #define NH_FLD_IPV4_OFFSET BIT(7) 159 #define NH_FLD_IPV4_TTL BIT(8) 160 #define NH_FLD_IPV4_PROTO BIT(9) 161 #define NH_FLD_IPV4_CKSUM BIT(10) 162 #define NH_FLD_IPV4_SRC_IP BIT(11) 163 #define NH_FLD_IPV4_DST_IP BIT(12) 164 #define NH_FLD_IPV4_OPTS BIT(13) 165 #define NH_FLD_IPV4_OPTS_COUNT BIT(14) 166 #define NH_FLD_IPV4_ALL_FIELDS (BIT(15) - 1) 167 168 /* IPV6 fields */ 169 #define NH_FLD_IPV6_VER BIT(0) 170 #define NH_FLD_IPV6_TC BIT(1) 171 #define NH_FLD_IPV6_SRC_IP BIT(2) 172 #define NH_FLD_IPV6_DST_IP BIT(3) 173 #define NH_FLD_IPV6_NEXT_HDR BIT(4) 174 #define NH_FLD_IPV6_FL BIT(5) 175 #define NH_FLD_IPV6_HOP_LIMIT BIT(6) 176 #define NH_FLD_IPV6_ID BIT(7) 177 #define NH_FLD_IPV6_ALL_FIELDS (BIT(8) - 1) 178 179 /* ICMP fields */ 180 #define NH_FLD_ICMP_TYPE BIT(0) 181 #define NH_FLD_ICMP_CODE BIT(1) 182 #define NH_FLD_ICMP_CKSUM BIT(2) 183 #define NH_FLD_ICMP_ID BIT(3) 184 #define NH_FLD_ICMP_SQ_NUM BIT(4) 185 #define NH_FLD_ICMP_ALL_FIELDS (BIT(5) - 1) 186 187 /* IGMP fields */ 188 #define NH_FLD_IGMP_VERSION BIT(0) 189 #define NH_FLD_IGMP_TYPE BIT(1) 190 #define NH_FLD_IGMP_CKSUM BIT(2) 191 #define NH_FLD_IGMP_DATA BIT(3) 192 #define NH_FLD_IGMP_ALL_FIELDS (BIT(4) - 1) 193 194 /* TCP fields */ 195 #define NH_FLD_TCP_PORT_SRC BIT(0) 196 #define NH_FLD_TCP_PORT_DST BIT(1) 197 #define NH_FLD_TCP_SEQ BIT(2) 198 #define NH_FLD_TCP_ACK BIT(3) 199 #define NH_FLD_TCP_OFFSET BIT(4) 200 #define NH_FLD_TCP_FLAGS BIT(5) 201 #define NH_FLD_TCP_WINDOW BIT(6) 202 #define NH_FLD_TCP_CKSUM BIT(7) 203 #define NH_FLD_TCP_URGPTR BIT(8) 204 #define NH_FLD_TCP_OPTS BIT(9) 205 #define NH_FLD_TCP_OPTS_COUNT BIT(10) 206 #define NH_FLD_TCP_ALL_FIELDS (BIT(11) - 1) 207 208 /* UDP fields */ 209 #define NH_FLD_UDP_PORT_SRC BIT(0) 210 #define NH_FLD_UDP_PORT_DST BIT(1) 211 #define NH_FLD_UDP_LEN BIT(2) 212 #define NH_FLD_UDP_CKSUM BIT(3) 213 #define NH_FLD_UDP_ALL_FIELDS (BIT(4) - 1) 214 215 /* UDP-lite fields */ 216 #define NH_FLD_UDP_LITE_PORT_SRC BIT(0) 217 #define NH_FLD_UDP_LITE_PORT_DST BIT(1) 218 #define NH_FLD_UDP_LITE_ALL_FIELDS (BIT(2) - 1) 219 220 /* UDP-encap-ESP fields */ 221 #define NH_FLD_UDP_ENC_ESP_PORT_SRC BIT(0) 222 #define NH_FLD_UDP_ENC_ESP_PORT_DST BIT(1) 223 #define NH_FLD_UDP_ENC_ESP_LEN BIT(2) 224 #define NH_FLD_UDP_ENC_ESP_CKSUM BIT(3) 225 #define NH_FLD_UDP_ENC_ESP_SPI BIT(4) 226 #define NH_FLD_UDP_ENC_ESP_SEQUENCE_NUM BIT(5) 227 #define NH_FLD_UDP_ENC_ESP_ALL_FIELDS (BIT(6) - 1) 228 229 /* SCTP fields */ 230 #define NH_FLD_SCTP_PORT_SRC BIT(0) 231 #define NH_FLD_SCTP_PORT_DST BIT(1) 232 #define NH_FLD_SCTP_VER_TAG BIT(2) 233 #define NH_FLD_SCTP_CKSUM BIT(3) 234 #define NH_FLD_SCTP_ALL_FIELDS (BIT(4) - 1) 235 236 /* DCCP fields */ 237 #define NH_FLD_DCCP_PORT_SRC BIT(0) 238 #define NH_FLD_DCCP_PORT_DST BIT(1) 239 #define NH_FLD_DCCP_ALL_FIELDS (BIT(2) - 1) 240 241 /* IPHC fields */ 242 #define NH_FLD_IPHC_CID BIT(0) 243 #define NH_FLD_IPHC_CID_TYPE BIT(1) 244 #define NH_FLD_IPHC_HCINDEX BIT(2) 245 #define NH_FLD_IPHC_GEN BIT(3) 246 #define NH_FLD_IPHC_D_BIT BIT(4) 247 #define NH_FLD_IPHC_ALL_FIELDS (BIT(5) - 1) 248 249 /* SCTP fields */ 250 #define NH_FLD_SCTP_CHUNK_DATA_TYPE BIT(0) 251 #define NH_FLD_SCTP_CHUNK_DATA_FLAGS BIT(1) 252 #define NH_FLD_SCTP_CHUNK_DATA_LENGTH BIT(2) 253 #define NH_FLD_SCTP_CHUNK_DATA_TSN BIT(3) 254 #define NH_FLD_SCTP_CHUNK_DATA_STREAM_ID BIT(4) 255 #define NH_FLD_SCTP_CHUNK_DATA_STREAM_SQN BIT(5) 256 #define NH_FLD_SCTP_CHUNK_DATA_PAYLOAD_PID BIT(6) 257 #define NH_FLD_SCTP_CHUNK_DATA_UNORDERED BIT(7) 258 #define NH_FLD_SCTP_CHUNK_DATA_BEGGINING BIT(8) 259 #define NH_FLD_SCTP_CHUNK_DATA_END BIT(9) 260 #define NH_FLD_SCTP_CHUNK_DATA_ALL_FIELDS (BIT(10) - 1) 261 262 /* L2TPV2 fields */ 263 #define NH_FLD_L2TPV2_TYPE_BIT BIT(0) 264 #define NH_FLD_L2TPV2_LENGTH_BIT BIT(1) 265 #define NH_FLD_L2TPV2_SEQUENCE_BIT BIT(2) 266 #define NH_FLD_L2TPV2_OFFSET_BIT BIT(3) 267 #define NH_FLD_L2TPV2_PRIORITY_BIT BIT(4) 268 #define NH_FLD_L2TPV2_VERSION BIT(5) 269 #define NH_FLD_L2TPV2_LEN BIT(6) 270 #define NH_FLD_L2TPV2_TUNNEL_ID BIT(7) 271 #define NH_FLD_L2TPV2_SESSION_ID BIT(8) 272 #define NH_FLD_L2TPV2_NS BIT(9) 273 #define NH_FLD_L2TPV2_NR BIT(10) 274 #define NH_FLD_L2TPV2_OFFSET_SIZE BIT(11) 275 #define NH_FLD_L2TPV2_FIRST_BYTE BIT(12) 276 #define NH_FLD_L2TPV2_ALL_FIELDS (BIT(13) - 1) 277 278 /* L2TPV3 fields */ 279 #define NH_FLD_L2TPV3_CTRL_TYPE_BIT BIT(0) 280 #define NH_FLD_L2TPV3_CTRL_LENGTH_BIT BIT(1) 281 #define NH_FLD_L2TPV3_CTRL_SEQUENCE_BIT BIT(2) 282 #define NH_FLD_L2TPV3_CTRL_VERSION BIT(3) 283 #define NH_FLD_L2TPV3_CTRL_LENGTH BIT(4) 284 #define NH_FLD_L2TPV3_CTRL_CONTROL BIT(5) 285 #define NH_FLD_L2TPV3_CTRL_SENT BIT(6) 286 #define NH_FLD_L2TPV3_CTRL_RECV BIT(7) 287 #define NH_FLD_L2TPV3_CTRL_FIRST_BYTE BIT(8) 288 #define NH_FLD_L2TPV3_CTRL_ALL_FIELDS (BIT(9) - 1) 289 290 #define NH_FLD_L2TPV3_SESS_TYPE_BIT BIT(0) 291 #define NH_FLD_L2TPV3_SESS_VERSION BIT(1) 292 #define NH_FLD_L2TPV3_SESS_ID BIT(2) 293 #define NH_FLD_L2TPV3_SESS_COOKIE BIT(3) 294 #define NH_FLD_L2TPV3_SESS_ALL_FIELDS (BIT(4) - 1) 295 296 /* PPP fields */ 297 #define NH_FLD_PPP_PID BIT(0) 298 #define NH_FLD_PPP_COMPRESSED BIT(1) 299 #define NH_FLD_PPP_ALL_FIELDS (BIT(2) - 1) 300 301 /* PPPoE fields */ 302 #define NH_FLD_PPPOE_VER BIT(0) 303 #define NH_FLD_PPPOE_TYPE BIT(1) 304 #define NH_FLD_PPPOE_CODE BIT(2) 305 #define NH_FLD_PPPOE_SID BIT(3) 306 #define NH_FLD_PPPOE_LEN BIT(4) 307 #define NH_FLD_PPPOE_SESSION BIT(5) 308 #define NH_FLD_PPPOE_PID BIT(6) 309 #define NH_FLD_PPPOE_ALL_FIELDS (BIT(7) - 1) 310 311 /* PPP-Mux fields */ 312 #define NH_FLD_PPPMUX_PID BIT(0) 313 #define NH_FLD_PPPMUX_CKSUM BIT(1) 314 #define NH_FLD_PPPMUX_COMPRESSED BIT(2) 315 #define NH_FLD_PPPMUX_ALL_FIELDS (BIT(3) - 1) 316 317 /* PPP-Mux sub-frame fields */ 318 #define NH_FLD_PPPMUX_SUBFRM_PFF BIT(0) 319 #define NH_FLD_PPPMUX_SUBFRM_LXT BIT(1) 320 #define NH_FLD_PPPMUX_SUBFRM_LEN BIT(2) 321 #define NH_FLD_PPPMUX_SUBFRM_PID BIT(3) 322 #define NH_FLD_PPPMUX_SUBFRM_USE_PID BIT(4) 323 #define NH_FLD_PPPMUX_SUBFRM_ALL_FIELDS (BIT(5) - 1) 324 325 /* LLC fields */ 326 #define NH_FLD_LLC_DSAP BIT(0) 327 #define NH_FLD_LLC_SSAP BIT(1) 328 #define NH_FLD_LLC_CTRL BIT(2) 329 #define NH_FLD_LLC_ALL_FIELDS (BIT(3) - 1) 330 331 /* NLPID fields */ 332 #define NH_FLD_NLPID_NLPID BIT(0) 333 #define NH_FLD_NLPID_ALL_FIELDS (BIT(1) - 1) 334 335 /* SNAP fields */ 336 #define NH_FLD_SNAP_OUI BIT(0) 337 #define NH_FLD_SNAP_PID BIT(1) 338 #define NH_FLD_SNAP_ALL_FIELDS (BIT(2) - 1) 339 340 /* LLC SNAP fields */ 341 #define NH_FLD_LLC_SNAP_TYPE BIT(0) 342 #define NH_FLD_LLC_SNAP_ALL_FIELDS (BIT(1) - 1) 343 344 /* ARP fields */ 345 #define NH_FLD_ARP_HTYPE BIT(0) 346 #define NH_FLD_ARP_PTYPE BIT(1) 347 #define NH_FLD_ARP_HLEN BIT(2) 348 #define NH_FLD_ARP_PLEN BIT(3) 349 #define NH_FLD_ARP_OPER BIT(4) 350 #define NH_FLD_ARP_SHA BIT(5) 351 #define NH_FLD_ARP_SPA BIT(6) 352 #define NH_FLD_ARP_THA BIT(7) 353 #define NH_FLD_ARP_TPA BIT(8) 354 #define NH_FLD_ARP_ALL_FIELDS (BIT(9) - 1) 355 356 /* RFC2684 fields */ 357 #define NH_FLD_RFC2684_LLC BIT(0) 358 #define NH_FLD_RFC2684_NLPID BIT(1) 359 #define NH_FLD_RFC2684_OUI BIT(2) 360 #define NH_FLD_RFC2684_PID BIT(3) 361 #define NH_FLD_RFC2684_VPN_OUI BIT(4) 362 #define NH_FLD_RFC2684_VPN_IDX BIT(5) 363 #define NH_FLD_RFC2684_ALL_FIELDS (BIT(6) - 1) 364 365 /* User defined fields */ 366 #define NH_FLD_USER_DEFINED_SRCPORT BIT(0) 367 #define NH_FLD_USER_DEFINED_PCDID BIT(1) 368 #define NH_FLD_USER_DEFINED_ALL_FIELDS (BIT(2) - 1) 369 370 /* Payload fields */ 371 #define NH_FLD_PAYLOAD_BUFFER BIT(0) 372 #define NH_FLD_PAYLOAD_SIZE BIT(1) 373 #define NH_FLD_MAX_FRM_SIZE BIT(2) 374 #define NH_FLD_MIN_FRM_SIZE BIT(3) 375 #define NH_FLD_PAYLOAD_TYPE BIT(4) 376 #define NH_FLD_FRAME_SIZE BIT(5) 377 #define NH_FLD_PAYLOAD_ALL_FIELDS (BIT(6) - 1) 378 379 /* GRE fields */ 380 #define NH_FLD_GRE_TYPE BIT(0) 381 #define NH_FLD_GRE_ALL_FIELDS (BIT(1) - 1) 382 383 /* MINENCAP fields */ 384 #define NH_FLD_MINENCAP_SRC_IP BIT(0) 385 #define NH_FLD_MINENCAP_DST_IP BIT(1) 386 #define NH_FLD_MINENCAP_TYPE BIT(2) 387 #define NH_FLD_MINENCAP_ALL_FIELDS (BIT(3) - 1) 388 389 /* IPSEC AH fields */ 390 #define NH_FLD_IPSEC_AH_SPI BIT(0) 391 #define NH_FLD_IPSEC_AH_NH BIT(1) 392 #define NH_FLD_IPSEC_AH_ALL_FIELDS (BIT(2) - 1) 393 394 /* IPSEC ESP fields */ 395 #define NH_FLD_IPSEC_ESP_SPI BIT(0) 396 #define NH_FLD_IPSEC_ESP_SEQUENCE_NUM BIT(1) 397 #define NH_FLD_IPSEC_ESP_ALL_FIELDS (BIT(2) - 1) 398 399 /* MPLS fields */ 400 #define NH_FLD_MPLS_LABEL_STACK BIT(0) 401 #define NH_FLD_MPLS_LABEL_STACK_ALL_FIELDS (BIT(1) - 1) 402 403 /* MACSEC fields */ 404 #define NH_FLD_MACSEC_SECTAG BIT(0) 405 #define NH_FLD_MACSEC_ALL_FIELDS (BIT(1) - 1) 406 407 /* GTP fields */ 408 #define NH_FLD_GTP_TEID BIT(0) 409 410 /* Supported protocols */ 411 enum net_prot { 412 NET_PROT_NONE = 0, 413 NET_PROT_PAYLOAD, 414 NET_PROT_ETH, 415 NET_PROT_VLAN, 416 NET_PROT_IPV4, 417 NET_PROT_IPV6, 418 NET_PROT_IP, 419 NET_PROT_TCP, 420 NET_PROT_UDP, 421 NET_PROT_UDP_LITE, 422 NET_PROT_IPHC, 423 NET_PROT_SCTP, 424 NET_PROT_SCTP_CHUNK_DATA, 425 NET_PROT_PPPOE, 426 NET_PROT_PPP, 427 NET_PROT_PPPMUX, 428 NET_PROT_PPPMUX_SUBFRM, 429 NET_PROT_L2TPV2, 430 NET_PROT_L2TPV3_CTRL, 431 NET_PROT_L2TPV3_SESS, 432 NET_PROT_LLC, 433 NET_PROT_LLC_SNAP, 434 NET_PROT_NLPID, 435 NET_PROT_SNAP, 436 NET_PROT_MPLS, 437 NET_PROT_IPSEC_AH, 438 NET_PROT_IPSEC_ESP, 439 NET_PROT_UDP_ENC_ESP, /* RFC 3948 */ 440 NET_PROT_MACSEC, 441 NET_PROT_GRE, 442 NET_PROT_MINENCAP, 443 NET_PROT_DCCP, 444 NET_PROT_ICMP, 445 NET_PROT_IGMP, 446 NET_PROT_ARP, 447 NET_PROT_CAPWAP_DATA, 448 NET_PROT_CAPWAP_CTRL, 449 NET_PROT_RFC2684, 450 NET_PROT_ICMPV6, 451 NET_PROT_FCOE, 452 NET_PROT_FIP, 453 NET_PROT_ISCSI, 454 NET_PROT_GTP, 455 NET_PROT_USER_DEFINED_L2, 456 NET_PROT_USER_DEFINED_L3, 457 NET_PROT_USER_DEFINED_L4, 458 NET_PROT_USER_DEFINED_L5, 459 NET_PROT_USER_DEFINED_SHIM1, 460 NET_PROT_USER_DEFINED_SHIM2, 461 462 NET_PROT_DUMMY_LAST 463 }; 464 465 /** 466 * struct dpkg_extract - A structure for defining a single extraction 467 * @type: Determines how the union below is interpreted: 468 * DPKG_EXTRACT_FROM_HDR: selects 'from_hdr'; 469 * DPKG_EXTRACT_FROM_DATA: selects 'from_data'; 470 * DPKG_EXTRACT_FROM_PARSE: selects 'from_parse' 471 * @extract: Selects extraction method 472 * @extract.from_hdr: Used when 'type = DPKG_EXTRACT_FROM_HDR' 473 * @extract.from_data: Used when 'type = DPKG_EXTRACT_FROM_DATA' 474 * @extract.from_parse: Used when 'type = DPKG_EXTRACT_FROM_PARSE' 475 * @extract.from_hdr.prot: Any of the supported headers 476 * @extract.from_hdr.type: Defines the type of header extraction: 477 * DPKG_FROM_HDR: use size & offset below; 478 * DPKG_FROM_FIELD: use field, size and offset below; 479 * DPKG_FULL_FIELD: use field below 480 * @extract.from_hdr.field: One of the supported fields (NH_FLD_) 481 * @extract.from_hdr.size: Size in bytes 482 * @extract.from_hdr.offset: Byte offset 483 * @extract.from_hdr.hdr_index: Clear for cases not listed below; 484 * Used for protocols that may have more than a single 485 * header, 0 indicates an outer header; 486 * Supported protocols (possible values): 487 * NET_PROT_VLAN (0, HDR_INDEX_LAST); 488 * NET_PROT_MPLS (0, 1, HDR_INDEX_LAST); 489 * NET_PROT_IP(0, HDR_INDEX_LAST); 490 * NET_PROT_IPv4(0, HDR_INDEX_LAST); 491 * NET_PROT_IPv6(0, HDR_INDEX_LAST); 492 * @extract.from_data.size: Size in bytes 493 * @extract.from_data.offset: Byte offset 494 * @extract.from_parse.size: Size in bytes 495 * @extract.from_parse.offset: Byte offset 496 * @num_of_byte_masks: Defines the number of valid entries in the array below; 497 * This is also the number of bytes to be used as masks 498 * @masks: Masks parameters 499 */ 500 struct dpkg_extract { 501 enum dpkg_extract_type type; 502 union { 503 struct { 504 enum net_prot prot; 505 enum dpkg_extract_from_hdr_type type; 506 uint32_t field; 507 uint8_t size; 508 uint8_t offset; 509 uint8_t hdr_index; 510 } from_hdr; 511 struct { 512 uint8_t size; 513 uint8_t offset; 514 } from_data; 515 struct { 516 uint8_t size; 517 uint8_t offset; 518 } from_parse; 519 } extract; 520 521 uint8_t num_of_byte_masks; 522 struct dpkg_mask masks[DPKG_NUM_OF_MASKS]; 523 }; 524 525 /** 526 * struct dpkg_profile_cfg - A structure for defining a full Key Generation 527 * profile (rule) 528 * @num_extracts: Defines the number of valid entries in the array below 529 * @extracts: Array of required extractions 530 */ 531 struct dpkg_profile_cfg { 532 uint8_t num_extracts; 533 struct dpkg_extract extracts[DPKG_MAX_NUM_OF_EXTRACTS]; 534 }; 535 536 #endif /* _DPAA2_NI_DPKG_H */ 537