| 1 | /******************************************************************************* |
| 2 | Copyright (c) 2012-2024, Intel Corporation |
| 3 | |
| 4 | Redistribution and use in source and binary forms, with or without |
| 5 | modification, are permitted provided that the following conditions are met: |
| 6 | |
| 7 | * Redistributions of source code must retain the above copyright notice, |
| 8 | this list of conditions and the following disclaimer. |
| 9 | * Redistributions in binary form must reproduce the above copyright |
| 10 | notice, this list of conditions and the following disclaimer in the |
| 11 | documentation and/or other materials provided with the distribution. |
| 12 | * Neither the name of Intel Corporation nor the names of its contributors |
| 13 | may be used to endorse or promote products derived from this software |
| 14 | without specific prior written permission. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
| 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | *******************************************************************************/ |
| 27 | |
| 28 | #include "intel-ipsec-mb.h"cxx . . $ `<file>/lib/intel-ipsec-mb.h`/ |
| 29 | #include "include/ipsec_ooo_mgr.h"cxx . . $ `<file>/lib/include/ipsec_ooo_mgr.h`/ |
| 30 | #include "include/cpu_feature.h"cxx . . $ `<file>/lib/include/cpu_feature.h`/ |
| 31 | #include "include/error.h"cxx . . $ `<file>/lib/include/error.h`/ |
| 32 | #include "include/arch_x86_64.h"cxx . . $ `<file>/lib/include/arch_x86_64.h`/ |
| 33 | |
| 34 | IMB_DLL_LOCALcxx . . $ `lib/intel-ipsec-mb.h:55:9`! void |
| 35 | init_mb_mgr_avx2_internalcxx . . $ init_mb_mgr_avx2_internal(beec41fcb78e7267).(IMB_MGRcxx . . $ IMB_MGR# *state, const int reset_mgrs) |
| 36 | { |
| 37 | #ifdef SAFE_PARAMcxx . . $ `<built-in>:418:9`! |
| 38 | if (state == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!) { |
| 39 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, IMB_ERR_NULL_MBMGRcxx . . $ IMB_ERR_NULL_MBMGR.); |
| 40 | return; |
| 41 | } |
| 42 | #endif |
| 43 | |
| 44 | /* Check minimum CPU flags needed for AVX2 interface */ |
| 45 | if ((state->featurescxx . . $ IMB_MGR#features. & IMB_CPUFLAGS_AVX2cxx . . $ `lib/intel-ipsec-mb.h:955:9`!) != IMB_CPUFLAGS_AVX2cxx . . $ `lib/intel-ipsec-mb.h:955:9`!) { |
| 46 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(state, IMB_ERR_MISSING_CPUFLAGS_INIT_MGRcxx . . $ IMB_ERR_MISSING_CPUFLAGS_INIT_MGR.); |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | /* reset error status */ |
| 51 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(state, 0); |
| 52 | |
| 53 | state->featurescxx . . $ IMB_MGR#features. = cpu_feature_adjustcxx . . $ cpu_feature_adjust(80bad76eed2d2579).(state->flagscxx . . $ IMB_MGR#flags., cpu_feature_detectcxx . . $ cpu_feature_detect(f708dce9a8856c70).()); |
| 54 | |
| 55 | #ifdef SMX_NIcxx . . $ `<built-in>:415:9`! |
| 56 | if ((state->featurescxx . . $ IMB_MGR#features. & IMB_CPUFLAGS_AVX2_T4cxx . . $ `lib/intel-ipsec-mb.h:966:9`!) == IMB_CPUFLAGS_AVX2_T4cxx . . $ `lib/intel-ipsec-mb.h:966:9`!) { |
| 57 | init_mb_mgr_avx2_t4_internalcxx . . $ init_mb_mgr_avx2_t4_internal(beec41fcb78e7267).(state, reset_mgrs); |
| 58 | return; |
| 59 | } |
| 60 | #endif |
| 61 | #ifdef AVX_IFMAcxx . . $ `<built-in>:414:9`! |
| 62 | if ((state->featurescxx . . $ IMB_MGR#features. & IMB_CPUFLAGS_AVX2_T3cxx . . $ `lib/intel-ipsec-mb.h:965:9`!) == IMB_CPUFLAGS_AVX2_T3cxx . . $ `lib/intel-ipsec-mb.h:965:9`!) { |
| 63 | init_mb_mgr_avx2_t3_internalcxx . . $ init_mb_mgr_avx2_t3_internal(beec41fcb78e7267).(state, reset_mgrs); |
| 64 | return; |
| 65 | } |
| 66 | #endif |
| 67 | if ((state->featurescxx . . $ IMB_MGR#features. & IMB_CPUFLAGS_AVX2_T2cxx . . $ `lib/intel-ipsec-mb.h:962:9`!) == IMB_CPUFLAGS_AVX2_T2cxx . . $ `lib/intel-ipsec-mb.h:962:9`!) { |
| 68 | init_mb_mgr_avx2_t2_internalcxx . . $ init_mb_mgr_avx2_t2_internal(beec41fcb78e7267).(state, reset_mgrs); |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | init_mb_mgr_avx2_t1_internalcxx . . $ init_mb_mgr_avx2_t1_internal(beec41fcb78e7267).(state, reset_mgrs); |
| 73 | } |
| 74 | |
| 75 | void |
| 76 | init_mb_mgr_avx2cxx . . $ init_mb_mgr_avx2(d2992fa56a02ae3c).(IMB_MGRcxx . . $ IMB_MGR# *state) |
| 77 | { |
| 78 | init_mb_mgr_avx2_internalcxx . . $ init_mb_mgr_avx2_internal(beec41fcb78e7267).(state, 1); |
| 79 | |
| 80 | if (!self_testcxx . . $ self_test(6cff3712caec28fb).(state)) |
| 81 | imb_set_errnocxx . . $ imb_set_errno(beec41fcb78e7267).(state, IMB_ERR_SELFTESTcxx . . $ IMB_ERR_SELFTEST.); |
| 82 | } |
| 83 | |
| 84 | IMB_JOBcxx . . $ IMB_JOB# * |
| 85 | submit_job_avx2cxx . . $ submit_job_avx2(ba76486f76b4ebf4).(IMB_MGRcxx . . $ IMB_MGR# *state) |
| 86 | { |
| 87 | return IMB_SUBMIT_JOBcxx . . $ `lib/intel-ipsec-mb.h:1507:9`!(state); |
| 88 | } |
| 89 | |
| 90 | IMB_JOBcxx . . $ IMB_JOB# * |
| 91 | flush_job_avx2cxx . . $ flush_job_avx2(ba76486f76b4ebf4).(IMB_MGRcxx . . $ IMB_MGR# *state) |
| 92 | { |
| 93 | return IMB_FLUSH_JOBcxx . . $ `lib/intel-ipsec-mb.h:1536:9`!(state); |
| 94 | } |
| 95 | |
| 96 | uint32_tcxx . . $ uint32_t# |
| 97 | queue_size_avx2cxx . . $ queue_size_avx2(54eb936152da7ef6).(IMB_MGRcxx . . $ IMB_MGR# *state) |
| 98 | { |
| 99 | return IMB_QUEUE_SIZEcxx . . $ `lib/intel-ipsec-mb.h:1545:9`!(state); |
| 100 | } |
| 101 | |
| 102 | IMB_JOBcxx . . $ IMB_JOB# * |
| 103 | submit_job_nocheck_avx2cxx . . $ submit_job_nocheck_avx2(ba76486f76b4ebf4).(IMB_MGRcxx . . $ IMB_MGR# *state) |
| 104 | { |
| 105 | return IMB_SUBMIT_JOB_NOCHECKcxx . . $ `lib/intel-ipsec-mb.h:1518:9`!(state); |
| 106 | } |
| 107 | |
| 108 | IMB_JOBcxx . . $ IMB_JOB# * |
| 109 | get_next_job_avx2cxx . . $ get_next_job_avx2(ba76486f76b4ebf4).(IMB_MGRcxx . . $ IMB_MGR# *state) |
| 110 | { |
| 111 | return IMB_GET_NEXT_JOBcxx . . $ `lib/intel-ipsec-mb.h:1496:9`!(state); |
| 112 | } |
| 113 | |
| 114 | IMB_JOBcxx . . $ IMB_JOB# * |
| 115 | get_completed_job_avx2cxx . . $ get_completed_job_avx2(ba76486f76b4ebf4).(IMB_MGRcxx . . $ IMB_MGR# *state) |
| 116 | { |
| 117 | return IMB_GET_COMPLETED_JOBcxx . . $ `lib/intel-ipsec-mb.h:1527:9`!(state); |
| 118 | } |