summaryrefslogtreecommitdiff
path: root/lib/librte_acl
AgeCommit message (Collapse)Author
2019-04-04replace snprintf with strlcpyBruce Richardson
Do a global replace of snprintf(..."%s",...) with strlcpy, adding in the rte_string_fns.h header if needed. The function changes in this patch were auto-generated via command: spatch --sp-file devtools/cocci/strlcpy.cocci --dir . --in-place and then the files edited using awk to add in the missing header: gawk -i inplace '/include <rte_/ && ! seen { \ print "#include <rte_string_fns.h>"; seen=1} {print}' Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2019-03-27acl: fix compiler flags with meson and AVX2 runtimeAndrius Sirvys
When compiling the ACL library on a system without AVX2 support, the flags used to compile the AVX2-specific code for later run-time use were not based on the regular cflags for the rest of the library. This can cause errors due to symbols being missed/undefined due to incorrect flags. For example, when testing compilation on Alpine linux, we got: error: unknown type name 'cpu_set_t' due to _GNU_SOURCE not being defined in the cflags. This issue can be fixed by appending "-mavx2" to the cflags rather than replacing them with it. Fixes: 5b9656b157d3 ("lib: build with meson") Cc: stable@dpdk.org Signed-off-by: Andrius Sirvys <andrius.sirvys@intel.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-11-06lib: fix shifting 32-bit signed variable 31 timesFerruh Yigit
Fix cppcheck warning by marking variable as unsigned. Fixes: dc276b5780c2 ("acl: new library") Fixes: 986ff526fb84 ("net: add CRC computation API") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-10-25eal: add macro for attribute weakKeith Wiles
eal: add shorthand __rte_weak macro qat: update code to use __rte_weak macro avf: update code to use __rte_weak macro fm10k: update code to use __rte_weak macro i40e: update code to use __rte_weak macro ixgbe: update code to use __rte_weak macro mlx5: update code to use __rte_weak macro virtio: update code to use __rte_weak macro acl: update code to use __rte_weak macro bpf: update code to use __rte_weak macro Signed-off-by: Keith Wiles <keith.wiles@intel.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-09-16acl: forbid rule with priority zeroKonstantin Ananyev
If user specifies priority=0 for some of ACL rules that can cause rte_acl_classify to return wrong results. The reason is that priority zero is used internally for no-match nodes. See more details at: https://bugs.dpdk.org/show_bug.cgi?id=79. The simplest way to overcome the issue is just not allow zero to be a valid priority for the rule. Fixes: dc276b5780c2 ("acl: new library") Cc: stable@dpdk.org Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2018-01-30build: replace license text with SPDX tagBruce Richardson
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Luca Boccassi <bluca@debian.org>
2018-01-30lib: build with mesonBruce Richardson
Add non-EAL libraries to DPDK build. The compat lib is a special case, along with the previously-added EAL, but all other libs can be build using the same set of commands, where the individual meson.build files only need to specify their dependencies, source files, header files and ABI versions. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Harry van Haaren <harry.van.haaren@intel.com> Acked-by: Keith Wiles <keith.wiles@intel.com> Acked-by: Luca Boccassi <luca.boccassi@gmail.com>
2018-01-09lib: use SPDX tag for Cavium copyright filesJerin Jacob
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2018-01-04lib: use SPDX tag for Intel copyright filesBruce Richardson
Replace the BSD license header with the SPDX tag for files with only an Intel copyright on them. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2017-11-06remove useless memzone includesThomas Monjalon
The memzone header is often included without good reason. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-11-06use macro to declare constructor functionsThomas Monjalon
It is easier to find all constructor functions when they use the same macros RTE_INIT or RTE_INIT_PRIO. The macro definitions are moved from rte_eal.h to rte_common.h. Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2017-10-24mk: do not generate LDLIBS from directory dependenciesOlivier Matz
The list of libraries in LDLIBS was generated from the DEPDIRS-xyz variable. This is valid when the subdirectory name match the library name, but it's not always the case, especially for PMDs. The patches removes this feature and explicitly adds the proper libraries in LDLIBS. Some DEPDIRS-xyz variables become useless, remove them. Reported-by: Gage Eads <gage.eads@intel.com> Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Reviewed-by: Gage Eads <gage.eads@intel.com>
2017-07-16lib: remove duplicate includesStephen Hemminger
Include files only need to be refrenced once per file. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-07-08update Cavium Inc copyright headersJerin Jacob
Replace the incorrect reference to "Cavium Networks", "Cavium Ltd" company name with correct the "Cavium, Inc" company name in copyright headers. Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-07-04acl: remove checks for SSE4Bruce Richardson
Since SSE4 is now part of the minimum requirements for DPDK, we now longer need this check. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2017-07-03acl: fix build with ARMv8 clangAshwin Sekhar T K
Fixed warning -Wunknown-warning-option seen with armv8a clang compilation. Signed-off-by: Ashwin Sekhar T K <ashwin.sekhar@caviumnetworks.com> Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2017-06-06eal: introduce macro for always inlineJerin Jacob
Different drivers use internal macros like force_inline for compiler always inline feature. Standardizing it through __rte_always_inline macro. Verified the change by comparing the output binary file. No difference found in the output binary file with this change. Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2017-04-11lib: remove unnecessary void castStephen Hemminger
Remove unnecessary casts of void * pointers to a specific type. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2017-03-27mk: optimize directory dependenciesOlivier Matz
Before this patch, the management of dependencies between directories had several issues: - the generation of .depdirs, done at configuration is slow: it can take more than one minute on some slow targets (usually ~10s on a standard PC without -j). - for instance, it is possible to express a dependency like: - app/foo depends on lib/librte_foo - and lib/librte_foo depends on app/bar But this won't work because the directories are traversed with a depth-first algorithm, so we have to choose between doing 'app' before or after 'lib'. - the script depdirs-rule.sh is too complex. - we cannot use "make -d" for debug, because the output of make is used for the generation of .depdirs. This patch moves the DEPDIRS-* variables in the upper Makefile, making the dependencies much easier to calculate. A DEPDIRS variable is still used to process library dependencies in LDLIBS. After this commit, "make config" is almost immediate. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Tested-by: Robin Jarry <robin.jarry@6wind.com> Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2017-01-30acl: fix flow data commentsMichał Mirosław
Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2017-01-30acl: allow zero verdictMichał Mirosław
This enables ACL matches to return 0 where the distinction from no-match case is not needed. Signed-off-by: Michał Mirosław <michal.miroslaw@atendesoftware.pl> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2016-09-13lib: use C99 syntax for zero-size arraysAdrien Mazarguil
Exported header files used by applications should allow the strictest compiler flags. Language extensions used in many places must be explicitly marked or removed to avoid warnings and compilation failures. The extension keyword is used whenever the C99 syntax cannot do it. This commit prevents the following errors: error: ISO C forbids zero-size array `[...]' Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2016-09-09acl: add AltiVec for ppc64Gowrishankar Muthukrishnan
This patch adds port for ACL library in ppc64le. Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m@linux.vnet.ibm.com> Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2016-06-07mk: fix cross-compilationJerin Jacob
Removed comparison against $CC in Makefiles as in cross-compiling mode CC can be a different string instead of string "gcc" Suggested-by: Thomas Monjalon <thomas.monjalon@6wind.com> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2016-02-10remove extra parentheses in return statementHuawei Xie
fix the error reported by checkpatch: "ERROR: return is not a function, parentheses are not required" remove parentheses in return like: "return (logical expressions)" remove parentheses in return a function like: "return (rte_mempool_lookup(...))" Fixes: 6307b909b8e0 ("lib: remove extra parenthesis after return") Signed-off-by: Huawei Xie <huawei.xie@intel.com>
2015-12-08acl/arm: enable acl for ARMv7Jianbo Liu
Implement vqtbl1q_u8 intrinsic function, which is not supported in armv7-a. Signed-off-by: Jianbo Liu <jianbo.liu@linaro.org> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2015-11-20acl: fix native build on haswell with iccKonstantin Ananyev
On HSW box with icc 16.0.0 build for x86_64-native-linuxapp-icc fails with: icc: command line warning #10120: overriding '-march=native' with '-msse4.1' ... dpdk.org/x86_64-native-linuxapp-icc/include/rte_memcpy.h(96): error: identifier "__m256i" is undefined The reason is that icc treats "-march=native ... -msse4.1" in a different way, then gcc and clang. For icc it means override all flags enabled with '-march=native' with '-msse4.1'. Even when '-march=native' is a superset for '-msse4.1'. To overcome the problem add a check is SSE4.1 compilation flag already enabled. If yes, then no need to add '-msse4.1' Similar change for avx2 compilation option. Fixes: 074f54ad03ee ("acl: fix build and runtime for default target") Reported-by: Declan Doherty <declan.doherty@intel.com> Reported-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Declan Doherty <declan.doherty@intel.com>
2015-11-18acl: add NEON optimization for ARMv8Jerin Jacob
The implementation uses NEON gcc intrinsic. Verified with testacl and acl_autotest applications on arm64 architecture. Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-10-24acl: improve rules sortingMark Smith
Replace O(n^2) list sort with an O(n log n) merge sort. The merge sort is based on the solution suggested in: http://cslibrary.stanford.edu/105/LinkedListProblems.pdf Tested sort_rules() improvement: 100K rules: O(n^2): 31382 milliseconds; O(n log n): 10 milliseconds 259K rules: O(n^2): 133753 milliseconds; O(n log n): 22 milliseconds Signed-off-by: Mark Smith <marsmith@akamai.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-09-03acl: remove old APIThomas Monjalon
The functions and structures are moved to app/test in order to keep existing unit tests. Some minor changes were done in these functions because of library scope restrictions. An enum is also copied in two other applications to keep existing code. The library version is incremented. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-07-16mem: move librte_malloc to eal/commonSergio Gonzalez Monroy
Move malloc inside eal and create a new section in MAINTAINERS file for Memory Allocation in EAL. Create a dummy malloc library to avoid breaking applications that have librte_malloc in their DT_NEEDED entries. This is the first step towards using malloc to allocate memory directly from memsegs. Thus, memzones would allocate memory through malloc, allowing to free memzones. Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
2015-06-18acl: remove unused codeKonstantin Ananyev
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-06-18acl: introduce a macro for bitmask conversionKonstantin Ananyev
Introduce new RTE_ACL_MASKLEN_TO_BITMASK macro, that will be used in several places inside librte_acl and it's UT. Simplify and cleanup build_trie() code a bit. Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-06-18acl: fix unneeded trie splitting for subset of rulesKonstantin Ananyev
When rebuilding a trie for limited rule-set, don't try to split the rule-set even further. Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-06-18acl: add function to check build input parametersKonstantin Ananyev
Move check for build confg parameter into a separate function. Simplify acl_calc_wildness() function. Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-06-18acl: remove redundant macroKonstantin Ananyev
Use global RTE_LEN2MASK macro, instead of local LEN2MASK. Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-06-18acl: fix invalid rule wildness calculation for bitmask field typeKonstantin Ananyev
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-06-04acl: remove subtree calculations at build stageKonstantin Ananyev
As now subtree_id is not used acl_merge_trie() any more, there is no point to calculate and maintain that information. Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-06-04acl: fix matching ruleKonstantin Ananyev
Reported by Zi Hu: " cat test_data/rule1 @192.168.0.0/24 192.168.0.0/24 400 : 500 0 : 52 6/0xff @192.168.0.0/24 192.168.0.0/24 400 : 500 54 : 65280 6/0xff @192.168.0.0/24 192.168.0.0/24 400 : 500 0 : 65535 6/0xff cat test_data/trace1 0xc0a80005 0xc0a80009 450 53 0x06 I run the test by: sudo ./testacl -n 2 -c 4 -- --rulesf=./test_data/rule1 --tracef=./test_data/trace1 The result shows that the packet matches the second rule, which is wrong. The dest port of the pkt is 53, so it should match the third rule. " Indeed there is problem at ACL build stage. Sometimes acl_merge_trie() is too aggressive in trying to conserve space at build time. So it takes a wrong assumptions and didn't duplicate a node, even when it should. The easiest and safest fix seems to always duplicate a left non-root/non-leaf node first, and let the further code to destroy the node, if it is not needed. Reported-by: Zi Hu <huzilucky@gmail.com> Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-04-28acl: use setjmp/longjmp to handle alloc failures at build phaseKonstantin Ananyev
During build phase ACL doing quite a lot of memory allocations for relatively small temporary structures. In theory each of such allocation can fail, so we need to handle all these possible failures. That adds a lot of extra checks and makes the code harder to read and follow. To simplify the process, made changes to handle all such failures in one place. Note, that all that memory for temporary structures is freed at one go at the end of build phase. Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-03-20eal/x86: move header file for vector instructionsKonstantin Ananyev
lib/librte_eal/common/include/rte_common_vect.h -> lib/librte_eal/common/include/arch/x86/rte_vect.h Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
2015-03-10tailq: move to dynamic tailqDavid Marchand
Use dynamic tailq rather than static entries. Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>
2015-03-10tailq: remove unneeded inclusionsDavid Marchand
Only keep inclusion where really needed. Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>
2015-02-03mk: add library version extensionNeil Horman
To differentiate libraries that break ABI, we add a library version number suffix to the library, which must be incremented when a given libraries ABI is broken. This patch enforces that addition, sets the initial abi soname extension to 1 for each library and creates a symlink to the base SONAME so that the test applications will link properly. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
2015-02-03lib: provide initial versioningNeil Horman
Add linker version script files to each DPDK library to put a stake in the ground from which we can start cleaning up API's Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
2015-02-02acl: remove standalone headerThomas Monjalon
This is a duplication of some EAL parts for a standalone packaging which is not documented. Packaging should be done outside of DPDK. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2015-01-28acl: add comments about internal layoutKonstantin Ananyev
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>
2015-01-28acl: remove unused constantKonstantin Ananyev
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>
2015-01-28acl: introduce config parameter for performance/space trade-offKonstantin Ananyev
If at build phase we don't make any trie splitting, then temporary build structures and resulting RT structure might be much bigger than current. >From other side - having just one trie instead of multiple can speedup search quite significantly. >From my measurements on rule-sets with ~10K rules: RT table up to 8 times bigger, classify() up to 80% faster than current implementation. To make it possible for the user to decide about performance/space trade-off - new parameter for build config structure (max_size) is introduced. Setting it to the value greater than zero, instructs rte_acl_build() to: - make sure that size of RT table wouldn't exceed given value. - attempt to minimise number of tries in the table. Setting it to zero maintains current behaviour. That introduces a minor change in the public API, but I think the possible performance gain is too big to ignore it. Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>
2015-01-28acl: deduplicate some SSE and AVX2 codeKonstantin Ananyev
Vector code reorganisation/deduplication: To avoid maintaining two nearly identical implementations of calc_addr() (one for SSE, another for AVX2), replace it with a new macro that suits both SSE and AVX2 code-paths. Also remove no needed any more MM_* macros. Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>