├── .gitignore ├── App ├── App.cpp ├── App.h ├── ip_pipeline │ ├── Makefile │ ├── app.h │ ├── config_check.c │ ├── config_parse.c │ ├── config_parse_tm.c │ ├── cpu_core_map.c │ ├── cpu_core_map.h │ ├── init.c │ ├── main.c │ ├── parser.c │ ├── parser.h │ ├── pipeline.h │ ├── pipeline │ │ ├── hash_func.h │ │ ├── pipeline_actions_common.h │ │ ├── pipeline_common_be.c │ │ ├── pipeline_common_be.h │ │ ├── pipeline_common_fe.c │ │ ├── pipeline_common_fe.h │ │ ├── pipeline_firewall.c │ │ ├── pipeline_firewall.h │ │ ├── pipeline_firewall_be.c │ │ ├── pipeline_firewall_be.h │ │ ├── pipeline_flow_actions.c │ │ ├── pipeline_flow_actions.h │ │ ├── pipeline_flow_actions_be.c │ │ ├── pipeline_flow_actions_be.h │ │ ├── pipeline_flow_classification.c │ │ ├── pipeline_flow_classification.h │ │ ├── pipeline_flow_classification_be.c │ │ ├── pipeline_flow_classification_be.h │ │ ├── pipeline_master.c │ │ ├── pipeline_master.h │ │ ├── pipeline_master_be.c │ │ ├── pipeline_master_be.h │ │ ├── pipeline_passthrough.c │ │ ├── pipeline_passthrough.h │ │ ├── pipeline_passthrough_be.c │ │ ├── pipeline_passthrough_be.h │ │ ├── pipeline_routing.c │ │ ├── pipeline_routing.h │ │ ├── pipeline_routing_be.c │ │ └── pipeline_routing_be.h │ ├── pipeline_be.h │ ├── sgx_headers.h │ ├── thread.c │ ├── thread.h │ ├── thread_fe.c │ └── thread_fe.h └── ocall.c ├── Enclave ├── Enclave.config.xml ├── Enclave.cpp ├── Enclave.edl ├── Enclave.h ├── Enclave.lds ├── Enclave_private.pem ├── dpdk │ ├── dpdk.edl │ ├── dpdk_proxy_type.h │ ├── librte_acl │ │ ├── Makefile │ │ ├── acl.h │ │ ├── acl_bld.c │ │ ├── acl_gen.c │ │ ├── acl_run.h │ │ ├── acl_run_avx2.c │ │ ├── acl_run_avx2.h │ │ ├── acl_run_scalar.c │ │ ├── acl_run_sse.c │ │ ├── acl_run_sse.h │ │ ├── acl_vect.h │ │ ├── rte_acl.c │ │ ├── rte_acl.h │ │ ├── rte_acl_osdep.h │ │ ├── rte_acl_version.map │ │ ├── tb_mem.c │ │ └── tb_mem.h │ ├── librte_eal │ │ ├── eal.c │ │ ├── eal_common_errno.c │ │ ├── eal_common_log.c │ │ ├── eal_common_memory.c │ │ ├── eal_common_memzone.c │ │ ├── eal_common_tailqs.c │ │ ├── eal_debug.c │ │ ├── eal_internal_cfg.h │ │ ├── eal_private.h │ │ ├── rte_globals.h │ │ └── rte_malloc.c │ ├── librte_mbuf │ │ └── rte_mbuf.c │ ├── librte_mempool │ │ ├── rte_mempool.c │ │ ├── rte_mempool_ops.c │ │ └── rte_mempool_ring.c │ ├── librte_pipeline │ │ └── rte_pipeline.c │ ├── librte_port │ │ ├── rte_port.h │ │ ├── rte_port_ring.c │ │ ├── rte_port_ring.h │ │ ├── rte_port_source_sink.c │ │ └── rte_port_source_sink.h │ ├── librte_ring │ │ └── rte_ring.c │ └── librte_table │ │ └── rte_table_acl.c ├── firewall_thread.c ├── include │ ├── dpdk │ │ ├── cmdline.h │ │ ├── cmdline_cirbuf.h │ │ ├── cmdline_parse.h │ │ ├── cmdline_parse_num.h │ │ ├── cmdline_parse_string.h │ │ ├── cmdline_rdline.h │ │ ├── cmdline_vt100.h │ │ ├── exec-env │ │ │ ├── rte_dom0_common.h │ │ │ └── rte_interrupts.h │ │ ├── generic │ │ │ ├── rte_atomic.h │ │ │ ├── rte_byteorder.h │ │ │ ├── rte_cpuflags.h │ │ │ ├── rte_cycles.h │ │ │ ├── rte_prefetch.h │ │ │ ├── rte_rwlock.h │ │ │ ├── rte_spinlock.h │ │ │ └── rte_vect.h │ │ ├── rte_acl.h │ │ ├── rte_acl_osdep.h │ │ ├── rte_atomic.h │ │ ├── rte_atomic_32.h │ │ ├── rte_atomic_64.h │ │ ├── rte_bitmap.h │ │ ├── rte_branch_prediction.h │ │ ├── rte_bus.h │ │ ├── rte_byteorder.h │ │ ├── rte_byteorder_32.h │ │ ├── rte_byteorder_64.h │ │ ├── rte_common.h │ │ ├── rte_config.h │ │ ├── rte_cpuflags.h │ │ ├── rte_cycles.h │ │ ├── rte_debug.h │ │ ├── rte_dev.h │ │ ├── rte_eal.h │ │ ├── rte_eal_memconfig.h │ │ ├── rte_errno.h │ │ ├── rte_eth_ctrl.h │ │ ├── rte_ethdev.h │ │ ├── rte_ether.h │ │ ├── rte_hexdump.h │ │ ├── rte_interrupts.h │ │ ├── rte_ip.h │ │ ├── rte_launch.h │ │ ├── rte_lcore.h │ │ ├── rte_log.h │ │ ├── rte_malloc.h │ │ ├── rte_malloc_heap.h │ │ ├── rte_mbuf.h │ │ ├── rte_mbuf_ptype.h │ │ ├── rte_memcpy.h │ │ ├── rte_memory.h │ │ ├── rte_mempool.h │ │ ├── rte_memzone.h │ │ ├── rte_meter.h │ │ ├── rte_pci_dev_feature_defs.h │ │ ├── rte_per_lcore.h │ │ ├── rte_pipeline.h │ │ ├── rte_port.h │ │ ├── rte_port_ethdev.h │ │ ├── rte_port_fd.h │ │ ├── rte_port_frag.h │ │ ├── rte_port_ras.h │ │ ├── rte_port_ring.h │ │ ├── rte_port_sched.h │ │ ├── rte_port_source_sink.h │ │ ├── rte_prefetch.h │ │ ├── rte_random.h │ │ ├── rte_ring.h │ │ ├── rte_rtm.h │ │ ├── rte_rwlock.h │ │ ├── rte_sched.h │ │ ├── rte_spinlock.h │ │ ├── rte_string_fns.h │ │ ├── rte_table.h │ │ ├── rte_table_acl.h │ │ ├── rte_tailq.h │ │ ├── rte_tcp.h │ │ └── rte_vect.h │ └── system │ │ ├── adxintrin.h │ │ ├── ammintrin.h │ │ ├── avx2intrin.h │ │ ├── avx512bwintrin.h │ │ ├── avx512cdintrin.h │ │ ├── avx512dqintrin.h │ │ ├── avx512erintrin.h │ │ ├── avx512fintrin.h │ │ ├── avx512ifmaintrin.h │ │ ├── avx512ifmavlintrin.h │ │ ├── avx512pfintrin.h │ │ ├── avx512vbmiintrin.h │ │ ├── avx512vbmivlintrin.h │ │ ├── avx512vlbwintrin.h │ │ ├── avx512vldqintrin.h │ │ ├── avx512vlintrin.h │ │ ├── avxintrin.h │ │ ├── bmi2intrin.h │ │ ├── bmiintrin.h │ │ ├── bmmintrin.h │ │ ├── clflushoptintrin.h │ │ ├── clwbintrin.h │ │ ├── emmintrin.h │ │ ├── f16cintrin.h │ │ ├── fma4intrin.h │ │ ├── fmaintrin.h │ │ ├── fxsrintrin.h │ │ ├── ia32intrin.h │ │ ├── immintrin.h │ │ ├── lwpintrin.h │ │ ├── lzcntintrin.h │ │ ├── mm3dnow.h │ │ ├── mm_malloc.h │ │ ├── mmintrin.h │ │ ├── mwaitxintrin.h │ │ ├── nmmintrin.h │ │ ├── pcommitintrin.h │ │ ├── pmmintrin.h │ │ ├── popcntintrin.h │ │ ├── prfchwintrin.h │ │ ├── rdseedintrin.h │ │ ├── rtmintrin.h │ │ ├── shaintrin.h │ │ ├── smmintrin.h │ │ ├── sys │ │ └── queue.h │ │ ├── tbmintrin.h │ │ ├── termios.h │ │ ├── tmmintrin.h │ │ ├── wmmintrin.h │ │ ├── x86intrin.h │ │ ├── xmmintrin.h │ │ ├── xopintrin.h │ │ ├── xsavecintrin.h │ │ ├── xsaveintrin.h │ │ ├── xsaveoptintrin.h │ │ ├── xsavesintrin.h │ │ └── xtestintrin.h ├── io │ ├── stdio.c │ └── stdio.h ├── ip_pipeline │ ├── count_min_sketch.c │ ├── count_min_sketch.h │ ├── full_copy.c │ ├── full_copy.h │ ├── header_copy.c │ ├── header_copy.h │ ├── pipeline_common_be.c │ ├── pipeline_common_be.h │ ├── pipeline_firewall_be.c │ └── pipeline_firewall_be.h ├── net │ └── in.h └── proxy_type.h ├── LICENSE ├── Makefile ├── README.md └── config ├── firewall.cfg ├── firewall.sh ├── gen-firewall-rules.py ├── gen-random-firewall-rules.py ├── import-firewall-rules.sh └── sgx_firewall.cfg /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.swp 3 | *.so 4 | *.out 5 | *.txt 6 | .config_* 7 | App/Enclave_u.* 8 | Enclave/Enclave_t.* 9 | build/ 10 | gen/ 11 | firewall_sgx 12 | firewall_native 13 | -------------------------------------------------------------------------------- /App/App.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011-2017 Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in 12 | * the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Intel Corporation nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | */ 31 | 32 | 33 | #ifndef _APP_H_ 34 | #define _APP_H_ 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #include "sgx_error.h" /* sgx_status_t */ 42 | #include "sgx_eid.h" /* sgx_enclave_id_t */ 43 | #include "Enclave_u.h" 44 | 45 | #ifndef TRUE 46 | # define TRUE 1 47 | #endif 48 | 49 | #ifndef FALSE 50 | # define FALSE 0 51 | #endif 52 | 53 | # define TOKEN_FILENAME "enclave.token" 54 | # define ENCLAVE_FILENAME "enclave.signed.so" 55 | 56 | extern sgx_enclave_id_t global_eid; /* global enclave id */ 57 | 58 | #define MAKE_ECALL(FUNC, ecall_ret, args...) \ 59 | do { \ 60 | sgx_status_t sgx_ret = ecall_ ## FUNC (global_eid, ecall_ret, args); \ 61 | if (sgx_ret != SGX_SUCCESS) { \ 62 | print_error_message(sgx_ret); \ 63 | rte_panic("ecall failed in ecall_%s\n", # FUNC); \ 64 | } \ 65 | } while(0) 66 | 67 | #if defined(__cplusplus) 68 | extern "C" { 69 | #endif 70 | 71 | int app_main(int argc, char **argv); 72 | void print_error_message(sgx_status_t ret); 73 | 74 | #if defined(__cplusplus) 75 | } 76 | #endif 77 | 78 | #endif /* !_APP_H_ */ 79 | -------------------------------------------------------------------------------- /App/ip_pipeline/cpu_core_map.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_CPU_CORE_MAP_H__ 35 | #define __INCLUDE_CPU_CORE_MAP_H__ 36 | 37 | #include 38 | 39 | #include 40 | 41 | struct cpu_core_map; 42 | 43 | struct cpu_core_map * 44 | cpu_core_map_init(uint32_t n_max_sockets, 45 | uint32_t n_max_cores_per_socket, 46 | uint32_t n_max_ht_per_core, 47 | uint32_t eal_initialized); 48 | 49 | uint32_t 50 | cpu_core_map_get_n_sockets(struct cpu_core_map *map); 51 | 52 | uint32_t 53 | cpu_core_map_get_n_cores_per_socket(struct cpu_core_map *map); 54 | 55 | uint32_t 56 | cpu_core_map_get_n_ht_per_core(struct cpu_core_map *map); 57 | 58 | int 59 | cpu_core_map_get_lcore_id(struct cpu_core_map *map, 60 | uint32_t socket_id, 61 | uint32_t core_id, 62 | uint32_t ht_id); 63 | 64 | void cpu_core_map_print(struct cpu_core_map *map); 65 | 66 | void 67 | cpu_core_map_free(struct cpu_core_map *map); 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /App/ip_pipeline/main.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #include "app.h" 35 | 36 | static struct app_params app; 37 | 38 | #ifdef ENABLE_SGX 39 | int 40 | app_main(int argc, char **argv) 41 | #else 42 | int 43 | main(int argc, char **argv) 44 | #endif 45 | { 46 | rte_openlog_stream(stderr); 47 | 48 | printf("APP_PIPELINE_FIREWALL_MAX_RULES_IN_FILE = %u\n", \ 49 | APP_PIPELINE_FIREWALL_MAX_RULES_IN_FILE); 50 | 51 | /* Config */ 52 | app_config_init(&app); 53 | 54 | app_config_args(&app, argc, argv); 55 | 56 | app_config_preproc(&app); 57 | 58 | app_config_parse(&app, app.parser_file); 59 | 60 | app_config_check(&app); 61 | 62 | /* Init */ 63 | app_init(&app); 64 | 65 | /* Run-time */ 66 | rte_eal_mp_remote_launch( 67 | app_thread, 68 | (void *) &app, 69 | CALL_MASTER); 70 | 71 | return 0; 72 | } 73 | -------------------------------------------------------------------------------- /App/ip_pipeline/parser.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_PARSER_H__ 35 | #define __INCLUDE_PARSER_H__ 36 | 37 | #include 38 | 39 | #include 40 | #include 41 | 42 | #define PARSE_DELIMITER " \f\n\r\t\v" 43 | 44 | #define skip_white_spaces(pos) \ 45 | ({ \ 46 | __typeof__(pos) _p = (pos); \ 47 | for ( ; isspace(*_p); _p++) \ 48 | ; \ 49 | _p; \ 50 | }) 51 | 52 | static inline size_t 53 | skip_digits(const char *src) 54 | { 55 | size_t i; 56 | 57 | for (i = 0; isdigit(src[i]); i++) 58 | ; 59 | 60 | return i; 61 | } 62 | 63 | int parser_read_arg_bool(const char *p); 64 | 65 | int parser_read_uint64(uint64_t *value, const char *p); 66 | int parser_read_uint32(uint32_t *value, const char *p); 67 | int parser_read_uint16(uint16_t *value, const char *p); 68 | int parser_read_uint8(uint8_t *value, const char *p); 69 | 70 | int parser_read_uint64_hex(uint64_t *value, const char *p); 71 | int parser_read_uint32_hex(uint32_t *value, const char *p); 72 | int parser_read_uint16_hex(uint16_t *value, const char *p); 73 | int parser_read_uint8_hex(uint8_t *value, const char *p); 74 | 75 | int parse_hex_string(char *src, uint8_t *dst, uint32_t *size); 76 | 77 | int parse_ipv4_addr(const char *token, struct in_addr *ipv4); 78 | int parse_ipv6_addr(const char *token, struct in6_addr *ipv6); 79 | int parse_mac_addr(const char *token, struct ether_addr *addr); 80 | int parse_mpls_labels(char *string, uint32_t *labels, uint32_t *n_labels); 81 | 82 | int parse_tokenize_string(char *string, char *tokens[], uint32_t *n_tokens); 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /App/ip_pipeline/pipeline.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_PIPELINE_H__ 35 | #define __INCLUDE_PIPELINE_H__ 36 | 37 | #include 38 | 39 | #include "pipeline_be.h" 40 | 41 | /* 42 | * Pipeline type front-end operations 43 | */ 44 | 45 | typedef void* (*pipeline_fe_op_init)(struct pipeline_params *params, 46 | void *arg); 47 | 48 | typedef int (*pipeline_fe_op_post_init)(void *pipeline); 49 | 50 | typedef int (*pipeline_fe_op_free)(void *pipeline); 51 | 52 | typedef int (*pipeline_fe_op_track)(struct pipeline_params *params, 53 | uint32_t port_in, 54 | uint32_t *port_out); 55 | 56 | struct pipeline_fe_ops { 57 | pipeline_fe_op_init f_init; 58 | pipeline_fe_op_post_init f_post_init; 59 | pipeline_fe_op_free f_free; 60 | pipeline_fe_op_track f_track; 61 | cmdline_parse_ctx_t *cmds; 62 | }; 63 | 64 | /* 65 | * Pipeline type 66 | */ 67 | 68 | struct pipeline_type { 69 | const char *name; 70 | 71 | /* pipeline back-end */ 72 | struct pipeline_be_ops *be_ops; 73 | 74 | /* pipeline front-end */ 75 | struct pipeline_fe_ops *fe_ops; 76 | }; 77 | 78 | static inline uint32_t 79 | pipeline_type_cmds_count(struct pipeline_type *ptype) 80 | { 81 | cmdline_parse_ctx_t *cmds; 82 | uint32_t n_cmds; 83 | 84 | if (ptype->fe_ops == NULL) 85 | return 0; 86 | 87 | cmds = ptype->fe_ops->cmds; 88 | if (cmds == NULL) 89 | return 0; 90 | 91 | for (n_cmds = 0; cmds[n_cmds]; n_cmds++); 92 | 93 | return n_cmds; 94 | } 95 | 96 | int 97 | parse_pipeline_core(uint32_t *socket, 98 | uint32_t *core, 99 | uint32_t *ht, 100 | const char *entry); 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /App/ip_pipeline/pipeline/pipeline_firewall.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_PIPELINE_FIREWALL_H__ 35 | #define __INCLUDE_PIPELINE_FIREWALL_H__ 36 | 37 | #include "pipeline.h" 38 | #include "pipeline_firewall_be.h" 39 | 40 | int 41 | app_pipeline_firewall_add_rule(struct app_params *app, 42 | uint32_t pipeline_id, 43 | struct pipeline_firewall_key *key, 44 | uint32_t priority, 45 | uint32_t port_id); 46 | 47 | int 48 | app_pipeline_firewall_delete_rule(struct app_params *app, 49 | uint32_t pipeline_id, 50 | struct pipeline_firewall_key *key); 51 | 52 | int 53 | app_pipeline_firewall_add_bulk(struct app_params *app, 54 | uint32_t pipeline_id, 55 | struct pipeline_firewall_key *keys, 56 | uint32_t n_keys, 57 | uint32_t *priorities, 58 | uint32_t *port_ids); 59 | 60 | int 61 | app_pipeline_firewall_delete_bulk(struct app_params *app, 62 | uint32_t pipeline_id, 63 | struct pipeline_firewall_key *keys, 64 | uint32_t n_keys); 65 | 66 | int 67 | app_pipeline_firewall_add_default_rule(struct app_params *app, 68 | uint32_t pipeline_id, 69 | uint32_t port_id); 70 | 71 | int 72 | app_pipeline_firewall_delete_default_rule(struct app_params *app, 73 | uint32_t pipeline_id); 74 | 75 | #ifndef APP_PIPELINE_FIREWALL_MAX_RULES_IN_FILE 76 | #define APP_PIPELINE_FIREWALL_MAX_RULES_IN_FILE 65536 77 | #endif 78 | 79 | int 80 | app_pipeline_firewall_load_file(char *filename, 81 | struct pipeline_firewall_key *keys, 82 | uint32_t *priorities, 83 | uint32_t *port_ids, 84 | uint32_t *n_keys, 85 | uint32_t *line); 86 | 87 | extern struct pipeline_type pipeline_firewall; 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /App/ip_pipeline/pipeline/pipeline_flow_actions.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_PIPELINE_FLOW_ACTIONS_H__ 35 | #define __INCLUDE_PIPELINE_FLOW_ACTIONS_H__ 36 | 37 | #include 38 | 39 | #include "pipeline.h" 40 | #include "pipeline_flow_actions_be.h" 41 | 42 | int 43 | app_pipeline_fa_flow_config(struct app_params *app, 44 | uint32_t pipeline_id, 45 | uint32_t flow_id, 46 | uint32_t meter_update_mask, 47 | uint32_t policer_update_mask, 48 | uint32_t port_update, 49 | struct pipeline_fa_flow_params *params); 50 | 51 | int 52 | app_pipeline_fa_flow_config_bulk(struct app_params *app, 53 | uint32_t pipeline_id, 54 | uint32_t *flow_id, 55 | uint32_t n_flows, 56 | uint32_t meter_update_mask, 57 | uint32_t policer_update_mask, 58 | uint32_t port_update, 59 | struct pipeline_fa_flow_params *params); 60 | 61 | int 62 | app_pipeline_fa_dscp_config(struct app_params *app, 63 | uint32_t pipeline_id, 64 | uint32_t dscp, 65 | uint32_t traffic_class, 66 | enum rte_meter_color color); 67 | 68 | int 69 | app_pipeline_fa_flow_policer_stats_read(struct app_params *app, 70 | uint32_t pipeline_id, 71 | uint32_t flow_id, 72 | uint32_t policer_id, 73 | int clear, 74 | struct pipeline_fa_policer_stats *stats); 75 | 76 | #ifndef APP_PIPELINE_FA_MAX_RECORDS_IN_FILE 77 | #define APP_PIPELINE_FA_MAX_RECORDS_IN_FILE 65536 78 | #endif 79 | 80 | int 81 | app_pipeline_fa_load_file(char *filename, 82 | uint32_t *flow_ids, 83 | struct pipeline_fa_flow_params *p, 84 | uint32_t *n_flows, 85 | uint32_t *line); 86 | 87 | extern struct pipeline_type pipeline_flow_actions; 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /App/ip_pipeline/pipeline/pipeline_master.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #include "pipeline_master.h" 35 | #include "pipeline_master_be.h" 36 | 37 | static struct pipeline_fe_ops pipeline_master_fe_ops = { 38 | .f_init = NULL, 39 | .f_post_init = NULL, 40 | .f_free = NULL, 41 | .f_track = NULL, 42 | .cmds = NULL, 43 | }; 44 | 45 | struct pipeline_type pipeline_master = { 46 | .name = "MASTER", 47 | .be_ops = &pipeline_master_be_ops, 48 | .fe_ops = &pipeline_master_fe_ops, 49 | }; 50 | -------------------------------------------------------------------------------- /App/ip_pipeline/pipeline/pipeline_master.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_PIPELINE_MASTER_H__ 35 | #define __INCLUDE_PIPELINE_MASTER_H__ 36 | 37 | #include "pipeline.h" 38 | 39 | extern struct pipeline_type pipeline_master; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /App/ip_pipeline/pipeline/pipeline_master_be.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_PIPELINE_MASTER_BE_H__ 35 | #define __INCLUDE_PIPELINE_MASTER_BE_H__ 36 | 37 | #include "pipeline_common_be.h" 38 | 39 | extern struct pipeline_be_ops pipeline_master_be_ops; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /App/ip_pipeline/pipeline/pipeline_passthrough.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #include "pipeline_passthrough.h" 35 | #include "pipeline_passthrough_be.h" 36 | 37 | static int 38 | app_pipeline_passthrough_track(struct pipeline_params *p, 39 | uint32_t port_in, 40 | uint32_t *port_out) 41 | { 42 | struct pipeline_passthrough_params pp; 43 | int status; 44 | 45 | /* Check input arguments */ 46 | if ((p == NULL) || 47 | (port_in >= p->n_ports_in) || 48 | (port_out == NULL)) 49 | return -1; 50 | 51 | status = pipeline_passthrough_parse_args(&pp, p); 52 | if (status) 53 | return -1; 54 | 55 | if (pp.dma_hash_lb_enabled) 56 | return -1; 57 | 58 | *port_out = port_in / (p->n_ports_in / p->n_ports_out); 59 | return 0; 60 | } 61 | 62 | static struct pipeline_fe_ops pipeline_passthrough_fe_ops = { 63 | .f_init = NULL, 64 | .f_post_init = NULL, 65 | .f_free = NULL, 66 | .f_track = app_pipeline_passthrough_track, 67 | .cmds = NULL, 68 | }; 69 | 70 | struct pipeline_type pipeline_passthrough = { 71 | .name = "PASS-THROUGH", 72 | .be_ops = &pipeline_passthrough_be_ops, 73 | .fe_ops = &pipeline_passthrough_fe_ops, 74 | }; 75 | -------------------------------------------------------------------------------- /App/ip_pipeline/pipeline/pipeline_passthrough.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_PIPELINE_PASSTHROUGH_H__ 35 | #define __INCLUDE_PIPELINE_PASSTHROUGH_H__ 36 | 37 | #include "pipeline.h" 38 | 39 | extern struct pipeline_type pipeline_passthrough; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /App/ip_pipeline/pipeline/pipeline_passthrough_be.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_PIPELINE_PASSTHROUGH_BE_H__ 35 | #define __INCLUDE_PIPELINE_PASSTHROUGH_BE_H__ 36 | 37 | #include "pipeline_common_be.h" 38 | 39 | #define PIPELINE_PASSTHROUGH_DMA_SIZE_MAX 64 40 | 41 | #ifndef PIPELINE_PASSTHROUGH_SWAP_N_FIELDS_MAX 42 | #define PIPELINE_PASSTHROUGH_SWAP_N_FIELDS_MAX 8 43 | #endif 44 | 45 | #ifndef PIPELINE_PASSTHROUGH_SWAP_FIELD_SIZE_MAX 46 | #define PIPELINE_PASSTHROUGH_SWAP_FIELD_SIZE_MAX 16 47 | #endif 48 | 49 | struct pipeline_passthrough_params { 50 | uint32_t dma_enabled; 51 | uint32_t dma_dst_offset; 52 | uint32_t dma_src_offset; 53 | uint8_t dma_src_mask[PIPELINE_PASSTHROUGH_DMA_SIZE_MAX]; 54 | uint32_t dma_size; 55 | 56 | uint32_t dma_hash_enabled; 57 | uint32_t dma_hash_offset; 58 | 59 | uint32_t dma_hash_lb_enabled; 60 | 61 | uint32_t swap_enabled; 62 | uint32_t swap_field0_offset[PIPELINE_PASSTHROUGH_SWAP_N_FIELDS_MAX]; 63 | uint32_t swap_field1_offset[PIPELINE_PASSTHROUGH_SWAP_N_FIELDS_MAX]; 64 | uint32_t swap_n_fields; 65 | }; 66 | 67 | int 68 | pipeline_passthrough_parse_args(struct pipeline_passthrough_params *p, 69 | struct pipeline_params *params); 70 | 71 | extern struct pipeline_be_ops pipeline_passthrough_be_ops; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /App/ip_pipeline/pipeline/pipeline_routing.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_PIPELINE_ROUTING_H__ 35 | #define __INCLUDE_PIPELINE_ROUTING_H__ 36 | 37 | #include "pipeline.h" 38 | #include "pipeline_routing_be.h" 39 | 40 | /* 41 | * Route 42 | */ 43 | 44 | int 45 | app_pipeline_routing_add_route(struct app_params *app, 46 | uint32_t pipeline_id, 47 | struct pipeline_routing_route_key *key, 48 | struct pipeline_routing_route_data *data); 49 | 50 | int 51 | app_pipeline_routing_delete_route(struct app_params *app, 52 | uint32_t pipeline_id, 53 | struct pipeline_routing_route_key *key); 54 | 55 | int 56 | app_pipeline_routing_add_default_route(struct app_params *app, 57 | uint32_t pipeline_id, 58 | uint32_t port_id); 59 | 60 | int 61 | app_pipeline_routing_delete_default_route(struct app_params *app, 62 | uint32_t pipeline_id); 63 | 64 | /* 65 | * ARP 66 | */ 67 | 68 | int 69 | app_pipeline_routing_add_arp_entry(struct app_params *app, 70 | uint32_t pipeline_id, 71 | struct pipeline_routing_arp_key *key, 72 | struct ether_addr *macaddr); 73 | 74 | int 75 | app_pipeline_routing_delete_arp_entry(struct app_params *app, 76 | uint32_t pipeline_id, 77 | struct pipeline_routing_arp_key *key); 78 | 79 | int 80 | app_pipeline_routing_add_default_arp_entry(struct app_params *app, 81 | uint32_t pipeline_id, 82 | uint32_t port_id); 83 | 84 | int 85 | app_pipeline_routing_delete_default_arp_entry(struct app_params *app, 86 | uint32_t pipeline_id); 87 | 88 | /* 89 | * SETTINGS 90 | */ 91 | int 92 | app_pipeline_routing_set_macaddr(struct app_params *app, 93 | uint32_t pipeline_id); 94 | 95 | /* 96 | * Pipeline type 97 | */ 98 | extern struct pipeline_type pipeline_routing; 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /App/ip_pipeline/sgx_headers.h: -------------------------------------------------------------------------------- 1 | #ifndef _SGX_HEADERS_H_ 2 | #define _SGX_HEADERS_H_ 3 | 4 | #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1 5 | 6 | #ifdef ENABLE_SGX 7 | #include "App.h" 8 | #include "Enclave_u.h" 9 | #endif 10 | 11 | #endif/* _SGX_HEADERS_H_ */ 12 | -------------------------------------------------------------------------------- /App/ip_pipeline/thread.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef THREAD_H_ 35 | #define THREAD_H_ 36 | 37 | #include "app.h" 38 | #include "pipeline_be.h" 39 | 40 | enum thread_msg_req_type { 41 | THREAD_MSG_REQ_PIPELINE_ENABLE = 0, 42 | THREAD_MSG_REQ_PIPELINE_DISABLE, 43 | THREAD_MSG_REQ_HEADROOM_READ, 44 | THREAD_MSG_REQS 45 | }; 46 | 47 | struct thread_msg_req { 48 | enum thread_msg_req_type type; 49 | }; 50 | 51 | struct thread_msg_rsp { 52 | int status; 53 | }; 54 | 55 | /* 56 | * PIPELINE ENABLE 57 | */ 58 | struct thread_pipeline_enable_msg_req { 59 | enum thread_msg_req_type type; 60 | 61 | uint32_t pipeline_id; 62 | void *be; 63 | pipeline_be_op_run f_run; 64 | pipeline_be_op_timer f_timer; 65 | uint64_t timer_period; 66 | }; 67 | 68 | struct thread_pipeline_enable_msg_rsp { 69 | int status; 70 | }; 71 | 72 | /* 73 | * PIPELINE DISABLE 74 | */ 75 | struct thread_pipeline_disable_msg_req { 76 | enum thread_msg_req_type type; 77 | 78 | uint32_t pipeline_id; 79 | }; 80 | 81 | struct thread_pipeline_disable_msg_rsp { 82 | int status; 83 | }; 84 | 85 | /* 86 | * THREAD HEADROOM 87 | */ 88 | struct thread_headroom_read_msg_req { 89 | enum thread_msg_req_type type; 90 | }; 91 | 92 | struct thread_headroom_read_msg_rsp { 93 | int status; 94 | 95 | double headroom_ratio; 96 | }; 97 | 98 | #endif /* THREAD_H_ */ 99 | -------------------------------------------------------------------------------- /App/ip_pipeline/thread_fe.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef THREAD_FE_H_ 35 | #define THREAD_FE_H_ 36 | 37 | static inline struct rte_ring * 38 | app_thread_msgq_in_get(struct app_params *app, 39 | uint32_t socket_id, uint32_t core_id, uint32_t ht_id) 40 | { 41 | char msgq_name[32]; 42 | ssize_t param_idx; 43 | 44 | snprintf(msgq_name, sizeof(msgq_name), 45 | "MSGQ-REQ-CORE-s%" PRIu32 "c%" PRIu32 "%s", 46 | socket_id, 47 | core_id, 48 | (ht_id) ? "h" : ""); 49 | param_idx = APP_PARAM_FIND(app->msgq_params, msgq_name); 50 | 51 | if (param_idx < 0) 52 | return NULL; 53 | 54 | return app->msgq[param_idx]; 55 | } 56 | 57 | static inline struct rte_ring * 58 | app_thread_msgq_out_get(struct app_params *app, 59 | uint32_t socket_id, uint32_t core_id, uint32_t ht_id) 60 | { 61 | char msgq_name[32]; 62 | ssize_t param_idx; 63 | 64 | snprintf(msgq_name, sizeof(msgq_name), 65 | "MSGQ-RSP-CORE-s%" PRIu32 "c%" PRIu32 "%s", 66 | socket_id, 67 | core_id, 68 | (ht_id) ? "h" : ""); 69 | param_idx = APP_PARAM_FIND(app->msgq_params, msgq_name); 70 | 71 | if (param_idx < 0) 72 | return NULL; 73 | 74 | return app->msgq[param_idx]; 75 | 76 | } 77 | 78 | int 79 | app_pipeline_thread_cmd_push(struct app_params *app); 80 | 81 | int 82 | app_pipeline_enable(struct app_params *app, 83 | uint32_t core_id, 84 | uint32_t socket_id, 85 | uint32_t hyper_th_id, 86 | uint32_t pipeline_id); 87 | 88 | int 89 | app_pipeline_disable(struct app_params *app, 90 | uint32_t core_id, 91 | uint32_t socket_id, 92 | uint32_t hyper_th_id, 93 | uint32_t pipeline_id); 94 | 95 | int 96 | app_thread_headroom(struct app_params *app, 97 | uint32_t core_id, 98 | uint32_t socket_id, 99 | uint32_t hyper_th_id); 100 | 101 | #endif /* THREAD_FE_H_ */ 102 | -------------------------------------------------------------------------------- /App/ocall.c: -------------------------------------------------------------------------------- 1 | #include "parser.h" 2 | #include "rte_mbuf.h" 3 | 4 | int ocall_parser_read_uint32(uint32_t *value, const char *p) { 5 | return parser_read_uint32(value, p); 6 | } 7 | 8 | void ocall_rte_pktmbuf_free(struct rte_mbuf *m) { 9 | rte_pktmbuf_free(m); 10 | } 11 | -------------------------------------------------------------------------------- /Enclave/Enclave.config.xml: -------------------------------------------------------------------------------- 1 | 2 | 0 3 | 0 4 | 0x40000 5 | 0x10000000 6 | 7 | 8 | 9 | 10 | 1 11 | 1 12 | 13 | 14 | 15 | 0 16 | 17 | 0 18 | 0xFFFFFFFF 19 | 20 | -------------------------------------------------------------------------------- /Enclave/Enclave.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011-2017 Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in 12 | * the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Intel Corporation nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | */ 31 | 32 | 33 | #include 34 | #include /* vsnprintf */ 35 | 36 | #include "Enclave.h" 37 | #include "Enclave_t.h" /* print_string */ 38 | 39 | 40 | void ecall_hello_world() { 41 | ocall_print_string("Hello\n"); 42 | } 43 | 44 | int 45 | parser_read_uint32(uint32_t *value, const char *p) 46 | { 47 | int ret; 48 | MAKE_OCALL(parser_read_uint32, &ret, value, p); 49 | return ret; 50 | } 51 | -------------------------------------------------------------------------------- /Enclave/Enclave.edl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011-2017 Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in 12 | * the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Intel Corporation nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | */ 31 | 32 | /* Enclave.edl - Top EDL file. */ 33 | 34 | enclave { 35 | include "proxy_type.h" 36 | 37 | from "dpdk.edl" import *; 38 | 39 | trusted { 40 | public void * ecall_pipeline_firewall_init([user_check] struct pipeline_params *params, [user_check] void *arg); 41 | /* public int ecall_pipeline_firewall_free([user_check] void* pipeline); */ 42 | /* public int ecall_pipeline_firewall_timer([user_check] void *pipeline); */ 43 | public int ecall_firewall_thread([user_check] struct app_thread_data *t); 44 | }; 45 | 46 | /* 47 | * ocall_print_string - invokes OCALL to display string buffer inside the enclave. 48 | * [in]: copy the string buffer to App outside. 49 | * [string]: specifies 'str' is a NULL terminated buffer. 50 | */ 51 | untrusted { 52 | void ocall_print_string([in, string] const char *str); 53 | int ocall_parser_read_uint32([out, size=4]uint32_t *value, [user_check] const char *p); 54 | }; 55 | 56 | }; 57 | -------------------------------------------------------------------------------- /Enclave/Enclave.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011-2017 Intel Corporation. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in 12 | * the documentation and/or other materials provided with the 13 | * distribution. 14 | * * Neither the name of Intel Corporation nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | */ 31 | 32 | 33 | #ifndef _ENCLAVE_H_ 34 | #define _ENCLAVE_H_ 35 | 36 | #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1 37 | 38 | #include 39 | #include 40 | #include 41 | #include "rte_debug.h" 42 | 43 | #if defined(__cplusplus) 44 | extern "C" { 45 | #endif 46 | 47 | #define MAKE_OCALL(FUNC, args...) \ 48 | do { \ 49 | sgx_status_t sgx_ret = ocall_ ## FUNC (args); \ 50 | if (sgx_ret != SGX_SUCCESS) { \ 51 | rte_panic("ocall failed in ocall_%s\n", # FUNC); \ 52 | } \ 53 | } while(0) 54 | 55 | int parser_read_uint32(uint32_t *value, const char *p); 56 | 57 | #if defined(__cplusplus) 58 | } 59 | #endif 60 | 61 | #endif /* !_ENCLAVE_H_ */ 62 | -------------------------------------------------------------------------------- /Enclave/Enclave.lds: -------------------------------------------------------------------------------- 1 | enclave.so 2 | { 3 | global: 4 | g_global_data_sim; 5 | g_global_data; 6 | enclave_entry; 7 | g_peak_heap_used; 8 | local: 9 | *; 10 | }; 11 | -------------------------------------------------------------------------------- /Enclave/Enclave_private.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIG4gIBAAKCAYEAroOogvsj/fZDZY8XFdkl6dJmky0lRvnWMmpeH41Bla6U1qLZ 3 | AmZuyIF+mQC/cgojIsrBMzBxb1kKqzATF4+XwPwgKz7fmiddmHyYz2WDJfAjIveJ 4 | ZjdMjM4+EytGlkkJ52T8V8ds0/L2qKexJ+NBLxkeQLfV8n1mIk7zX7jguwbCG1Pr 5 | nEMdJ3Sew20vnje+RsngAzdPChoJpVsWi/K7cettX/tbnre1DL02GXc5qJoQYk7b 6 | 3zkmhz31TgFrd9VVtmUGyFXAysuSAb3EN+5VnHGr0xKkeg8utErea2FNtNIgua8H 7 | ONfm9Eiyaav1SVKzPHlyqLtcdxH3I8Wg7yqMsaprZ1n5A1v/levxnL8+It02KseD 8 | 5HqV4rf/cImSlCt3lpRg8U5E1pyFQ2IVEC/XTDMiI3c+AR+w2jSRB3Bwn9zJtFlW 9 | KHG3m1xGI4ck+Lci1JvWWLXQagQSPtZTsubxTQNx1gsgZhgv1JHVZMdbVlAbbRMC 10 | 1nSuJNl7KPAS/VfzAgEDAoIBgHRXxaynbVP5gkO0ug6Qw/E27wzIw4SmjsxG6Wpe 11 | K7kfDeRskKxESdsA/xCrKkwGwhcx1iIgS5+Qscd1Yg+1D9X9asd/P7waPmWoZd+Z 12 | AhlKwhdPsO7PiF3e1AzHhGQwsUTt/Y/aSI1MpHBvy2/s1h9mFCslOUxTmWw0oj/Q 13 | ldIEgWeNR72CE2+jFIJIyml6ftnb6qzPiga8Bm48ubKh0kvySOqnkmnPzgh+JBD6 14 | JnBmtZbfPT97bwTT+N6rnPqOOApvfHPf15kWI8yDbprG1l4OCUaIUH1AszxLd826 15 | 5IPM+8gINLRDP1MA6azECPjTyHXhtnSIBZCyWSVkc05vYmNXYUNiXWMajcxW9M02 16 | wKzFELO8NCEAkaTPxwo4SCyIjUxiK1LbQ9h8PSy4c1+gGP4LAMR8xqP4QKg6zdu9 17 | osUGG/xRe/uufgTBFkcjqBHtK5L5VI0jeNIUAgW/6iNbYXjBMJ0GfauLs+g1VsOm 18 | WfdgXzsb9DYdMa0OXXHypmV4GwKBwQDUwQj8RKJ6c8cT4vcWCoJvJF00+RFL+P3i 19 | Gx2DLERxRrDa8AVGfqaCjsR+3vLgG8V/py+z+dxZYSqeB80Qeo6PDITcRKoeAYh9 20 | xlT3LJOS+k1cJcEmlbbO2IjLkTmzSwa80fWexKu8/Xv6vv15gpqYl1ngYoqJM3pd 21 | vzmTIOi7MKSZ0WmEQavrZj8zK4endE3v0eAEeQ55j1GImbypSf7Idh7wOXtjZ7WD 22 | Dg6yWDrri+AP/L3gClMj8wsAxMV4ZR8CgcEA0fzDHkFa6raVOxWnObmRoDhAtE0a 23 | cjUj976NM5yyfdf2MrKy4/RhdTiPZ6b08/lBC/+xRfV3xKVGzacm6QjqjZrUpgHC 24 | 0LKiZaMtccCJjLtPwQd0jGQEnKfMFaPsnhOc5y8qVkCzVOSthY5qhz0XNotHHFmJ 25 | gffVgB0iqrMTvSL7IA2yqqpOqNRlhaYhNl8TiFP3gIeMtVa9rZy31JPgT2uJ+kfo 26 | gV7sdTPEjPWZd7OshGxWpT6QfVDj/T9T7L6tAoHBAI3WBf2DFvxNL2KXT2QHAZ9t 27 | k3imC4f7U+wSE6zILaDZyzygA4RUbwG0gv8/TJVn2P/Eynf76DuWHGlaiLWnCbSz 28 | Az2DHBQBBaku409zDQym3j1ugMRjzzSQWzJg0SIyBH3hTmnYcn3+Uqcp/lEBvGW6 29 | O+rsXFt3pukqJmIV8HzLGGaLm62BHUeZf3dyWm+i3p/hQAL7Xvu04QW70xuGqdr5 30 | afV7p5eaeQIJXyGQJ0eylV/90+qxjMKiB1XYg6WYvwKBwQCL/ddpgOdHJGN8uRom 31 | e7Zq0Csi3hGheMKlKbN3vcxT5U7MdyHtTZZOJbTvxKNNUNYH/8uD+PqDGNneb29G 32 | BfGzvI3EASyLIcGZF3OhKwZd0jUrWk2y7Vhob91jwp2+t73vdMbkKyI4mHOuXvGv 33 | fg95si9oO7EBT+Oqvhccd2J+F1IVXncccYnF4u5ZGWt5lLewN/pVr7MjjykeaHqN 34 | t+rfnQam2psA6fL4zS2zTmZPzR2tnY8Y1GBTi0Ko1OKd1HMCgcAb5cB/7/AQlhP9 35 | yQa04PLH9ygQkKKptZp7dy5WcWRx0K/hAHRoi2aw1wZqfm7VBNu2SLcs90kCCCxp 36 | 6C5sfJi6b8NpNbIPC+sc9wsFr7pGo9SFzQ78UlcWYK2Gu2FxlMjonhka5hvo4zvg 37 | WxlpXKEkaFt3gLd92m/dMqBrHfafH7VwOJY2zT3WIpjwuk0ZzmRg5p0pG/svVQEH 38 | NZmwRwlopysbR69B/n1nefJ84UO50fLh5s5Zr3gBRwbWNZyzhXk= 39 | -----END RSA PRIVATE KEY----- 40 | -------------------------------------------------------------------------------- /Enclave/dpdk/dpdk.edl: -------------------------------------------------------------------------------- 1 | enclave { 2 | include "dpdk_proxy_type.h" 3 | 4 | trusted { 5 | public int ecall_rte_eal_init(int argc, [user_check] char** argv); 6 | }; 7 | 8 | untrusted { 9 | void ocall_rte_pktmbuf_free([user_check] struct rte_mbuf *m); 10 | }; 11 | }; 12 | -------------------------------------------------------------------------------- /Enclave/dpdk/dpdk_proxy_type.h: -------------------------------------------------------------------------------- 1 | struct rte_mbuf; 2 | -------------------------------------------------------------------------------- /Enclave/dpdk/librte_acl/acl_run_avx2.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | 35 | #include "acl_run_avx2.h" 36 | 37 | /* 38 | * Note, that to be able to use AVX2 classify method, 39 | * both compiler and target cpu have to support AVX2 instructions. 40 | */ 41 | int 42 | rte_acl_classify_avx2(const struct rte_acl_ctx *ctx, const uint8_t **data, 43 | uint32_t *results, uint32_t num, uint32_t categories) 44 | { 45 | if (likely(num >= MAX_SEARCHES_AVX16)) 46 | return search_avx2x16(ctx, data, results, num, categories); 47 | else if (num >= MAX_SEARCHES_SSE8) 48 | return search_sse_8(ctx, data, results, num, categories); 49 | else if (num >= MAX_SEARCHES_SSE4) 50 | return search_sse_4(ctx, data, results, num, categories); 51 | else 52 | return rte_acl_classify_scalar(ctx, data, results, num, 53 | categories); 54 | } 55 | -------------------------------------------------------------------------------- /Enclave/dpdk/librte_acl/acl_run_sse.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #include "acl_run_sse.h" 35 | 36 | int 37 | rte_acl_classify_sse(const struct rte_acl_ctx *ctx, const uint8_t **data, 38 | uint32_t *results, uint32_t num, uint32_t categories) 39 | { 40 | if (likely(num >= MAX_SEARCHES_SSE8)) 41 | return search_sse_8(ctx, data, results, num, categories); 42 | else if (num >= MAX_SEARCHES_SSE4) 43 | return search_sse_4(ctx, data, results, num, categories); 44 | else 45 | return rte_acl_classify_scalar(ctx, data, results, num, 46 | categories); 47 | } 48 | -------------------------------------------------------------------------------- /Enclave/dpdk/librte_acl/rte_acl_osdep.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_ACL_OSDEP_H_ 35 | #define _RTE_ACL_OSDEP_H_ 36 | 37 | /** 38 | * @file 39 | * 40 | * RTE ACL DPDK/OS dependent file. 41 | */ 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | /* 56 | * Common defines. 57 | */ 58 | 59 | #define DIM(x) RTE_DIM(x) 60 | 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | 80 | #endif /* _RTE_ACL_OSDEP_H_ */ 81 | -------------------------------------------------------------------------------- /Enclave/dpdk/librte_acl/rte_acl_version.map: -------------------------------------------------------------------------------- 1 | DPDK_2.0 { 2 | global: 3 | 4 | rte_acl_add_rules; 5 | rte_acl_build; 6 | rte_acl_classify; 7 | rte_acl_classify_alg; 8 | rte_acl_classify_scalar; 9 | rte_acl_create; 10 | rte_acl_dump; 11 | rte_acl_find_existing; 12 | rte_acl_free; 13 | rte_acl_list_dump; 14 | rte_acl_reset; 15 | rte_acl_reset_rules; 16 | rte_acl_set_ctx_classify; 17 | 18 | local: *; 19 | }; 20 | -------------------------------------------------------------------------------- /Enclave/dpdk/librte_acl/tb_mem.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _TB_MEM_H_ 35 | #define _TB_MEM_H_ 36 | 37 | /** 38 | * @file 39 | * 40 | * RTE ACL temporary (build phase) memory management. 41 | * Contains structures and functions to manage temporary (used by build only) 42 | * memory. Memory allocated in large blocks to speed 'free' when trie is 43 | * destructed (finish of build phase). 44 | */ 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | #include 51 | #include 52 | 53 | struct tb_mem_block { 54 | struct tb_mem_block *next; 55 | struct tb_mem_pool *pool; 56 | size_t size; 57 | uint8_t *mem; 58 | }; 59 | 60 | struct tb_mem_pool { 61 | struct tb_mem_block *block; 62 | size_t alignment; 63 | size_t min_alloc; 64 | size_t alloc; 65 | /* jump target in case of memory allocation failure. */ 66 | jmp_buf fail; 67 | }; 68 | 69 | void *tb_alloc(struct tb_mem_pool *pool, size_t size); 70 | void tb_free_pool(struct tb_mem_pool *pool); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif /* _TB_MEM_H_ */ 77 | -------------------------------------------------------------------------------- /Enclave/dpdk/librte_eal/eal_common_errno.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | RTE_DEFINE_PER_LCORE(int, _rte_errno); 45 | 46 | const char * 47 | rte_strerror(int errnum) 48 | { 49 | #define RETVAL_SZ 256 50 | static RTE_DEFINE_PER_LCORE(char[RETVAL_SZ], retval); 51 | 52 | /* since some implementations of strerror_r throw an error 53 | * themselves if errnum is too big, we handle that case here */ 54 | if (errnum > RTE_MAX_ERRNO) 55 | snprintf(RTE_PER_LCORE(retval), RETVAL_SZ, 56 | #ifdef RTE_EXEC_ENV_BSDAPP 57 | "Unknown error: %d", errnum); 58 | #else 59 | "Unknown error %d", errnum); 60 | #endif 61 | else 62 | switch (errnum){ 63 | case E_RTE_SECONDARY: 64 | return "Invalid call in secondary process"; 65 | case E_RTE_NO_CONFIG: 66 | return "Missing rte_config structure"; 67 | default: 68 | strerror_r(errnum, RTE_PER_LCORE(retval), RETVAL_SZ); 69 | } 70 | 71 | return RTE_PER_LCORE(retval); 72 | } 73 | -------------------------------------------------------------------------------- /Enclave/dpdk/librte_eal/rte_globals.h: -------------------------------------------------------------------------------- 1 | #ifndef _RTE_GLOBALS_H_ 2 | #define _RTE_GLOBALS_H_ 3 | 4 | #include 5 | 6 | extern struct rte_mem_config *global_mem_config; 7 | 8 | #endif/* _RTE_GLOBALS_H_ */ 9 | 10 | -------------------------------------------------------------------------------- /Enclave/dpdk/librte_port/rte_port_source_sink.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_RTE_PORT_SOURCE_SINK_H__ 35 | #define __INCLUDE_RTE_PORT_SOURCE_SINK_H__ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * @file 43 | * RTE Port Source/Sink 44 | * 45 | * source: input port that can be used to generate packets 46 | * sink: output port that drops all packets written to it 47 | * 48 | ***/ 49 | 50 | #include "rte_port.h" 51 | 52 | /** source port parameters */ 53 | struct rte_port_source_params { 54 | /** Pre-initialized buffer pool */ 55 | struct rte_mempool *mempool; 56 | 57 | /** The full path of the pcap file to read packets from */ 58 | const char *file_name; 59 | /** The number of bytes to be read from each packet in the 60 | * pcap file. If this value is 0, the whole packet is read; 61 | * if it is bigger than packet size, the generated packets 62 | * will contain the whole packet */ 63 | uint32_t n_bytes_per_pkt; 64 | }; 65 | 66 | /** source port operations */ 67 | extern struct rte_port_in_ops rte_port_source_ops; 68 | 69 | /** sink port parameters */ 70 | struct rte_port_sink_params { 71 | /** The full path of the pcap file to write the packets to */ 72 | const char *file_name; 73 | /** The maximum number of packets write to the pcap file. 74 | * If this value is 0, the "infinite" write will be carried 75 | * out. 76 | */ 77 | uint32_t max_n_pkts; 78 | }; 79 | 80 | /** sink port operations */ 81 | extern struct rte_port_out_ops rte_port_sink_ops; 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /Enclave/firewall_thread.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "pipeline_common_be.h" 3 | #include "pipeline_firewall_be.h" 4 | #include "Enclave_t.h" 5 | #include "Enclave.h" 6 | 7 | #include "app.h" 8 | 9 | int running = 1; 10 | 11 | int ecall_firewall_thread(struct app_thread_data *t) { 12 | uint32_t i; 13 | for (i = 0; running; i++) { 14 | /* uint32_t n_regular = RTE_MIN(t->n_regular, RTE_DIM(t->regular)); */ 15 | /* uint32_t n_custom = RTE_MIN(t->n_custom, RTE_DIM(t->custom)); */ 16 | 17 | /* Run regular pipelines */ 18 | /* for (j = 0; j < n_regular; j++) { */ 19 | /* struct app_thread_pipeline_data *data = &t->regular[j]; */ 20 | /* struct pipeline *p = data->be; */ 21 | 22 | /* PIPELINE_RUN_REGULAR(t, p); */ 23 | /* } */ 24 | 25 | /* Run custom pipelines */ 26 | /* for (j = 0; j < n_custom; j++) { */ 27 | /* struct app_thread_pipeline_data *data = &t->custom[j]; */ 28 | 29 | /* PIPELINE_RUN_CUSTOM(t, data); */ 30 | /* } */ 31 | 32 | struct app_thread_pipeline_data *data = &t->trusted[0]; 33 | struct pipeline *p = data->be; 34 | rte_pipeline_run(p->p); 35 | 36 | /* Timer */ 37 | if ((i & 0xF) == 0) { 38 | pipeline_firewall_timer(p); 39 | /* uint64_t time = rte_get_tsc_cycles(); */ 40 | /* uint64_t t_deadline = UINT64_MAX; */ 41 | 42 | /* if (time < t->deadline) */ 43 | /* continue; */ 44 | 45 | /* Timer for regular pipelines */ 46 | /* for (j = 0; j < n_regular; j++) { */ 47 | /* struct app_thread_pipeline_data *data = */ 48 | /* &t->regular[j]; */ 49 | /* uint64_t p_deadline = data->deadline; */ 50 | 51 | /* if (p_deadline <= time) { */ 52 | /* data->f_timer(data->be); */ 53 | /* p_deadline = time + data->timer_period; */ 54 | /* data->deadline = p_deadline; */ 55 | /* } */ 56 | 57 | /* if (p_deadline < t_deadline) */ 58 | /* t_deadline = p_deadline; */ 59 | /* } */ 60 | 61 | /* Timer for custom pipelines */ 62 | /* for (j = 0; j < n_custom; j++) { */ 63 | /* struct app_thread_pipeline_data *data = */ 64 | /* &t->custom[j]; */ 65 | /* uint64_t p_deadline = data->deadline; */ 66 | 67 | /* if (p_deadline <= time) { */ 68 | /* data->f_timer(data->be); */ 69 | /* p_deadline = time + data->timer_period; */ 70 | /* data->deadline = p_deadline; */ 71 | /* } */ 72 | 73 | /* if (p_deadline < t_deadline) */ 74 | /* t_deadline = p_deadline; */ 75 | /* } */ 76 | 77 | /* Timer for thread message request */ 78 | /* { */ 79 | /* uint64_t deadline = t->thread_req_deadline; */ 80 | 81 | /* if (deadline <= time) { */ 82 | /* thread_msg_req_handle(t); */ 83 | /* thread_headroom_update(t, time); */ 84 | /* deadline = time + t->timer_period; */ 85 | /* t->thread_req_deadline = deadline; */ 86 | /* } */ 87 | 88 | /* if (deadline < t_deadline) */ 89 | /* t_deadline = deadline; */ 90 | /* } */ 91 | 92 | 93 | /* t->deadline = t_deadline; */ 94 | } 95 | } 96 | return 0; 97 | } 98 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/generic/rte_cpuflags.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_CPUFLAGS_H_ 35 | #define _RTE_CPUFLAGS_H_ 36 | 37 | /** 38 | * @file 39 | * Architecture specific API to determine available CPU features at runtime. 40 | */ 41 | 42 | #include "rte_common.h" 43 | #include 44 | 45 | /** 46 | * Enumeration of all CPU features supported 47 | */ 48 | __extension__ 49 | enum rte_cpu_flag_t; 50 | 51 | /** 52 | * Get name of CPU flag 53 | * 54 | * @param feature 55 | * CPU flag ID 56 | * @return 57 | * flag name 58 | * NULL if flag ID is invalid 59 | */ 60 | __extension__ 61 | const char * 62 | rte_cpu_get_flag_name(enum rte_cpu_flag_t feature); 63 | 64 | /** 65 | * Function for checking a CPU flag availability 66 | * 67 | * @param feature 68 | * CPU flag to query CPU for 69 | * @return 70 | * 1 if flag is available 71 | * 0 if flag is not available 72 | * -ENOENT if flag is invalid 73 | */ 74 | __extension__ 75 | int 76 | rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature); 77 | 78 | /** 79 | * This function checks that the currently used CPU supports the CPU features 80 | * that were specified at compile time. It is called automatically within the 81 | * EAL, so does not need to be used by applications. 82 | */ 83 | __rte_deprecated 84 | void 85 | rte_cpu_check_supported(void); 86 | 87 | /** 88 | * This function checks that the currently used CPU supports the CPU features 89 | * that were specified at compile time. It is called automatically within the 90 | * EAL, so does not need to be used by applications. This version returns a 91 | * result so that decisions may be made (for instance, graceful shutdowns). 92 | */ 93 | int 94 | rte_cpu_is_supported(void); 95 | 96 | #endif /* _RTE_CPUFLAGS_H_ */ 97 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/generic/rte_prefetch.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_PREFETCH_H_ 35 | #define _RTE_PREFETCH_H_ 36 | 37 | /** 38 | * @file 39 | * 40 | * Prefetch operations. 41 | * 42 | * This file defines an API for prefetch macros / inline-functions, 43 | * which are architecture-dependent. Prefetching occurs when a 44 | * processor requests an instruction or data from memory to cache 45 | * before it is actually needed, potentially speeding up the execution of the 46 | * program. 47 | */ 48 | 49 | /** 50 | * Prefetch a cache line into all cache levels. 51 | * @param p 52 | * Address to prefetch 53 | */ 54 | static inline void rte_prefetch0(const volatile void *p); 55 | 56 | /** 57 | * Prefetch a cache line into all cache levels except the 0th cache level. 58 | * @param p 59 | * Address to prefetch 60 | */ 61 | static inline void rte_prefetch1(const volatile void *p); 62 | 63 | /** 64 | * Prefetch a cache line into all cache levels except the 0th and 1th cache 65 | * levels. 66 | * @param p 67 | * Address to prefetch 68 | */ 69 | static inline void rte_prefetch2(const volatile void *p); 70 | 71 | /** 72 | * Prefetch a cache line into all cache levels (non-temporal/transient version) 73 | * 74 | * The non-temporal prefetch is intended as a prefetch hint that processor will 75 | * use the prefetched data only once or short period, unlike the 76 | * rte_prefetch0() function which imply that prefetched data to use repeatedly. 77 | * 78 | * @param p 79 | * Address to prefetch 80 | */ 81 | static inline void rte_prefetch_non_temporal(const volatile void *p); 82 | 83 | #endif /* _RTE_PREFETCH_H_ */ 84 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_acl_osdep.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_ACL_OSDEP_H_ 35 | #define _RTE_ACL_OSDEP_H_ 36 | 37 | /** 38 | * @file 39 | * 40 | * RTE ACL DPDK/OS dependent file. 41 | */ 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | /* 56 | * Common defines. 57 | */ 58 | 59 | #define DIM(x) RTE_DIM(x) 60 | 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | 80 | #endif /* _RTE_ACL_OSDEP_H_ */ 81 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_branch_prediction.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * @file 36 | * Branch Prediction Helpers in RTE 37 | */ 38 | 39 | #ifndef _RTE_BRANCH_PREDICTION_H_ 40 | #define _RTE_BRANCH_PREDICTION_H_ 41 | 42 | /** 43 | * Check if a branch is likely to be taken. 44 | * 45 | * This compiler builtin allows the developer to indicate if a branch is 46 | * likely to be taken. Example: 47 | * 48 | * if (likely(x > 1)) 49 | * do_stuff(); 50 | * 51 | */ 52 | #ifndef likely 53 | #define likely(x) __builtin_expect((x),1) 54 | #endif /* likely */ 55 | 56 | /** 57 | * Check if a branch is unlikely to be taken. 58 | * 59 | * This compiler builtin allows the developer to indicate if a branch is 60 | * unlikely to be taken. Example: 61 | * 62 | * if (unlikely(x < 1)) 63 | * do_stuff(); 64 | * 65 | */ 66 | #ifndef unlikely 67 | #define unlikely(x) __builtin_expect((x),0) 68 | #endif /* unlikely */ 69 | 70 | #endif /* _RTE_BRANCH_PREDICTION_H_ */ 71 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_byteorder_32.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_BYTEORDER_X86_H_ 35 | #error do not include this file directly, use instead 36 | #endif 37 | 38 | #ifndef _RTE_BYTEORDER_I686_H_ 39 | #define _RTE_BYTEORDER_I686_H_ 40 | 41 | #include 42 | #include 43 | 44 | /* 45 | * An architecture-optimized byte swap for a 64-bit value. 46 | * 47 | * Do not use this function directly. The preferred function is rte_bswap64(). 48 | */ 49 | /* Compat./Leg. mode */ 50 | static inline uint64_t rte_arch_bswap64(uint64_t x) 51 | { 52 | uint64_t ret = 0; 53 | ret |= ((uint64_t)rte_arch_bswap32(x & 0xffffffffUL) << 32); 54 | ret |= ((uint64_t)rte_arch_bswap32((x >> 32) & 0xffffffffUL)); 55 | return ret; 56 | } 57 | 58 | #endif /* _RTE_BYTEORDER_I686_H_ */ 59 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_byteorder_64.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_BYTEORDER_X86_H_ 35 | #error do not include this file directly, use instead 36 | #endif 37 | 38 | #ifndef _RTE_BYTEORDER_X86_64_H_ 39 | #define _RTE_BYTEORDER_X86_64_H_ 40 | 41 | #include 42 | #include 43 | 44 | /* 45 | * An architecture-optimized byte swap for a 64-bit value. 46 | * 47 | * Do not use this function directly. The preferred function is rte_bswap64(). 48 | */ 49 | /* 64-bit mode */ 50 | static inline uint64_t rte_arch_bswap64(uint64_t _x) 51 | { 52 | register uint64_t x = _x; 53 | asm volatile ("bswap %[x]" 54 | : [x] "+r" (x) 55 | ); 56 | return x; 57 | } 58 | 59 | #endif /* _RTE_BYTEORDER_X86_64_H_ */ 60 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_errno.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * @file 36 | * 37 | * API for error cause tracking 38 | */ 39 | 40 | #ifndef _RTE_ERRNO_H_ 41 | #define _RTE_ERRNO_H_ 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #include 48 | 49 | RTE_DECLARE_PER_LCORE(int, _rte_errno); /**< Per core error number. */ 50 | 51 | /** 52 | * Error number value, stored per-thread, which can be queried after 53 | * calls to certain functions to determine why those functions failed. 54 | * 55 | * Uses standard values from errno.h wherever possible, with a small number 56 | * of additional possible values for RTE-specific conditions. 57 | */ 58 | #define rte_errno RTE_PER_LCORE(_rte_errno) 59 | 60 | /** 61 | * Function which returns a printable string describing a particular 62 | * error code. For non-RTE-specific error codes, this function returns 63 | * the value from the libc strerror function. 64 | * 65 | * @param errnum 66 | * The error number to be looked up - generally the value of rte_errno 67 | * @return 68 | * A pointer to a thread-local string containing the text describing 69 | * the error. 70 | */ 71 | const char *rte_strerror(int errnum); 72 | 73 | #ifndef __ELASTERROR 74 | /** 75 | * Check if we have a defined value for the max system-defined errno values. 76 | * if no max defined, start from 1000 to prevent overlap with standard values 77 | */ 78 | #define __ELASTERROR 1000 79 | #endif 80 | 81 | /** Error types */ 82 | enum { 83 | RTE_MIN_ERRNO = __ELASTERROR, /**< Start numbering above std errno vals */ 84 | 85 | E_RTE_SECONDARY, /**< Operation not allowed in secondary processes */ 86 | E_RTE_NO_CONFIG, /**< Missing rte_config */ 87 | 88 | RTE_MAX_ERRNO /**< Max RTE error number */ 89 | }; 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /* _RTE_ERRNO_H_ */ 96 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_hexdump.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_HEXDUMP_H_ 35 | #define _RTE_HEXDUMP_H_ 36 | 37 | /** 38 | * @file 39 | * Simple API to dump out memory in a special hex format. 40 | */ 41 | 42 | #include 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | /** 49 | * Dump out memory in a special hex dump format. 50 | * 51 | * @param f 52 | * A pointer to a file for output 53 | * @param title 54 | * If not NULL this string is printed as a header to the output. 55 | * @param buf 56 | * This is the buffer address to print out. 57 | * @param len 58 | * The number of bytes to dump out 59 | * @return 60 | * None. 61 | */ 62 | 63 | extern void 64 | rte_hexdump(FILE *f, const char * title, const void * buf, unsigned int len); 65 | 66 | /** 67 | * Dump out memory in a hex format with colons between bytes. 68 | * 69 | * @param f 70 | * A pointer to a file for output 71 | * @param title 72 | * If not NULL this string is printed as a header to the output. 73 | * @param buf 74 | * This is the buffer address to print out. 75 | * @param len 76 | * The number of bytes to dump out 77 | * @return 78 | * None. 79 | */ 80 | 81 | void 82 | rte_memdump(FILE *f, const char * title, const void * buf, unsigned int len); 83 | 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /* _RTE_HEXDUMP_H_ */ 90 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_malloc_heap.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_MALLOC_HEAP_H_ 35 | #define _RTE_MALLOC_HEAP_H_ 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | /* Number of free lists per heap, grouped by size. */ 43 | #define RTE_HEAP_NUM_FREELISTS 13 44 | 45 | /** 46 | * Structure to hold malloc heap 47 | */ 48 | struct malloc_heap { 49 | rte_spinlock_t lock; 50 | LIST_HEAD(, malloc_elem) free_head[RTE_HEAP_NUM_FREELISTS]; 51 | unsigned alloc_count; 52 | size_t total_size; 53 | } __rte_cache_aligned; 54 | 55 | #endif /* _RTE_MALLOC_HEAP_H_ */ 56 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_pci_dev_feature_defs.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * This file is provided under a dual BSD/GPLv2 license. When using or 3 | * redistributing this file, you may do so under either license. 4 | * 5 | * GPL LICENSE SUMMARY 6 | * 7 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of version 2 of the GNU General Public License as 11 | * published by the Free Software Foundation. 12 | * 13 | * This program is distributed in the hope that it will be useful, but 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | * General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21 | * The full GNU General Public License is included in this distribution 22 | * in the file called LICENSE.GPL. 23 | * 24 | * Contact Information: 25 | * Intel Corporation 26 | * 27 | * BSD LICENSE 28 | * 29 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 30 | * All rights reserved. 31 | * 32 | * Redistribution and use in source and binary forms, with or without 33 | * modification, are permitted provided that the following conditions 34 | * are met: 35 | * 36 | * * Redistributions of source code must retain the above copyright 37 | * notice, this list of conditions and the following disclaimer. 38 | * * Redistributions in binary form must reproduce the above copyright 39 | * notice, this list of conditions and the following disclaimer in 40 | * the documentation and/or other materials provided with the 41 | * distribution. 42 | * * Neither the name of Intel Corporation nor the names of its 43 | * contributors may be used to endorse or promote products derived 44 | * from this software without specific prior written permission. 45 | * 46 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 47 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 48 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 49 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 50 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 51 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 52 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 53 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 54 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 55 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 56 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 57 | */ 58 | 59 | #ifndef _RTE_PCI_DEV_DEFS_H_ 60 | #define _RTE_PCI_DEV_DEFS_H_ 61 | 62 | /* interrupt mode */ 63 | enum rte_intr_mode { 64 | RTE_INTR_MODE_NONE = 0, 65 | RTE_INTR_MODE_LEGACY, 66 | RTE_INTR_MODE_MSI, 67 | RTE_INTR_MODE_MSIX 68 | }; 69 | 70 | #endif /* _RTE_PCI_DEV_DEFS_H_ */ 71 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_per_lcore.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_PER_LCORE_H_ 35 | #define _RTE_PER_LCORE_H_ 36 | 37 | /** 38 | * @file 39 | * 40 | * Per-lcore variables in RTE 41 | * 42 | * This file defines an API for instantiating per-lcore "global 43 | * variables" that are environment-specific. Note that in all 44 | * environments, a "shared variable" is the default when you use a 45 | * global variable. 46 | * 47 | * Parts of this are execution environment specific. 48 | */ 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | #ifndef APP_ENCLAVE 55 | #include 56 | #endif /* APP_ENCLAVE */ 57 | 58 | /** 59 | * Macro to define a per lcore variable "var" of type "type", don't 60 | * use keywords like "static" or "volatile" in type, just prefix the 61 | * whole macro. 62 | */ 63 | #define RTE_DEFINE_PER_LCORE(type, name) \ 64 | __thread __typeof__(type) per_lcore_##name 65 | 66 | /** 67 | * Macro to declare an extern per lcore variable "var" of type "type" 68 | */ 69 | #define RTE_DECLARE_PER_LCORE(type, name) \ 70 | extern __thread __typeof__(type) per_lcore_##name 71 | 72 | /** 73 | * Read/write the per-lcore variable value 74 | */ 75 | #define RTE_PER_LCORE(name) (per_lcore_##name) 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* _RTE_PER_LCORE_H_ */ 82 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_port_ethdev.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_RTE_PORT_ETHDEV_H__ 35 | #define __INCLUDE_RTE_PORT_ETHDEV_H__ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * @file 43 | * RTE Port Ethernet Device 44 | * 45 | * ethdev_reader: input port built on top of pre-initialized NIC RX queue 46 | * ethdev_writer: output port built on top of pre-initialized NIC TX queue 47 | * 48 | ***/ 49 | 50 | #include 51 | 52 | #include "rte_port.h" 53 | 54 | /** ethdev_reader port parameters */ 55 | struct rte_port_ethdev_reader_params { 56 | /** NIC RX port ID */ 57 | uint8_t port_id; 58 | 59 | /** NIC RX queue ID */ 60 | uint16_t queue_id; 61 | }; 62 | 63 | /** ethdev_reader port operations */ 64 | extern struct rte_port_in_ops rte_port_ethdev_reader_ops; 65 | 66 | /** ethdev_writer port parameters */ 67 | struct rte_port_ethdev_writer_params { 68 | /** NIC RX port ID */ 69 | uint8_t port_id; 70 | 71 | /** NIC RX queue ID */ 72 | uint16_t queue_id; 73 | 74 | /** Recommended burst size to NIC TX queue. The actual burst size can be 75 | bigger or smaller than this value. */ 76 | uint32_t tx_burst_sz; 77 | }; 78 | 79 | /** ethdev_writer port operations */ 80 | extern struct rte_port_out_ops rte_port_ethdev_writer_ops; 81 | 82 | /** ethdev_writer_nodrop port parameters */ 83 | struct rte_port_ethdev_writer_nodrop_params { 84 | /** NIC RX port ID */ 85 | uint8_t port_id; 86 | 87 | /** NIC RX queue ID */ 88 | uint16_t queue_id; 89 | 90 | /** Recommended burst size to NIC TX queue. The actual burst size can be 91 | bigger or smaller than this value. */ 92 | uint32_t tx_burst_sz; 93 | 94 | /** Maximum number of retries, 0 for no limit */ 95 | uint32_t n_retries; 96 | }; 97 | 98 | /** ethdev_writer_nodrop port operations */ 99 | extern struct rte_port_out_ops rte_port_ethdev_writer_nodrop_ops; 100 | 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_port_fd.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2016 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_RTE_PORT_FD_H__ 35 | #define __INCLUDE_RTE_PORT_FD_H__ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * @file 43 | * RTE Port FD Device 44 | * 45 | * fd_reader: input port built on top of valid non-blocking file descriptor 46 | * fd_writer: output port built on top of valid non-blocking file descriptor 47 | * 48 | ***/ 49 | 50 | #include 51 | 52 | #include 53 | #include "rte_port.h" 54 | 55 | /** fd_reader port parameters */ 56 | struct rte_port_fd_reader_params { 57 | /** File descriptor */ 58 | int fd; 59 | 60 | /** Maximum Transfer Unit (MTU) */ 61 | uint32_t mtu; 62 | 63 | /** Pre-initialized buffer pool */ 64 | struct rte_mempool *mempool; 65 | }; 66 | 67 | /** fd_reader port operations */ 68 | extern struct rte_port_in_ops rte_port_fd_reader_ops; 69 | 70 | /** fd_writer port parameters */ 71 | struct rte_port_fd_writer_params { 72 | /** File descriptor */ 73 | int fd; 74 | 75 | /**< Recommended write burst size. The actual burst size can be 76 | * bigger or smaller than this value. 77 | */ 78 | uint32_t tx_burst_sz; 79 | }; 80 | 81 | /** fd_writer port operations */ 82 | extern struct rte_port_out_ops rte_port_fd_writer_ops; 83 | 84 | /** fd_writer_nodrop port parameters */ 85 | struct rte_port_fd_writer_nodrop_params { 86 | /** File descriptor */ 87 | int fd; 88 | 89 | /**< Recommended write burst size. The actual burst size can be 90 | * bigger or smaller than this value. 91 | */ 92 | uint32_t tx_burst_sz; 93 | 94 | /** Maximum number of retries, 0 for no limit */ 95 | uint32_t n_retries; 96 | }; 97 | 98 | /** fd_writer_nodrop port operations */ 99 | extern struct rte_port_out_ops rte_port_fd_writer_nodrop_ops; 100 | 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_port_ras.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_RTE_PORT_RAS_H__ 35 | #define __INCLUDE_RTE_PORT_RAS_H__ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * @file 43 | * RTE Port for IPv4 Reassembly 44 | * 45 | * This port is built on top of pre-initialized single producer rte_ring. In 46 | * order to minimize the amount of packets stored in the ring at any given 47 | * time, the IP reassembly functionality is executed on ring write operation, 48 | * hence this port is implemented as an output port. A regular ring_reader port 49 | * can be created to read from the same ring. 50 | * 51 | * The packets written to the ring are either complete IP datagrams or IP 52 | * fragments. The packets read from the ring are all complete IP datagrams, 53 | * either jumbo frames (i.e. IP packets with length bigger than MTU) or not. 54 | * The complete IP datagrams written to the ring are not changed. The IP 55 | * fragments written to the ring are first reassembled and into complete IP 56 | * datagrams or dropped on error or IP reassembly time-out. 57 | * 58 | ***/ 59 | 60 | #include 61 | 62 | #include 63 | 64 | #include "rte_port.h" 65 | 66 | /** ring_writer_ipv4_ras port parameters */ 67 | struct rte_port_ring_writer_ras_params { 68 | /** Underlying single consumer ring that has to be pre-initialized. */ 69 | struct rte_ring *ring; 70 | 71 | /** Recommended burst size to ring. The actual burst size can be bigger 72 | or smaller than this value. */ 73 | uint32_t tx_burst_sz; 74 | }; 75 | 76 | #define rte_port_ring_writer_ipv4_ras_params rte_port_ring_writer_ras_params 77 | 78 | #define rte_port_ring_writer_ipv6_ras_params rte_port_ring_writer_ras_params 79 | 80 | /** ring_writer_ipv4_ras port operations */ 81 | extern struct rte_port_out_ops rte_port_ring_writer_ipv4_ras_ops; 82 | 83 | /** ring_writer_ipv6_ras port operations */ 84 | extern struct rte_port_out_ops rte_port_ring_writer_ipv6_ras_ops; 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_port_sched.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_RTE_PORT_SCHED_H__ 35 | #define __INCLUDE_RTE_PORT_SCHED_H__ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * @file 43 | * RTE Port Hierarchical Scheduler 44 | * 45 | * sched_reader: input port built on top of pre-initialized rte_sched_port 46 | * sched_writer: output port built on top of pre-initialized rte_sched_port 47 | * 48 | ***/ 49 | 50 | #include 51 | 52 | #include 53 | 54 | #include "rte_port.h" 55 | 56 | /** sched_reader port parameters */ 57 | struct rte_port_sched_reader_params { 58 | /** Underlying pre-initialized rte_sched_port */ 59 | struct rte_sched_port *sched; 60 | }; 61 | 62 | /** sched_reader port operations */ 63 | extern struct rte_port_in_ops rte_port_sched_reader_ops; 64 | 65 | /** sched_writer port parameters */ 66 | struct rte_port_sched_writer_params { 67 | /** Underlying pre-initialized rte_sched_port */ 68 | struct rte_sched_port *sched; 69 | 70 | /** Recommended burst size. The actual burst size can be bigger or 71 | smaller than this value. */ 72 | uint32_t tx_burst_sz; 73 | }; 74 | 75 | /** sched_writer port operations */ 76 | extern struct rte_port_out_ops rte_port_sched_writer_ops; 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_port_source_sink.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2016 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_RTE_PORT_SOURCE_SINK_H__ 35 | #define __INCLUDE_RTE_PORT_SOURCE_SINK_H__ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * @file 43 | * RTE Port Source/Sink 44 | * 45 | * source: input port that can be used to generate packets 46 | * sink: output port that drops all packets written to it 47 | * 48 | ***/ 49 | 50 | #include "rte_port.h" 51 | 52 | /** source port parameters */ 53 | struct rte_port_source_params { 54 | /** Pre-initialized buffer pool */ 55 | struct rte_mempool *mempool; 56 | 57 | /** The full path of the pcap file to read packets from */ 58 | const char *file_name; 59 | /** The number of bytes to be read from each packet in the 60 | * pcap file. If this value is 0, the whole packet is read; 61 | * if it is bigger than packet size, the generated packets 62 | * will contain the whole packet */ 63 | uint32_t n_bytes_per_pkt; 64 | }; 65 | 66 | /** source port operations */ 67 | extern struct rte_port_in_ops rte_port_source_ops; 68 | 69 | /** sink port parameters */ 70 | struct rte_port_sink_params { 71 | /** The full path of the pcap file to write the packets to */ 72 | const char *file_name; 73 | /** The maximum number of packets write to the pcap file. 74 | * If this value is 0, the "infinite" write will be carried 75 | * out. 76 | */ 77 | uint32_t max_n_pkts; 78 | }; 79 | 80 | /** sink port operations */ 81 | extern struct rte_port_out_ops rte_port_sink_ops; 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_prefetch.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_PREFETCH_X86_64_H_ 35 | #define _RTE_PREFETCH_X86_64_H_ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | #include 42 | #include "generic/rte_prefetch.h" 43 | 44 | static inline void rte_prefetch0(const volatile void *p) 45 | { 46 | asm volatile ("prefetcht0 %[p]" : : [p] "m" (*(const volatile char *)p)); 47 | } 48 | 49 | static inline void rte_prefetch1(const volatile void *p) 50 | { 51 | asm volatile ("prefetcht1 %[p]" : : [p] "m" (*(const volatile char *)p)); 52 | } 53 | 54 | static inline void rte_prefetch2(const volatile void *p) 55 | { 56 | asm volatile ("prefetcht2 %[p]" : : [p] "m" (*(const volatile char *)p)); 57 | } 58 | 59 | static inline void rte_prefetch_non_temporal(const volatile void *p) 60 | { 61 | asm volatile ("prefetchnta %[p]" : : [p] "m" (*(const volatile char *)p)); 62 | } 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif /* _RTE_PREFETCH_X86_64_H_ */ 69 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_random.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_RANDOM_H_ 35 | #define _RTE_RANDOM_H_ 36 | 37 | /** 38 | * @file 39 | * 40 | * Pseudo-random Generators in RTE 41 | */ 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #include 48 | #include 49 | 50 | /** 51 | * Seed the pseudo-random generator. 52 | * 53 | * The generator is automatically seeded by the EAL init with a timer 54 | * value. It may need to be re-seeded by the user with a real random 55 | * value. 56 | * 57 | * @param seedval 58 | * The value of the seed. 59 | */ 60 | static inline void 61 | rte_srand(uint64_t seedval) 62 | { 63 | srand48((long unsigned int)seedval); 64 | } 65 | 66 | /** 67 | * Get a pseudo-random value. 68 | * 69 | * This function generates pseudo-random numbers using the linear 70 | * congruential algorithm and 48-bit integer arithmetic, called twice 71 | * to generate a 64-bit value. 72 | * 73 | * @return 74 | * A pseudo-random value between 0 and (1<<64)-1. 75 | */ 76 | static inline uint64_t 77 | rte_rand(void) 78 | { 79 | uint64_t val; 80 | val = lrand48(); 81 | val <<= 32; 82 | val += lrand48(); 83 | return val; 84 | } 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | 91 | #endif /* _RTE_PER_LCORE_H_ */ 92 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_rtm.h: -------------------------------------------------------------------------------- 1 | #ifndef _RTE_RTM_H_ 2 | #define _RTE_RTM_H_ 1 3 | 4 | /* 5 | * Copyright (c) 2012,2013 Intel Corporation 6 | * Author: Andi Kleen 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that: (1) source code distributions 10 | * retain the above copyright notice and this paragraph in its entirety, (2) 11 | * distributions including binary code include the above copyright notice and 12 | * this paragraph in its entirety in the documentation or other materials 13 | * provided with the distribution 14 | * 15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 16 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18 | */ 19 | 20 | /* Official RTM intrinsics interface matching gcc/icc, but works 21 | on older gcc compatible compilers and binutils. */ 22 | 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | 30 | #define RTE_XBEGIN_STARTED (~0u) 31 | #define RTE_XABORT_EXPLICIT (1 << 0) 32 | #define RTE_XABORT_RETRY (1 << 1) 33 | #define RTE_XABORT_CONFLICT (1 << 2) 34 | #define RTE_XABORT_CAPACITY (1 << 3) 35 | #define RTE_XABORT_DEBUG (1 << 4) 36 | #define RTE_XABORT_NESTED (1 << 5) 37 | #define RTE_XABORT_CODE(x) (((x) >> 24) & 0xff) 38 | 39 | static __attribute__((__always_inline__)) inline 40 | unsigned int rte_xbegin(void) 41 | { 42 | unsigned int ret = RTE_XBEGIN_STARTED; 43 | 44 | asm volatile(".byte 0xc7,0xf8 ; .long 0" : "+a" (ret) :: "memory"); 45 | return ret; 46 | } 47 | 48 | static __attribute__((__always_inline__)) inline 49 | void rte_xend(void) 50 | { 51 | asm volatile(".byte 0x0f,0x01,0xd5" ::: "memory"); 52 | } 53 | 54 | /* not an inline function to workaround a clang bug with -O0 */ 55 | #define rte_xabort(status) do { \ 56 | asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); \ 57 | } while (0) 58 | 59 | static __attribute__((__always_inline__)) inline 60 | int rte_xtest(void) 61 | { 62 | unsigned char out; 63 | 64 | asm volatile(".byte 0x0f,0x01,0xd6 ; setnz %0" : 65 | "=r" (out) :: "memory"); 66 | return out; 67 | } 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* _RTE_RTM_H_ */ 74 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_rwlock.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2015 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef _RTE_RWLOCK_X86_64_H_ 35 | #define _RTE_RWLOCK_X86_64_H_ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | #include "generic/rte_rwlock.h" 42 | #include "rte_spinlock.h" 43 | 44 | static inline void 45 | rte_rwlock_read_lock_tm(rte_rwlock_t *rwl) 46 | { 47 | if (likely(rte_try_tm(&rwl->cnt))) 48 | return; 49 | rte_rwlock_read_lock(rwl); 50 | } 51 | 52 | static inline void 53 | rte_rwlock_read_unlock_tm(rte_rwlock_t *rwl) 54 | { 55 | if (unlikely(rwl->cnt)) 56 | rte_rwlock_read_unlock(rwl); 57 | else 58 | rte_xend(); 59 | } 60 | 61 | static inline void 62 | rte_rwlock_write_lock_tm(rte_rwlock_t *rwl) 63 | { 64 | if (likely(rte_try_tm(&rwl->cnt))) 65 | return; 66 | rte_rwlock_write_lock(rwl); 67 | } 68 | 69 | static inline void 70 | rte_rwlock_write_unlock_tm(rte_rwlock_t *rwl) 71 | { 72 | if (unlikely(rwl->cnt)) 73 | rte_rwlock_write_unlock(rwl); 74 | else 75 | rte_xend(); 76 | } 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* _RTE_RWLOCK_X86_64_H_ */ 83 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_string_fns.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | /** 35 | * @file 36 | * 37 | * String-related functions as replacement for libc equivalents 38 | */ 39 | 40 | #ifndef _RTE_STRING_FNS_H_ 41 | #define _RTE_STRING_FNS_H_ 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /** 48 | * Takes string "string" parameter and splits it at character "delim" 49 | * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like 50 | * strtok or strsep functions, this modifies its input string, by replacing 51 | * instances of "delim" with '\\0'. All resultant tokens are returned in the 52 | * "tokens" array which must have enough entries to hold "maxtokens". 53 | * 54 | * @param string 55 | * The input string to be split into tokens 56 | * 57 | * @param stringlen 58 | * The max length of the input buffer 59 | * 60 | * @param tokens 61 | * The array to hold the pointers to the tokens in the string 62 | * 63 | * @param maxtokens 64 | * The number of elements in the tokens array. At most, maxtokens-1 splits 65 | * of the string will be done. 66 | * 67 | * @param delim 68 | * The character on which the split of the data will be done 69 | * 70 | * @return 71 | * The number of tokens in the tokens array. 72 | */ 73 | int 74 | rte_strsplit(char *string, int stringlen, 75 | char **tokens, int maxtokens, char delim); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* RTE_STRING_FNS_H */ 82 | -------------------------------------------------------------------------------- /Enclave/include/dpdk/rte_table_acl.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * BSD LICENSE 3 | * 4 | * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. 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 9 | * are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * * Neither the name of Intel Corporation nor the names of its 18 | * contributors may be used to endorse or promote products derived 19 | * from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __INCLUDE_RTE_TABLE_ACL_H__ 35 | #define __INCLUDE_RTE_TABLE_ACL_H__ 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * @file 43 | * RTE Table ACL 44 | * 45 | * This table uses the Access Control List (ACL) algorithm to uniquely 46 | * associate data to lookup keys. 47 | * 48 | * Use-cases: Firewall rule database, etc. 49 | * 50 | ***/ 51 | 52 | #include 53 | 54 | #include "rte_acl.h" 55 | 56 | #include "rte_table.h" 57 | 58 | /** ACL table parameters */ 59 | struct rte_table_acl_params { 60 | /** Name */ 61 | const char *name; 62 | 63 | /** Maximum number of ACL rules in the table */ 64 | uint32_t n_rules; 65 | 66 | /** Number of fields in the ACL rule specification */ 67 | uint32_t n_rule_fields; 68 | 69 | /** Format specification of the fields of the ACL rule */ 70 | struct rte_acl_field_def field_format[RTE_ACL_MAX_FIELDS]; 71 | }; 72 | 73 | /** ACL rule specification for entry add operation */ 74 | struct rte_table_acl_rule_add_params { 75 | /** ACL rule priority, with 0 as the highest priority */ 76 | int32_t priority; 77 | 78 | /** Values for the fields of the ACL rule to be added to the table */ 79 | struct rte_acl_field field_value[RTE_ACL_MAX_FIELDS]; 80 | }; 81 | 82 | /** ACL rule specification for entry delete operation */ 83 | struct rte_table_acl_rule_delete_params { 84 | /** Values for the fields of the ACL rule to be deleted from table */ 85 | struct rte_acl_field field_value[RTE_ACL_MAX_FIELDS]; 86 | }; 87 | 88 | /** ACL table operations */ 89 | extern struct rte_table_ops rte_table_acl_ops; 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /Enclave/include/system/adxintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _ADXINTRIN_H_INCLUDED 29 | #define _ADXINTRIN_H_INCLUDED 30 | 31 | extern __inline unsigned char 32 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 33 | _subborrow_u32 (unsigned char __CF, unsigned int __X, 34 | unsigned int __Y, unsigned int *__P) 35 | { 36 | return __builtin_ia32_sbb_u32 (__CF, __Y, __X, __P); 37 | } 38 | 39 | extern __inline unsigned char 40 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 41 | _addcarry_u32 (unsigned char __CF, unsigned int __X, 42 | unsigned int __Y, unsigned int *__P) 43 | { 44 | return __builtin_ia32_addcarryx_u32 (__CF, __X, __Y, __P); 45 | } 46 | 47 | extern __inline unsigned char 48 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 49 | _addcarryx_u32 (unsigned char __CF, unsigned int __X, 50 | unsigned int __Y, unsigned int *__P) 51 | { 52 | return __builtin_ia32_addcarryx_u32 (__CF, __X, __Y, __P); 53 | } 54 | 55 | #ifdef __x86_64__ 56 | extern __inline unsigned char 57 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 58 | _subborrow_u64 (unsigned char __CF, unsigned long long __X, 59 | unsigned long long __Y, unsigned long long *__P) 60 | { 61 | return __builtin_ia32_sbb_u64 (__CF, __Y, __X, __P); 62 | } 63 | 64 | extern __inline unsigned char 65 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 66 | _addcarry_u64 (unsigned char __CF, unsigned long long __X, 67 | unsigned long long __Y, unsigned long long *__P) 68 | { 69 | return __builtin_ia32_addcarryx_u64 (__CF, __X, __Y, __P); 70 | } 71 | 72 | extern __inline unsigned char 73 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 74 | _addcarryx_u64 (unsigned char __CF, unsigned long long __X, 75 | unsigned long long __Y, unsigned long long *__P) 76 | { 77 | return __builtin_ia32_addcarryx_u64 (__CF, __X, __Y, __P); 78 | } 79 | #endif 80 | 81 | #endif /* _ADXINTRIN_H_INCLUDED */ 82 | -------------------------------------------------------------------------------- /Enclave/include/system/ammintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2007-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | /* Implemented from the specification included in the AMD Programmers 25 | Manual Update, version 2.x */ 26 | 27 | #ifndef _AMMINTRIN_H_INCLUDED 28 | #define _AMMINTRIN_H_INCLUDED 29 | 30 | /* We need definitions from the SSE3, SSE2 and SSE header files*/ 31 | #include 32 | 33 | #ifndef __SSE4A__ 34 | #pragma GCC push_options 35 | #pragma GCC target("sse4a") 36 | #define __DISABLE_SSE4A__ 37 | #endif /* __SSE4A__ */ 38 | 39 | extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 40 | _mm_stream_sd (double * __P, __m128d __Y) 41 | { 42 | __builtin_ia32_movntsd (__P, (__v2df) __Y); 43 | } 44 | 45 | extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 46 | _mm_stream_ss (float * __P, __m128 __Y) 47 | { 48 | __builtin_ia32_movntss (__P, (__v4sf) __Y); 49 | } 50 | 51 | extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 52 | _mm_extract_si64 (__m128i __X, __m128i __Y) 53 | { 54 | return (__m128i) __builtin_ia32_extrq ((__v2di) __X, (__v16qi) __Y); 55 | } 56 | 57 | #ifdef __OPTIMIZE__ 58 | extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 59 | _mm_extracti_si64 (__m128i __X, unsigned const int __I, unsigned const int __L) 60 | { 61 | return (__m128i) __builtin_ia32_extrqi ((__v2di) __X, __I, __L); 62 | } 63 | #else 64 | #define _mm_extracti_si64(X, I, L) \ 65 | ((__m128i) __builtin_ia32_extrqi ((__v2di)(__m128i)(X), \ 66 | (unsigned int)(I), (unsigned int)(L))) 67 | #endif 68 | 69 | extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 70 | _mm_insert_si64 (__m128i __X,__m128i __Y) 71 | { 72 | return (__m128i) __builtin_ia32_insertq ((__v2di)__X, (__v2di)__Y); 73 | } 74 | 75 | #ifdef __OPTIMIZE__ 76 | extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 77 | _mm_inserti_si64(__m128i __X, __m128i __Y, unsigned const int __I, unsigned const int __L) 78 | { 79 | return (__m128i) __builtin_ia32_insertqi ((__v2di)__X, (__v2di)__Y, __I, __L); 80 | } 81 | #else 82 | #define _mm_inserti_si64(X, Y, I, L) \ 83 | ((__m128i) __builtin_ia32_insertqi ((__v2di)(__m128i)(X), \ 84 | (__v2di)(__m128i)(Y), \ 85 | (unsigned int)(I), (unsigned int)(L))) 86 | #endif 87 | 88 | #ifdef __DISABLE_SSE4A__ 89 | #undef __DISABLE_SSE4A__ 90 | #pragma GCC pop_options 91 | #endif /* __DISABLE_SSE4A__ */ 92 | 93 | #endif /* _AMMINTRIN_H_INCLUDED */ 94 | -------------------------------------------------------------------------------- /Enclave/include/system/bmmintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2007-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _BMMINTRIN_H_INCLUDED 25 | #define _BMMINTRIN_H_INCLUDED 26 | 27 | # error "SSE5 instruction set removed from compiler" 28 | 29 | #endif /* _BMMINTRIN_H_INCLUDED */ 30 | -------------------------------------------------------------------------------- /Enclave/include/system/clflushoptintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _CLFLUSHOPTINTRIN_H_INCLUDED 29 | #define _CLFLUSHOPTINTRIN_H_INCLUDED 30 | 31 | #ifndef __CLFLUSHOPT__ 32 | #pragma GCC push_options 33 | #pragma GCC target("clflushopt") 34 | #define __DISABLE_CLFLUSHOPT__ 35 | #endif /* __CLFLUSHOPT__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _mm_clflushopt (void *__A) 40 | { 41 | __builtin_ia32_clflushopt (__A); 42 | } 43 | 44 | #ifdef __DISABLE_CLFLUSHOPT__ 45 | #undef __DISABLE_CLFLUSHOPT__ 46 | #pragma GCC pop_options 47 | #endif /* __DISABLE_CLFLUSHOPT__ */ 48 | 49 | #endif /* _CLFLUSHOPTINTRIN_H_INCLUDED */ 50 | -------------------------------------------------------------------------------- /Enclave/include/system/clwbintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _CLWBINTRIN_H_INCLUDED 29 | #define _CLWBINTRIN_H_INCLUDED 30 | 31 | #ifndef __CLWB__ 32 | #pragma GCC push_options 33 | #pragma GCC target("clwb") 34 | #define __DISABLE_CLWB__ 35 | #endif /* __CLWB__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _mm_clwb (void *__A) 40 | { 41 | __builtin_ia32_clwb (__A); 42 | } 43 | 44 | #ifdef __DISABLE_CLWB__ 45 | #undef __DISABLE_CLWB__ 46 | #pragma GCC pop_options 47 | #endif /* __DISABLE_CLWB__ */ 48 | 49 | #endif /* _CLWBINTRIN_H_INCLUDED */ 50 | -------------------------------------------------------------------------------- /Enclave/include/system/f16cintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED 25 | # error "Never use directly; include or instead." 26 | #endif 27 | 28 | #ifndef _F16CINTRIN_H_INCLUDED 29 | #define _F16CINTRIN_H_INCLUDED 30 | 31 | #ifndef __F16C__ 32 | #pragma GCC push_options 33 | #pragma GCC target("f16c") 34 | #define __DISABLE_F16C__ 35 | #endif /* __F16C__ */ 36 | 37 | extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 38 | _cvtsh_ss (unsigned short __S) 39 | { 40 | __v8hi __H = __extension__ (__v8hi){ (short) __S, 0, 0, 0, 0, 0, 0, 0 }; 41 | __v4sf __A = __builtin_ia32_vcvtph2ps (__H); 42 | return __builtin_ia32_vec_ext_v4sf (__A, 0); 43 | } 44 | 45 | extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 46 | _mm_cvtph_ps (__m128i __A) 47 | { 48 | return (__m128) __builtin_ia32_vcvtph2ps ((__v8hi) __A); 49 | } 50 | 51 | extern __inline __m256 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 52 | _mm256_cvtph_ps (__m128i __A) 53 | { 54 | return (__m256) __builtin_ia32_vcvtph2ps256 ((__v8hi) __A); 55 | } 56 | 57 | #ifdef __OPTIMIZE__ 58 | extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 59 | _cvtss_sh (float __F, const int __I) 60 | { 61 | __v4sf __A = __extension__ (__v4sf){ __F, 0, 0, 0 }; 62 | __v8hi __H = __builtin_ia32_vcvtps2ph (__A, __I); 63 | return (unsigned short) __builtin_ia32_vec_ext_v8hi (__H, 0); 64 | } 65 | 66 | extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 67 | _mm_cvtps_ph (__m128 __A, const int __I) 68 | { 69 | return (__m128i) __builtin_ia32_vcvtps2ph ((__v4sf) __A, __I); 70 | } 71 | 72 | extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 73 | _mm256_cvtps_ph (__m256 __A, const int __I) 74 | { 75 | return (__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf) __A, __I); 76 | } 77 | #else 78 | #define _cvtss_sh(__F, __I) \ 79 | (__extension__ \ 80 | ({ \ 81 | __v4sf __A = __extension__ (__v4sf){ __F, 0, 0, 0 }; \ 82 | __v8hi __H = __builtin_ia32_vcvtps2ph (__A, __I); \ 83 | (unsigned short) __builtin_ia32_vec_ext_v8hi (__H, 0); \ 84 | })) 85 | 86 | #define _mm_cvtps_ph(A, I) \ 87 | ((__m128i) __builtin_ia32_vcvtps2ph ((__v4sf)(__m128) A, (int) (I))) 88 | 89 | #define _mm256_cvtps_ph(A, I) \ 90 | ((__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf)(__m256) A, (int) (I))) 91 | #endif /* __OPTIMIZE */ 92 | 93 | #ifdef __DISABLE_F16C__ 94 | #undef __DISABLE_F16C__ 95 | #pragma GCC pop_options 96 | #endif /* __DISABLE_F16C__ */ 97 | 98 | #endif /* _F16CINTRIN_H_INCLUDED */ 99 | -------------------------------------------------------------------------------- /Enclave/include/system/fxsrintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | /* #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED */ 25 | /* # error "Never use directly; include instead." */ 26 | /* #endif */ 27 | 28 | #ifndef _FXSRINTRIN_H_INCLUDED 29 | #define _FXSRINTRIN_H_INCLUDED 30 | 31 | #ifndef __FXSR__ 32 | #pragma GCC push_options 33 | #pragma GCC target("fxsr") 34 | #define __DISABLE_FXSR__ 35 | #endif /* __FXSR__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _fxsave (void *__P) 40 | { 41 | return __builtin_ia32_fxsave (__P); 42 | } 43 | 44 | extern __inline void 45 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 46 | _fxrstor (void *__P) 47 | { 48 | return __builtin_ia32_fxrstor (__P); 49 | } 50 | 51 | #ifdef __x86_64__ 52 | extern __inline void 53 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 54 | _fxsave64 (void *__P) 55 | { 56 | return __builtin_ia32_fxsave64 (__P); 57 | } 58 | 59 | extern __inline void 60 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 61 | _fxrstor64 (void *__P) 62 | { 63 | return __builtin_ia32_fxrstor64 (__P); 64 | } 65 | #endif 66 | 67 | #ifdef __DISABLE_FXSR__ 68 | #undef __DISABLE_FXSR__ 69 | #pragma GCC pop_options 70 | #endif /* __DISABLE_FXSR__ */ 71 | 72 | 73 | #endif /* _FXSRINTRIN_H_INCLUDED */ 74 | -------------------------------------------------------------------------------- /Enclave/include/system/lzcntintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | 29 | #ifndef _LZCNTINTRIN_H_INCLUDED 30 | #define _LZCNTINTRIN_H_INCLUDED 31 | 32 | #ifndef __LZCNT__ 33 | #pragma GCC push_options 34 | #pragma GCC target("lzcnt") 35 | #define __DISABLE_LZCNT__ 36 | #endif /* __LZCNT__ */ 37 | 38 | extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | __lzcnt16 (unsigned short __X) 40 | { 41 | return __builtin_clzs (__X); 42 | } 43 | 44 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 45 | __lzcnt32 (unsigned int __X) 46 | { 47 | return __builtin_clz (__X); 48 | } 49 | 50 | extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 51 | _lzcnt_u32 (unsigned int __X) 52 | { 53 | return __builtin_clz (__X); 54 | } 55 | 56 | #ifdef __x86_64__ 57 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 58 | __lzcnt64 (unsigned long long __X) 59 | { 60 | return __builtin_clzll (__X); 61 | } 62 | 63 | extern __inline unsigned long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 64 | _lzcnt_u64 (unsigned long long __X) 65 | { 66 | return __builtin_clzll (__X); 67 | } 68 | #endif 69 | 70 | #ifdef __DISABLE_LZCNT__ 71 | #undef __DISABLE_LZCNT__ 72 | #pragma GCC pop_options 73 | #endif /* __DISABLE_LZCNT__ */ 74 | 75 | #endif /* _LZCNTINTRIN_H_INCLUDED */ 76 | -------------------------------------------------------------------------------- /Enclave/include/system/mm_malloc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _MM_MALLOC_H_INCLUDED 25 | #define _MM_MALLOC_H_INCLUDED 26 | 27 | #include 28 | 29 | /* We can't depend on since the prototype of posix_memalign 30 | may not be visible. */ 31 | #ifndef __cplusplus 32 | extern int posix_memalign (void **, size_t, size_t); 33 | #else 34 | extern "C" int posix_memalign (void **, size_t, size_t) throw (); 35 | #endif 36 | 37 | static __inline void * 38 | _mm_malloc (size_t size, size_t alignment) 39 | { 40 | void *ptr; 41 | if (alignment == 1) 42 | return malloc (size); 43 | if (alignment == 2 || (sizeof (void *) == 8 && alignment == 4)) 44 | alignment = sizeof (void *); 45 | if (posix_memalign (&ptr, alignment, size) == 0) 46 | return ptr; 47 | else 48 | return NULL; 49 | } 50 | 51 | static __inline void 52 | _mm_free (void * ptr) 53 | { 54 | free (ptr); 55 | } 56 | 57 | #endif /* _MM_MALLOC_H_INCLUDED */ 58 | -------------------------------------------------------------------------------- /Enclave/include/system/mwaitxintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _MWAITXINTRIN_H_INCLUDED 25 | #define _MWAITXINTRIN_H_INCLUDED 26 | 27 | #ifndef __MWAITX__ 28 | #pragma GCC push_options 29 | #pragma GCC target("mwaitx") 30 | #define __DISABLE_MWAITX__ 31 | #endif /* __MWAITX__ */ 32 | 33 | extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 34 | _mm_monitorx (void const * __P, unsigned int __E, unsigned int __H) 35 | { 36 | __builtin_ia32_monitorx (__P, __E, __H); 37 | } 38 | 39 | extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 40 | _mm_mwaitx (unsigned int __E, unsigned int __H, unsigned int __C) 41 | { 42 | __builtin_ia32_mwaitx (__E, __H, __C); 43 | } 44 | 45 | #ifdef __DISABLE_MWAITX__ 46 | #undef __DISABLE_MWAITX__ 47 | #pragma GCC pop_options 48 | #endif /* __DISABLE_MWAITX__ */ 49 | 50 | #endif /* _MWAITXINTRIN_H_INCLUDED */ 51 | -------------------------------------------------------------------------------- /Enclave/include/system/nmmintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2007-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | /* Implemented from the specification included in the Intel C++ Compiler 25 | User Guide and Reference, version 10.0. */ 26 | 27 | #ifndef _NMMINTRIN_H_INCLUDED 28 | #define _NMMINTRIN_H_INCLUDED 29 | 30 | /* We just include SSE4.1 header file. */ 31 | #include 32 | 33 | #endif /* _NMMINTRIN_H_INCLUDED */ 34 | -------------------------------------------------------------------------------- /Enclave/include/system/pcommitintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _PCOMMITINTRIN_H_INCLUDED 29 | #define _PCOMMITINTRIN_H_INCLUDED 30 | 31 | #ifndef __PCOMMIT__ 32 | #pragma GCC push_options 33 | #pragma GCC target("pcommit") 34 | #define __DISABLE_PCOMMIT__ 35 | #endif /* __PCOMMIT__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _mm_pcommit (void) 40 | { 41 | __builtin_ia32_pcommit (); 42 | } 43 | 44 | #ifdef __DISABLE_PCOMMIT__ 45 | #undef __DISABLE_PCOMMIT__ 46 | #pragma GCC pop_options 47 | #endif /* __DISABLE_PCOMMIT__ */ 48 | 49 | #endif /* _PCOMMITINTRIN_H_INCLUDED */ 50 | -------------------------------------------------------------------------------- /Enclave/include/system/popcntintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _POPCNTINTRIN_H_INCLUDED 25 | #define _POPCNTINTRIN_H_INCLUDED 26 | 27 | #ifndef __POPCNT__ 28 | #pragma GCC push_options 29 | #pragma GCC target("popcnt") 30 | #define __DISABLE_POPCNT__ 31 | #endif /* __POPCNT__ */ 32 | 33 | /* Calculate a number of bits set to 1. */ 34 | extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 35 | _mm_popcnt_u32 (unsigned int __X) 36 | { 37 | return __builtin_popcount (__X); 38 | } 39 | 40 | #ifdef __x86_64__ 41 | extern __inline long long __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 42 | _mm_popcnt_u64 (unsigned long long __X) 43 | { 44 | return __builtin_popcountll (__X); 45 | } 46 | #endif 47 | 48 | #ifdef __DISABLE_POPCNT__ 49 | #undef __DISABLE_POPCNT__ 50 | #pragma GCC pop_options 51 | #endif /* __DISABLE_POPCNT__ */ 52 | 53 | #endif /* _POPCNTINTRIN_H_INCLUDED */ 54 | -------------------------------------------------------------------------------- /Enclave/include/system/prfchwintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED && !defined _MM3DNOW_H_INCLUDED 25 | # error "Never use directly; include or instead." 26 | #endif 27 | 28 | #ifndef _PRFCHWINTRIN_H_INCLUDED 29 | #define _PRFCHWINTRIN_H_INCLUDED 30 | 31 | extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 32 | _m_prefetchw (void *__P) 33 | { 34 | __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */); 35 | } 36 | 37 | #endif /* _PRFCHWINTRIN_H_INCLUDED */ 38 | -------------------------------------------------------------------------------- /Enclave/include/system/rdseedintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _RDSEEDINTRIN_H_INCLUDED 29 | #define _RDSEEDINTRIN_H_INCLUDED 30 | 31 | #ifndef __RDSEED__ 32 | #pragma GCC push_options 33 | #pragma GCC target("rdseed") 34 | #define __DISABLE_RDSEED__ 35 | #endif /* __RDSEED__ */ 36 | 37 | 38 | extern __inline int 39 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 40 | _rdseed16_step (unsigned short *p) 41 | { 42 | return __builtin_ia32_rdseed_hi_step (p); 43 | } 44 | 45 | extern __inline int 46 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 47 | _rdseed32_step (unsigned int *p) 48 | { 49 | return __builtin_ia32_rdseed_si_step (p); 50 | } 51 | 52 | #ifdef __x86_64__ 53 | extern __inline int 54 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 55 | _rdseed64_step (unsigned long long *p) 56 | { 57 | return __builtin_ia32_rdseed_di_step (p); 58 | } 59 | #endif 60 | 61 | #ifdef __DISABLE_RDSEED__ 62 | #undef __DISABLE_RDSEED__ 63 | #pragma GCC pop_options 64 | #endif /* __DISABLE_RDSEED__ */ 65 | 66 | #endif /* _RDSEEDINTRIN_H_INCLUDED */ 67 | -------------------------------------------------------------------------------- /Enclave/include/system/rtmintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _IMMINTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _RTMINTRIN_H_INCLUDED 29 | #define _RTMINTRIN_H_INCLUDED 30 | 31 | #ifndef __RTM__ 32 | #pragma GCC push_options 33 | #pragma GCC target("rtm") 34 | #define __DISABLE_RTM__ 35 | #endif /* __RTM__ */ 36 | 37 | #define _XBEGIN_STARTED (~0u) 38 | #define _XABORT_EXPLICIT (1 << 0) 39 | #define _XABORT_RETRY (1 << 1) 40 | #define _XABORT_CONFLICT (1 << 2) 41 | #define _XABORT_CAPACITY (1 << 3) 42 | #define _XABORT_DEBUG (1 << 4) 43 | #define _XABORT_NESTED (1 << 5) 44 | #define _XABORT_CODE(x) (((x) >> 24) & 0xFF) 45 | 46 | /* Start an RTM code region. Return _XBEGIN_STARTED on success and the 47 | abort condition otherwise. */ 48 | extern __inline unsigned int 49 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 50 | _xbegin (void) 51 | { 52 | return __builtin_ia32_xbegin (); 53 | } 54 | 55 | /* Specify the end of an RTM code region. If it corresponds to the 56 | outermost transaction, then attempts the transaction commit. If the 57 | commit fails, then control is transferred to the outermost transaction 58 | fallback handler. */ 59 | extern __inline void 60 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 61 | _xend (void) 62 | { 63 | __builtin_ia32_xend (); 64 | } 65 | 66 | /* Force an RTM abort condition. The control is transferred to the 67 | outermost transaction fallback handler with the abort condition IMM. */ 68 | #ifdef __OPTIMIZE__ 69 | extern __inline void 70 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 71 | _xabort (const unsigned int imm) 72 | { 73 | __builtin_ia32_xabort (imm); 74 | } 75 | #else 76 | #define _xabort(N) __builtin_ia32_xabort (N) 77 | #endif /* __OPTIMIZE__ */ 78 | 79 | #ifdef __DISABLE_RTM__ 80 | #undef __DISABLE_RTM__ 81 | #pragma GCC pop_options 82 | #endif /* __DISABLE_RTM__ */ 83 | 84 | #endif /* _RTMINTRIN_H_INCLUDED */ 85 | -------------------------------------------------------------------------------- /Enclave/include/system/shaintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _IMMINTRIN_H_INCLUDED 25 | #error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _SHAINTRIN_H_INCLUDED 29 | #define _SHAINTRIN_H_INCLUDED 30 | 31 | #ifndef __SHA__ 32 | #pragma GCC push_options 33 | #pragma GCC target("sha") 34 | #define __DISABLE_SHA__ 35 | #endif /* __SHA__ */ 36 | 37 | extern __inline __m128i 38 | __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 39 | _mm_sha1msg1_epu32 (__m128i __A, __m128i __B) 40 | { 41 | return (__m128i) __builtin_ia32_sha1msg1 ((__v4si) __A, (__v4si) __B); 42 | } 43 | 44 | extern __inline __m128i 45 | __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 46 | _mm_sha1msg2_epu32 (__m128i __A, __m128i __B) 47 | { 48 | return (__m128i) __builtin_ia32_sha1msg2 ((__v4si) __A, (__v4si) __B); 49 | } 50 | 51 | extern __inline __m128i 52 | __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 53 | _mm_sha1nexte_epu32 (__m128i __A, __m128i __B) 54 | { 55 | return (__m128i) __builtin_ia32_sha1nexte ((__v4si) __A, (__v4si) __B); 56 | } 57 | 58 | #ifdef __OPTIMIZE__ 59 | extern __inline __m128i 60 | __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 61 | _mm_sha1rnds4_epu32 (__m128i __A, __m128i __B, const int __I) 62 | { 63 | return (__m128i) __builtin_ia32_sha1rnds4 ((__v4si) __A, (__v4si) __B, __I); 64 | } 65 | #else 66 | #define _mm_sha1rnds4_epu32(A, B, I) \ 67 | ((__m128i) __builtin_ia32_sha1rnds4 ((__v4si)(__m128i)A, \ 68 | (__v4si)(__m128i)B, (int)I)) 69 | #endif 70 | 71 | extern __inline __m128i 72 | __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 73 | _mm_sha256msg1_epu32 (__m128i __A, __m128i __B) 74 | { 75 | return (__m128i) __builtin_ia32_sha256msg1 ((__v4si) __A, (__v4si) __B); 76 | } 77 | 78 | extern __inline __m128i 79 | __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 80 | _mm_sha256msg2_epu32 (__m128i __A, __m128i __B) 81 | { 82 | return (__m128i) __builtin_ia32_sha256msg2 ((__v4si) __A, (__v4si) __B); 83 | } 84 | 85 | extern __inline __m128i 86 | __attribute__ ((__gnu_inline__, __always_inline__, __artificial__)) 87 | _mm_sha256rnds2_epu32 (__m128i __A, __m128i __B, __m128i __C) 88 | { 89 | return (__m128i) __builtin_ia32_sha256rnds2 ((__v4si) __A, (__v4si) __B, 90 | (__v4si) __C); 91 | } 92 | 93 | #ifdef __DISABLE_SHA__ 94 | #undef __DISABLE_SHA__ 95 | #pragma GCC pop_options 96 | #endif /* __DISABLE_SHA__ */ 97 | 98 | #endif /* _SHAINTRIN_H_INCLUDED */ 99 | -------------------------------------------------------------------------------- /Enclave/include/system/termios.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TERMIOS_H 2 | #define _SYS_TERMIOS_H 3 | #include 4 | #endif 5 | -------------------------------------------------------------------------------- /Enclave/include/system/x86intrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2008-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _X86INTRIN_H_INCLUDED 25 | #define _X86INTRIN_H_INCLUDED 26 | 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | #include 34 | 35 | #include 36 | 37 | #include 38 | 39 | #include 40 | 41 | #include 42 | 43 | #include 44 | 45 | /* For including AVX instructions */ 46 | #include 47 | 48 | #include 49 | 50 | #include 51 | 52 | #include 53 | 54 | #include 55 | 56 | #include 57 | 58 | #include 59 | 60 | #include 61 | 62 | #include 63 | 64 | #include 65 | 66 | #include 67 | 68 | #include 69 | 70 | #include 71 | 72 | #include 73 | 74 | #include 75 | 76 | #include 77 | 78 | #include 79 | 80 | #include 81 | 82 | #include 83 | 84 | #include 85 | 86 | #include 87 | 88 | #include 89 | #endif /* _X86INTRIN_H_INCLUDED */ 90 | -------------------------------------------------------------------------------- /Enclave/include/system/xsavecintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _XSAVECINTRIN_H_INCLUDED 29 | #define _XSAVECINTRIN_H_INCLUDED 30 | 31 | #ifndef __XSAVEC__ 32 | #pragma GCC push_options 33 | #pragma GCC target("xsavec") 34 | #define __DISABLE_XSAVEC__ 35 | #endif /* __XSAVEC__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _xsavec (void *__P, long long __M) 40 | { 41 | __builtin_ia32_xsavec (__P, __M); 42 | } 43 | 44 | #ifdef __x86_64__ 45 | extern __inline void 46 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 47 | _xsavec64 (void *__P, long long __M) 48 | { 49 | __builtin_ia32_xsavec64 (__P, __M); 50 | } 51 | #endif 52 | 53 | #ifdef __DISABLE_XSAVEC__ 54 | #undef __DISABLE_XSAVEC__ 55 | #pragma GCC pop_options 56 | #endif /* __DISABLE_XSAVEC__ */ 57 | 58 | #endif /* _XSAVECINTRIN_H_INCLUDED */ 59 | -------------------------------------------------------------------------------- /Enclave/include/system/xsaveintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | /* #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED */ 25 | /* # error "Never use directly; include instead." */ 26 | /* #endif */ 27 | 28 | #ifndef _XSAVEINTRIN_H_INCLUDED 29 | #define _XSAVEINTRIN_H_INCLUDED 30 | 31 | #ifndef __XSAVE__ 32 | #pragma GCC push_options 33 | #pragma GCC target("xsave") 34 | #define __DISABLE_XSAVE__ 35 | #endif /* __XSAVE__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _xsave (void *__P, long long __M) 40 | { 41 | return __builtin_ia32_xsave (__P, __M); 42 | } 43 | 44 | extern __inline void 45 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 46 | _xrstor (void *__P, long long __M) 47 | { 48 | return __builtin_ia32_xrstor (__P, __M); 49 | } 50 | 51 | #ifdef __x86_64__ 52 | extern __inline void 53 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 54 | _xsave64 (void *__P, long long __M) 55 | { 56 | return __builtin_ia32_xsave64 (__P, __M); 57 | } 58 | 59 | extern __inline void 60 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 61 | _xrstor64 (void *__P, long long __M) 62 | { 63 | return __builtin_ia32_xrstor64 (__P, __M); 64 | } 65 | #endif 66 | 67 | #ifdef __DISABLE_XSAVE__ 68 | #undef __DISABLE_XSAVE__ 69 | #pragma GCC pop_options 70 | #endif /* __DISABLE_XSAVE__ */ 71 | 72 | #endif /* _XSAVEINTRIN_H_INCLUDED */ 73 | -------------------------------------------------------------------------------- /Enclave/include/system/xsaveoptintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | /* #if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED */ 25 | /* # error "Never use directly; include instead." */ 26 | /* #endif */ 27 | 28 | #ifndef _XSAVEOPTINTRIN_H_INCLUDED 29 | #define _XSAVEOPTINTRIN_H_INCLUDED 30 | 31 | #ifndef __XSAVEOPT__ 32 | #pragma GCC push_options 33 | #pragma GCC target("xsaveopt") 34 | #define __DISABLE_XSAVEOPT__ 35 | #endif /* __XSAVEOPT__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _xsaveopt (void *__P, long long __M) 40 | { 41 | return __builtin_ia32_xsaveopt (__P, __M); 42 | } 43 | 44 | #ifdef __x86_64__ 45 | extern __inline void 46 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 47 | _xsaveopt64 (void *__P, long long __M) 48 | { 49 | return __builtin_ia32_xsaveopt64 (__P, __M); 50 | } 51 | #endif 52 | 53 | #ifdef __DISABLE_XSAVEOPT__ 54 | #undef __DISABLE_XSAVEOPT__ 55 | #pragma GCC pop_options 56 | #endif /* __DISABLE_XSAVEOPT__ */ 57 | 58 | #endif /* _XSAVEOPTINTRIN_H_INCLUDED */ 59 | -------------------------------------------------------------------------------- /Enclave/include/system/xsavesintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2014-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #if !defined _X86INTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _XSAVESINTRIN_H_INCLUDED 29 | #define _XSAVESINTRIN_H_INCLUDED 30 | 31 | #ifndef __XSAVES__ 32 | #pragma GCC push_options 33 | #pragma GCC target("xsaves") 34 | #define __DISABLE_XSAVES__ 35 | #endif /* __XSAVES__ */ 36 | 37 | extern __inline void 38 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 39 | _xsaves (void *__P, long long __M) 40 | { 41 | __builtin_ia32_xsaves (__P, __M); 42 | } 43 | 44 | extern __inline void 45 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 46 | _xrstors (void *__P, long long __M) 47 | { 48 | __builtin_ia32_xrstors (__P, __M); 49 | } 50 | 51 | #ifdef __x86_64__ 52 | extern __inline void 53 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 54 | _xrstors64 (void *__P, long long __M) 55 | { 56 | __builtin_ia32_xrstors64 (__P, __M); 57 | } 58 | 59 | extern __inline void 60 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 61 | _xsaves64 (void *__P, long long __M) 62 | { 63 | __builtin_ia32_xsaves64 (__P, __M); 64 | } 65 | #endif 66 | 67 | #ifdef __DISABLE_XSAVES__ 68 | #undef __DISABLE_XSAVES__ 69 | #pragma GCC pop_options 70 | #endif /* __DISABLE_XSAVES__ */ 71 | 72 | #endif /* _XSAVESINTRIN_H_INCLUDED */ 73 | -------------------------------------------------------------------------------- /Enclave/include/system/xtestintrin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2015 Free Software Foundation, Inc. 2 | 3 | This file is part of GCC. 4 | 5 | GCC is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 3, or (at your option) 8 | any later version. 9 | 10 | GCC is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | Under Section 7 of GPL version 3, you are granted additional 16 | permissions described in the GCC Runtime Library Exception, version 17 | 3.1, as published by the Free Software Foundation. 18 | 19 | You should have received a copy of the GNU General Public License and 20 | a copy of the GCC Runtime Library Exception along with this program; 21 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22 | . */ 23 | 24 | #ifndef _IMMINTRIN_H_INCLUDED 25 | # error "Never use directly; include instead." 26 | #endif 27 | 28 | #ifndef _XTESTINTRIN_H_INCLUDED 29 | #define _XTESTINTRIN_H_INCLUDED 30 | 31 | #ifndef __RTM__ 32 | #pragma GCC push_options 33 | #pragma GCC target("rtm") 34 | #define __DISABLE_RTM__ 35 | #endif /* __RTM__ */ 36 | 37 | /* Return non-zero if the instruction executes inside an RTM or HLE code 38 | region. Return zero otherwise. */ 39 | extern __inline int 40 | __attribute__((__gnu_inline__, __always_inline__, __artificial__)) 41 | _xtest (void) 42 | { 43 | return __builtin_ia32_xtest (); 44 | } 45 | 46 | #ifdef __DISABLE_RTM__ 47 | #undef __DISABLE_RTM__ 48 | #pragma GCC pop_options 49 | #endif /* __DISABLE_RTM__ */ 50 | 51 | #endif /* _XTESTINTRIN_H_INCLUDED */ 52 | -------------------------------------------------------------------------------- /Enclave/io/stdio.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "io/stdio.h" 4 | #include "Enclave_t.h" 5 | 6 | int printf(const char *fmt, ...) 7 | { 8 | char buf[BUFSIZ] = {'\0'}; 9 | va_list ap; 10 | va_start(ap, fmt); 11 | vsnprintf(buf, BUFSIZ, fmt, ap); 12 | va_end(ap); 13 | ocall_print_string(buf); 14 | return 0; 15 | } 16 | 17 | int fprintf(FILE __rte_unused *f /* unused */, const char *fmt, ...) 18 | { 19 | char buf[BUFSIZ] = {'\0'}; 20 | va_list ap; 21 | va_start(ap, fmt); 22 | vsnprintf(buf, BUFSIZ, fmt, ap); 23 | va_end(ap); 24 | ocall_print_string(buf); 25 | return 0; 26 | } 27 | 28 | int vfprintf(FILE __rte_unused *f /* unused */, const char *fmt, va_list ap) 29 | { 30 | char buf[BUFSIZ] = {'\0'}; 31 | // va_start(ap, fmt); 32 | vsnprintf(buf, BUFSIZ, fmt, ap); 33 | // va_end(ap); 34 | ocall_print_string(buf); 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /Enclave/io/stdio.h: -------------------------------------------------------------------------------- 1 | #ifndef _IO_STDIO_H_ 2 | #define _IO_STDIO_H_ 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | //TODO(Deli): a dummy struct declaration 12 | struct _internal_FILE { 13 | uint64_t dummy; 14 | }; 15 | 16 | typedef struct _internal_FILE FILE; 17 | #define stderr NULL 18 | #define stdout NULL 19 | 20 | int printf(const char *fmt, ...); 21 | int fprintf(FILE *f, const char *fmt, ...); 22 | int vfprintf(FILE *f, const char *fmt, va_list ap); 23 | 24 | #ifdef __cplusplus 25 | }; 26 | #endif 27 | 28 | #endif /* _IO_STDIO_H_ */ 29 | -------------------------------------------------------------------------------- /Enclave/ip_pipeline/count_min_sketch.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "header_copy.h" 7 | #include "count_min_sketch.h" 8 | 9 | #ifdef ENABLE_INPUT_SKETCH 10 | struct count_min_t input_cm; 11 | #endif 12 | 13 | inline void 14 | cm_init(struct count_min_t *cm) { 15 | memset(cm, 0, sizeof(struct count_min_t)); 16 | 17 | for(size_t i = 0; i < CM_DEPTH; i++) { 18 | sgx_read_rand((unsigned char *)&cm->a[i], sizeof(cm->a[i])); 19 | sgx_read_rand((unsigned char *)&cm->b[i], sizeof(cm->b[i])); 20 | 21 | cm->a[i] = cm->a[i] % CM_PRIME; 22 | cm->b[i] = cm->b[i] % CM_PRIME; 23 | } 24 | } 25 | 26 | inline void 27 | cm_update(struct count_min_t *cm, struct header_cache *hc, uint64_t d) { 28 | uint64_t h = hash_crc_key16((void *)hc, 0, 0); 29 | 30 | for(size_t i = 0; i < CM_DEPTH; i++) { 31 | uint64_t j = (cm->a[i] * h + cm->b[i]) & (CM_WIDTH - 1); 32 | cm->counters[i][j] += d; 33 | } 34 | 35 | } 36 | 37 | inline void 38 | cm_update_bulk_hc(struct count_min_t *cm, struct header_cache *hc, 39 | uint16_t *lens, size_t n) { 40 | static uint64_t h[RTE_PORT_IN_BURST_SIZE_MAX] __rte_cache_aligned; 41 | static uint64_t j[RTE_PORT_IN_BURST_SIZE_MAX * CM_DEPTH] __rte_cache_aligned; 42 | 43 | // for(size_t i = 0; i < n; i++) { 44 | // h[i] = hash_crc_key16((void *)&hc[i], 0, 0); 45 | // } 46 | for(size_t i = 0; i < n; i++) { 47 | h[i] = hc[i].src_ip; 48 | } 49 | 50 | for(size_t p_i = 0; p_i < n; p_i++) { 51 | for (size_t i = 0; i < CM_DEPTH; i++) { 52 | j[p_i * CM_DEPTH + i] = (cm->a[i] * h[p_i] + cm->b[i]) & (CM_WIDTH - 1); 53 | } 54 | } 55 | 56 | for(size_t p_i = 0; p_i < n; p_i++) { 57 | for(size_t i = 0; i < CM_DEPTH; i++) { 58 | cm->counters[i][j[p_i * CM_DEPTH + i]] += lens[p_i]; 59 | } 60 | } 61 | } 62 | 63 | inline void 64 | cm_update_bulk_mbuf(struct count_min_t *cm, struct rte_mbuf **mbufs, size_t n) { 65 | static uint64_t h[RTE_PORT_IN_BURST_SIZE_MAX] __rte_cache_aligned; 66 | static size_t l[RTE_PORT_IN_BURST_SIZE_MAX] __rte_cache_aligned; 67 | static uint64_t j[RTE_PORT_IN_BURST_SIZE_MAX * CM_DEPTH] __rte_cache_aligned; 68 | 69 | // for(size_t i = 0; i < n; i++) { 70 | // h[i] = hash_crc_key16((void *)&hc[i], 0, 0); 71 | // } 72 | for(size_t i = 0; i < n; i++) { 73 | struct ether_hdr* eth_hdr = rte_pktmbuf_mtod(mbufs[i], struct ether_hdr *); 74 | struct ipv4_hdr *ipv4_hdr = 75 | (struct ipv4_hdr*) ((uint8_t *)eth_hdr + sizeof(struct ether_hdr)); 76 | 77 | h[i] = rte_be_to_cpu_32(ipv4_hdr->src_addr); 78 | l[i] = mbufs[i]->pkt_len; 79 | } 80 | 81 | for(size_t p_i = 0; p_i < n; p_i++) { 82 | for (size_t i = 0; i < CM_DEPTH; i++) { 83 | j[p_i * CM_DEPTH + i] = (cm->a[i] * h[p_i] + cm->b[i]) & (CM_WIDTH - 1); 84 | } 85 | } 86 | 87 | for(size_t p_i = 0; p_i < n; p_i++) { 88 | for(size_t i = 0; i < CM_DEPTH; i++) { 89 | cm->counters[i][j[p_i * CM_DEPTH + i]] += l[p_i]; 90 | } 91 | } 92 | } 93 | 94 | inline uint64_t 95 | cm_estimate(struct count_min_t *cm, struct header_cache *hc) { 96 | uint64_t h = hash_crc_key16((void *)hc, 0, 0); 97 | uint64_t result = UINT64_MAX; 98 | 99 | for(size_t i = 0; i < CM_DEPTH; i++) { 100 | uint64_t j = (cm->a[i] * h + cm->b[i]) & (CM_WIDTH - 1); 101 | result = (cm->counters[i][j] < result) ? cm->counters[i][j] : result; 102 | } 103 | 104 | return result; 105 | } 106 | -------------------------------------------------------------------------------- /Enclave/ip_pipeline/count_min_sketch.h: -------------------------------------------------------------------------------- 1 | #ifndef _COUNT_MIN_SKETCH_ 2 | #define _COUNT_MIN_SKETCH_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "hash_func.h" 10 | 11 | #define CM_W_BITS (16) 12 | #define CM_WIDTH (1 << CM_W_BITS) 13 | // w = ceil(e/epsilon) 14 | 15 | #define CM_DEPTH 2 16 | // d = ceil(ln(1/delta)) 17 | 18 | #define CM_PRIME (4294967231) 19 | 20 | struct count_min_t { 21 | uint64_t counters[CM_DEPTH][CM_WIDTH]; 22 | 23 | uint32_t a[CM_DEPTH]; 24 | uint32_t b[CM_DEPTH]; 25 | }; 26 | 27 | extern struct count_min_t input_cm; 28 | 29 | struct rte_mbuf; 30 | struct header_cache; 31 | 32 | void cm_init(struct count_min_t *cm); 33 | 34 | void cm_update(struct count_min_t *cm, struct header_cache *hc, uint64_t d); 35 | 36 | void cm_update_bulk_hc(struct count_min_t *cm, struct header_cache *hc, uint16_t *lens, size_t n); 37 | 38 | void cm_update_bulk_mbuf(struct count_min_t *cm, struct rte_mbuf **mbufs, size_t n); 39 | 40 | uint64_t cm_estimate(struct count_min_t *cm, struct header_cache *hc); 41 | 42 | #endif/* _COUNT_MIN_SKETCH_ */ 43 | -------------------------------------------------------------------------------- /Enclave/ip_pipeline/full_copy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "count_min_sketch.h" 9 | #include "full_copy.h" 10 | 11 | struct rte_mempool *enclave_mempool; 12 | 13 | struct rte_mbuf* saved_mbufs[RTE_PORT_IN_BURST_SIZE_MAX] __rte_cache_aligned; 14 | 15 | void init_copy_mempool(void) { 16 | enclave_mempool = rte_pktmbuf_pool_create("enclave_mempool", 17 | RTE_PORT_IN_BURST_SIZE_MAX, 0, 0, 18 | RTE_MBUF_DEFAULT_BUF_SIZE, SOCKET_ID_ANY); 19 | if (enclave_mempool == NULL) { 20 | RTE_LOG(ERR, APP, "enclave_mempool cannot be allocated\n"); 21 | abort(); 22 | } 23 | RTE_LOG(DEBUG, APP, "enclave mempool available count %" PRIu32 "\n", 24 | rte_mempool_avail_count(enclave_mempool)); 25 | } 26 | 27 | void print_pkt_detail(struct rte_mbuf *m); 28 | 29 | void print_pkt_detail(struct rte_mbuf *m) { 30 | struct ether_hdr* eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); 31 | 32 | RTE_ASSERT(eth_hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)); 33 | 34 | struct ipv4_hdr *ipv4_hdr = 35 | (struct ipv4_hdr*) ((uint8_t *)eth_hdr + sizeof(struct ether_hdr)); 36 | 37 | // clone metadata from IP header 38 | uint32_t src_ip = rte_be_to_cpu_32(ipv4_hdr->src_addr); 39 | uint32_t dst_ip = rte_be_to_cpu_32(ipv4_hdr->dst_addr); 40 | 41 | RTE_LOG(DEBUG, APP, "pkt(%p) src_ip:%u dst_ip:%u\n", m, src_ip, dst_ip); 42 | 43 | uint8_t proto = ipv4_hdr->next_proto_id; 44 | RTE_LOG(DEBUG, APP, "pkt(%p) proto %d\n", m, proto); 45 | 46 | struct tcp_hdr *tcp_hdr = (struct tcp_hdr*) \ 47 | ((uint8_t *)ipv4_hdr + sizeof(struct ipv4_hdr)); 48 | 49 | uint16_t src_port = rte_be_to_cpu_16(tcp_hdr->src_port); 50 | uint16_t dst_port = rte_be_to_cpu_16(tcp_hdr->dst_port); 51 | 52 | RTE_LOG(DEBUG, APP, "pkt(%p) src_port:%u dst_port:%u\n", m, src_port, dst_port); 53 | } 54 | 55 | inline int 56 | input_port_make_full_copy(struct rte_pipeline __rte_unused *p, 57 | struct rte_mbuf __rte_unused **pkts, uint32_t n, void __rte_unused *arg) { 58 | 59 | for(size_t i = 0; i < n; i++) { 60 | // FIXME: not work after classification 61 | /* saved_mbufs[i] = pkts[i]; */ 62 | /* pkts[i] = rte_pktmbuf_copy(saved_mbufs[i], enclave_mempool); */ 63 | saved_mbufs[i] = rte_pktmbuf_copy(pkts[i], enclave_mempool); 64 | if (unlikely(saved_mbufs[i] == NULL)) { 65 | rte_panic("enclave mempool exhausted\n"); 66 | } 67 | } 68 | 69 | #ifdef ENABLE_INPUT_SKETCH 70 | cm_update_bulk_mbuf(&input_cm, pkts, n); 71 | #endif 72 | 73 | return 0; 74 | } 75 | 76 | inline int 77 | output_port_free_full_copy(struct rte_pipeline __rte_unused *p, 78 | struct rte_mbuf __rte_unused **pkts, uint64_t pkts_mask, void __rte_unused *arg) { 79 | 80 | uint64_t pkts_i = 1; 81 | for(size_t i = 0; i < 64; i++, pkts_i <<= 1) { 82 | if (pkts_mask & pkts_i) { 83 | // FIXME: need to check input_port_make_full_copy 84 | /* rte_pktmbuf_free(pkts[i]); */ 85 | /* pkts[i] = saved_mbufs[i]; */ 86 | rte_pktmbuf_free(saved_mbufs[i]); 87 | } 88 | } 89 | 90 | return 0; 91 | } 92 | -------------------------------------------------------------------------------- /Enclave/ip_pipeline/full_copy.h: -------------------------------------------------------------------------------- 1 | #ifndef _FULL_COPY_H_ 2 | #define _FULL_COPY_H_ 3 | 4 | void init_copy_mempool(void); 5 | 6 | int 7 | input_port_make_full_copy(struct rte_pipeline __rte_unused *p, 8 | struct rte_mbuf **pkts, uint32_t n, void *arg); 9 | 10 | int 11 | output_port_free_full_copy(struct rte_pipeline __rte_unused *p, 12 | struct rte_mbuf **pkts, uint64_t pkts_mask, void *arg); 13 | 14 | #endif/* _FULL_COPY_H_ */ 15 | -------------------------------------------------------------------------------- /Enclave/ip_pipeline/header_copy.c: -------------------------------------------------------------------------------- 1 | #include "header_copy.h" 2 | 3 | #ifdef ENABLE_HEADER_COPY 4 | struct header_cache headers[RTE_PORT_IN_BURST_SIZE_MAX]; 5 | #endif 6 | -------------------------------------------------------------------------------- /Enclave/ip_pipeline/header_copy.h: -------------------------------------------------------------------------------- 1 | #ifndef _SKETCH_H_ 2 | #define _SKETCH_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "count_min_sketch.h" 13 | 14 | struct header_cache { 15 | uint32_t src_ip; 16 | uint32_t dst_ip; 17 | uint16_t src_port; 18 | uint16_t dst_port; 19 | uint8_t proto; 20 | uint8_t dummy; 21 | uint16_t pkt_len; 22 | // 32*4 = 128 / 8 = 16 23 | } __rte_cache_aligned; 24 | 25 | extern struct header_cache headers[RTE_PORT_IN_BURST_SIZE_MAX]; 26 | 27 | static inline void 28 | header_cache_clone(struct rte_mbuf* m, struct header_cache *hc, uint16_t *len) { 29 | struct ether_hdr* eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *); 30 | 31 | RTE_ASSERT(eth_hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)); 32 | 33 | struct ipv4_hdr *ipv4_hdr = 34 | (struct ipv4_hdr*) ((uint8_t *)eth_hdr + sizeof(struct ether_hdr)); 35 | 36 | // clone metadata from IP header 37 | hc->src_ip = rte_be_to_cpu_32(ipv4_hdr->src_addr); 38 | hc->dst_ip = rte_be_to_cpu_32(ipv4_hdr->dst_addr); 39 | 40 | // user Ethernet frame length 41 | hc->pkt_len = 0; 42 | hc->dummy = 0; 43 | *len = m->pkt_len; 44 | 45 | // or use IP layer length 46 | /* hc->size = rte_be_to_cpu_16(ipv4_hdr->total_length); */ 47 | 48 | hc->proto = ipv4_hdr->next_proto_id; 49 | 50 | struct tcp_hdr *tcp_hdr = (struct tcp_hdr*) \ 51 | ((uint8_t *)ipv4_hdr + sizeof(struct ipv4_hdr)); 52 | 53 | hc->src_port = rte_be_to_cpu_16(tcp_hdr->src_port); 54 | hc->dst_port = rte_be_to_cpu_16(tcp_hdr->dst_port); 55 | } 56 | 57 | static inline int 58 | input_port_make_header_copy(struct rte_pipeline __rte_unused *p, 59 | struct rte_mbuf **pkts, uint32_t n, void __rte_unused *arg) { 60 | uint16_t pkt_lens[RTE_PORT_IN_BURST_SIZE_MAX]; 61 | 62 | for(size_t i = 0; i < n; i++) { 63 | struct rte_mbuf* pkt = pkts[i]; 64 | header_cache_clone(pkt, &headers[i], &pkt_lens[i]); 65 | } 66 | 67 | #ifdef ENABLE_INPUT_SKETCH 68 | cm_update_bulk_hc(&input_cm, headers, pkt_lens, n); 69 | #endif 70 | 71 | for(size_t i = 0; i < n; i++) { 72 | headers[i].pkt_len = pkt_lens[i]; 73 | } 74 | 75 | return 0; 76 | } 77 | 78 | #endif/* _SKETCH_H_ */ 79 | 80 | -------------------------------------------------------------------------------- /Enclave/net/in.h: -------------------------------------------------------------------------------- 1 | #ifndef _NETINET_IN_H 2 | #define _NETINET_IN_H 3 | 4 | struct in_addr *ipv4; 5 | struct in6_addr *ipv6; 6 | 7 | #endif /* _NETINET_IN_H */ 8 | 9 | 10 | -------------------------------------------------------------------------------- /Enclave/proxy_type.h: -------------------------------------------------------------------------------- 1 | /* proxy types used only in EDL files */ 2 | 3 | struct pipeline_params; 4 | struct app_thread_data; 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 InNetworkFiltering 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /config/firewall.cfg: -------------------------------------------------------------------------------- 1 | ; BSD LICENSE 2 | ; 3 | ; Copyright(c) 2015-2016 Intel Corporation. All rights reserved. 4 | ; 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 Intel Corporation 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 | ; | | 34 | ; RXQ0.0 --->| Firewall |---> TXQ0.0 35 | ; |_______________| 36 | ; | 37 | ; +-----------> SINK0 (default rule) 38 | ; 39 | ; Input packet: Ethernet/IPv4 40 | ; 41 | ; Packet buffer layout: 42 | ; # Field Name Offset (Bytes) Size (Bytes) 43 | ; 0 Mbuf 0 128 44 | ; 1 Headroom 128 128 45 | ; 2 Ethernet header 256 14 46 | ; 3 IPv4 header 270 20 47 | 48 | [EAL] 49 | log_level = 9 50 | 51 | [PIPELINE0] 52 | type = MASTER 53 | core = 0 54 | 55 | [PIPELINE1] 56 | type = FIREWALL 57 | core = 1 58 | pktq_in = RXQ0.0 59 | pktq_out = TXQ0.0 SINK0 60 | n_rules = 524288 61 | ; 2^18 = 262144 62 | ; 2^19 = 524288 63 | pkt_type = ipv4 64 | ;pkt_type = vlan_ipv4 65 | ;pkt_type = qinq_ipv4 66 | -------------------------------------------------------------------------------- /config/firewall.sh: -------------------------------------------------------------------------------- 1 | # 2 | # run ./config/firewall.sh 3 | # 4 | 5 | p 1 firewall add default 4 #SINK0 6 | p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.0.0.0 10 0 65535 0 65535 6 0xF port 0 7 | p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.64.0.0 10 0 65535 0 65535 6 0xF port 1 8 | p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.128.0.0 10 0 65535 0 65535 6 0xF port 2 9 | p 1 firewall add priority 1 ipv4 0.0.0.0 0 100.192.0.0 10 0 65535 0 65535 6 0xF port 3 10 | 11 | #p 1 firewall add bulk ./config/firewall.txt 12 | 13 | p 1 firewall ls 14 | -------------------------------------------------------------------------------- /config/gen-firewall-rules.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import ipaddress 5 | 6 | f = open("firewall-rules.txt", "w+") 7 | 8 | src_ip_str = '10.0.0.0/25' # 2^7 9 | dst_ip_str = '192.168.0.0/25' # 2^7 10 | 11 | src_port_max = 2**3 # 2^3 12 | dst_port_max = 1 13 | 14 | rule_str = 'priority 1 ipv4 {} {} {} {} {} {} {} {} 6 0xF port 0\n' 15 | 16 | src_net = ipaddress.ip_network(src_ip_str) 17 | dst_net = ipaddress.ip_network(dst_ip_str) 18 | 19 | for src_ip in src_net: 20 | for dst_ip in dst_net: 21 | for src_port in range(src_port_max): 22 | for dst_port in range(dst_port_max): 23 | f.write(rule_str.format( 24 | str(src_ip), 32, 25 | str(dst_ip), 32, 26 | src_port, src_port, 27 | dst_port, dst_port)); 28 | 29 | f.close() 30 | 31 | # firewall ACL Information 32 | # 33 | # ACL: Gen phase for ACL "PIPELINE1_a": 34 | # runtime memory footprint on socket 0: 35 | # single nodes/bytes used: 0/0 36 | # quad nodes/vectors/bytes used: 278915/836745/6693960 37 | # DFA nodes/group64/bytes used: 16514/33159/16979464 38 | # match nodes/bytes used: 131072/16777216 39 | # total: 40452848 bytes 40 | # max limit: 18446744073709551615 bytes 41 | # ACL: Build phase for ACL "PIPELINE1_a": 42 | # node limit for tree split: 2048 43 | # nodes created: 426501 44 | # memory consumed: 461373825 45 | # ACL: trie 0: number of rules: 131072, indexes: 4 46 | 47 | # pktgen Information 48 | # Pkts/s Max/Rx : 13177127/0 13177127/0 49 | # Max/Tx : 14882877/0 14882877/0 50 | -------------------------------------------------------------------------------- /config/gen-random-firewall-rules.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import sys 4 | import ipaddress 5 | import random 6 | 7 | max_n_rules = 65536 8 | 9 | f = open("random-firewall-rules.txt", "w+") 10 | 11 | rule_str = 'priority 1 ipv4 {} {} {} {} {} {} {} {} 6 0xF port 1\n' 12 | 13 | hit_rule = rule_str.format('10.0.0.0', 32, '192.168.0.0', 32, 0, 0, 0, 0) 14 | 15 | f.write(hit_rule) 16 | 17 | for i in range(max_n_rules - 1): 18 | src_ip = ipaddress.ip_address(random.randrange(2**32)) 19 | dst_ip = ipaddress.ip_address(random.randrange(2**32)) 20 | src_port = random.randrange(65536) 21 | dst_port = random.randrange(65536) 22 | 23 | f.write(rule_str.format( 24 | str(src_ip), 32, 25 | str(dst_ip), 32, 26 | src_port, src_port, 27 | dst_port, dst_port)); 28 | 29 | f.close() 30 | 31 | # ACL Information 32 | # ACL: Gen phase for ACL "PIPELINE1_a": 33 | # runtime memory footprint on socket 0: 34 | # single nodes/bytes used: 0/0 35 | # quad nodes/vectors/bytes used: 625920/1897121/15176968 36 | # DFA nodes/group64/bytes used: 5478/18853/9654792 37 | # match nodes/bytes used: 65536/8388608 38 | # total: 33222576 bytes 39 | # max limit: 18446744073709551615 bytes 40 | # ACL: Build phase for ACL "PIPELINE1_a": 41 | # node limit for tree split: 2048 42 | # nodes created: 696934 43 | # memory consumed: 922747650 44 | # ACL: trie 0: number of rules: 65536, indexes: 4 45 | 46 | -------------------------------------------------------------------------------- /config/import-firewall-rules.sh: -------------------------------------------------------------------------------- 1 | # 2 | # run ./config/import-firewall-rules.sh 3 | # 4 | 5 | p 1 firewall add default 1 #SINK0 6 | p 1 firewall add bulk ./config/firewall-rules.txt 7 | -------------------------------------------------------------------------------- /config/sgx_firewall.cfg: -------------------------------------------------------------------------------- 1 | [EAL] 2 | log_level = 9 3 | 4 | [PIPELINE0] 5 | type = MASTER 6 | core = 0 7 | 8 | [PIPELINE1] 9 | type = PASS-THROUGH 10 | core = 1 11 | pktq_in = RXQ0.0 12 | pktq_out = SWQ0 13 | 14 | [PIPELINE2] 15 | type = FIREWALL 16 | core = 2 17 | pktq_in = SWQ0 18 | pktq_out = SWQ1 SWQ2 19 | n_rules = 131072 20 | pkt_type = ipv4 21 | ;pkt_type = vlan_ipv4 22 | ;pkt_type = qinq_ipv4 23 | 24 | [PIPELINE3] 25 | type = PASS-THROUGH 26 | core = 3 27 | pktq_in = SWQ1 SWQ2 28 | pktq_out = TXQ0.0 SINK0 29 | 30 | ; dropless option avoids ocall_rte_pktmbuf_free, applies to TWQ, SWQ 31 | ; see http://dpdk.org/doc/guides-17.05/sample_app_ug/ip_pipeline.html#configuration-file-syntax 32 | [SWQ0] 33 | dropless = YES 34 | 35 | [SWQ1] 36 | dropless = YES 37 | 38 | [SWQ2] 39 | dropless = YES 40 | 41 | [TXQ0.0] 42 | dropless = YES 43 | --------------------------------------------------------------------------------