summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
AgeCommit message (Collapse)AuthorFilesLines
2024-09-26vppinfra: exclude clib_dt_node_add_child on FreeBSDTom Jones1-2/+1
clib_dt_read_from_sysfs is the only user of clib_dt_node_add_child, on FreeBSD this causes a build failure due to an unused function. Place clib_dt_node_add_child behind an include guard for linux only. Type: fix Change-Id: I9641ffd10d9d15e1e552f570cd386211d3b4ab39 Signed-off-by: Tom Jones <thj@freebsd.org> (cherry picked from commit 33fec83487b3f88203b0a854f7aec89d6e405cd7)
2024-09-05dev: add platform bus and devicetree supportDamjan Marion3-0/+421
Change-Id: Ief8e159b25d4fc4859c7116da6ff22c15bd3fff0 Type: feature Signed-off-by: Damjan Marion <damarion@cisco.com>
2024-08-29vppinfra: Use affinity for online cpus on FreeBSDTom Jones1-15/+7
On FreeBSD the affinity returned by cpuset gives us a bitmask documenting the available cpus. This can be modified if we are jailed or are launched via the cpuset(1) command. Initialise the clib bitmask otherwise it is always 0 and we cannot configure any workers. Type: improvement Change-Id: I067e373ea440c6fbd03839d1cf103c8b97d8a0c6 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-08-29crypto-native: aes_cbc_encrypt in vppinfraMohammed Hawari1-0/+203
Change-Id: Ibafa51f5fc98674d30e8758a0f9cc361c8b5c0fc Type: refactor Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
2024-08-21vppinfra: cleaner way of getting libdl in CMakeGuillaume Solignac1-9/+1
Cmake has a dedicated CMAKE_DL_LIBS variable to get libdl; use it instead of trying to find it manually. Type: improvement Signed-off-by: Guillaume Solignac <gsoligna@cisco.com> Change-Id: I9969c6be029f6a6e09cccaecd50e9eaf7d785b34
2024-08-20vppinfra: fix format_clib_timebase_timeAdrian Villin1-5/+4
- make the format RFC9110 compliant Type: fix Change-Id: I4272562ca1082285a596ef866ab6c4f405c64bc5 Signed-off-by: Adrian Villin <avillin@cisco.com>
2024-08-07vppapigen: ensure address types are nul terminatedOle Troan3-6/+19
A string generated from format() may not be nul terminated. Type: fix Change-Id: I88452e446c3504d70758e9009c65be5466034d92 Signed-off-by: Ole Troan <otroan@employees.org>
2024-07-23vppinfra: get_mempolicy instead of move_pages for mem initFlorin Coras1-19/+6
Use get_mempolicy instead of move_pages to detect numa nodes. Avoids issues whereby move_pages could stall if another rt thread spin waits instead of yielding the cpu. Type: improvement Signed-off-by: Tatsushi Kanemoto <t-kanemoto@fujitsu.com> Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I7db2073ed82bb0b1e707130d9bd8f54bea333840
2024-07-22vppinfra: expose raw memory tracesMatus Fabian2-15/+34
Add clib_mem_trace_dup which return copy of memory traces and can be used to save memory trace in different formats. Type: improvement Change-Id: I731860cdc65e6c5255620a6778ce6c893a493b1d Signed-off-by: Matus Fabian <matfabia@cisco.com>
2024-07-18vppinfra: fix cpu freq init error if cpu support aperfmperfXiaoming Jiang2-2/+6
After linux-v4.15, 'cpu MHz' in /proc/cpuinfo is CPU real frequency on x86 if cpu support aperfmperf flags more see linux commit: https://github.com/torvalds/linux/commit/7d5905dc14a87805a59f3c5bf70173aac2bb18f8 Type: fix Change-Id: Ib655a9a1c519104142120b343cd8ddbe0b6e50e6 Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com>
2024-07-17vppinfra: Add macro for targeted prefetchingNiyaz Murshed1-0/+24
In Arm platform, targeted prefetching[1] is supported. Adding this in infra to use it in future optimisation. [1] https://developer.arm.com/documentation/101458/2404/Optimize/Prefetching-with---builtin-prefetch Type: improvement Change-Id: Id3e2a274628289707840a6b2ba4b83c5e4add60b Signed-off-by: Niyaz Murshed <niyaz.murshed@arm.com>
2024-07-09vppinfra: fix huge page alloc error on 5.19+ kernelJay Wang1-0/+14
Running VPP on a NUMA system with 5.19+ kernel outputs the following error messages. 'show physmem' command confirms that VPP falls back to using normal 4K pages instead of the preallocated 1G huge pages. The root cause is that VPP uses move_pages()[1] to get the huge page node information. However, this misbehaves on the 5.19+ kernel due to changes introduced in its implementation[2]. Our proposed fix is retry obtaining NUMA node info with get_mempolicy()[3] only if we see -ENOENT returned in status from move_pages() and huge pages are used. Additionally, we use mincore()[4] to check if pages are allocated and in memory to avoid the possibility of get_mempolicy() falsely allocating a new page. buffer [warn ]: numa[1] falling back to non-hugepage backed buffer pool () vpp# show physmem used-pages 2 reserved-pages 16 default-page-size 1G lookup-page-size 4K arena 'buffers-numa-0' pages 1 subpage-size 1G numa-node 0 shared fd 5 arena 'buffers-numa-1' pages 1 subpage-size 4K numa-node 1 shared fd 6 [1] https://man7.org/linux/man-pages/man2/move_pages.2.html [2] https://lore.kernel.org/linux-mm/91da2c3b-96f1-bb03-8fff-4c38f31cb9be@huawei.com/ [3] https://man7.org/linux/man-pages/man2/get_mempolicy.2.html [4] https://man7.org/linux/man-pages/man2/mincore.2.html Type: fix Signed-off-by: Jay Wang <jay.wang2@arm.com> Change-Id: Ia423745423bb080404292333ef95455a4950ce0a
2024-06-26vppinfra: Improve code portabilityRenato Botelho do Couto1-2/+2
Use standard macros CPU_ISSET_S and CPU_ZERO_S and make code more portable. Type: improvement Change-Id: I8e6a0fd79b90de8c6c33cad8882680eae2ca50ef Signed-off-by: Renato Botelho do Couto <renato@netgate.com>
2024-06-17vppinfra: export os_exit and os_putsBenoît Ganne1-11/+4
os_exit() and os_puts() are not exported, preventing linkage with libvppinfra if those are not defined. Type: fix Change-Id: I7e3b583147e1348f078afeac3f793fe150405009 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2024-05-29vlib: stack trace and signal handler improvementsDamjan Marion10-2720/+198
- use libunwrap which seems to be industry standard - display traceback on console if running interactive or with syslog disabled (color output unless nocolor specified) - print hexdump of offending code - print library filename for each stack frame Type: improvement Change-Id: I61d3056251b87076be0578ccda300aa311c222ef Signed-off-by: Damjan Marion <damarion@cisco.com>
2024-05-23vppinfra: support libunwind for backtraceGuillaume Solignac2-0/+13
On non-glibc systems, execinfo is the only option available, but the lib is old and can crash when unwinding. We now can use libunwind to unroll it instead of using execinfo.h. Type: improvement Signed-off-by: Guillaume Solignac <gsoligna@cisco.com> Change-Id: I8b55f7aca97261a2efb5dca998889d5e0645939a
2024-05-14vppinfra: Add platform cpu and domain get for FreeBSDTom Jones1-1/+71
Type: improvement Change-Id: I5253f2b1b51493f2d4d0f451ad4c2208fd8f6bf2 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-05-14vppinfra: fix mhash oob after unset and add testsVladislav Grishenko5-7/+455
Fix out of buffer access after mhash_unset Add format mhash pair functions Add related mhash tests, similar to hash ones Type: fix Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: Idbefd7d32c4cd16b55d84ad4006c38251b4e2c33
2024-05-07api: upgrade cjson and fix reallocOle Troan2-88/+120
Upgrade cJSON library to patchlevel 17. Replace internal realloc added earlier 36217e3ca. Type: fix Fixes: 36217e3ca Change-Id: I7d8a80dc4241e9f952895d24adca8fa2d873e746 Signed-off-by: Ole Troan <otroan@employees.org>
2024-05-06vlib: revert automatic core pinning changesHadi Rayan Al-Sandid2-34/+0
This reverts commit 71c32a898941e32b5d4f865b50fbe775560c582d. Type: fix Reason for revert: vnet pinning is not considered in this patch. This causes keywords 'workers' and 'skip-cores' to be broken, as well as keyword 'main-core auto' introduced in this patch. If this patch is ever reconsidered, it must account for vnet pinning fix in commit https://gerrit.fd.io/r/c/vpp/+/40711. Change-Id: I1f3154a6c7e830b100f824375aa00e95b192f7f3 Signed-off-by: hsandid <halsandi@cisco.com>
2024-05-06vppinfra: Include param.h on FreeBSDTom Jones1-1/+2
Type: improvement Change-Id: I5fa90dd26d6cac2cefee009c97dd5ff8dac3ee1e Signed-off-by: Tom Jones <thj@freebsd.org>
2024-04-24vppinfra: Link against lib execinfo on FreeBSDTom Jones1-1/+6
Type: improvement Change-Id: Ie3d6cba886e0779949e8d574f82cff62abc7ebed Signed-off-by: Tom Jones <thj@freebsd.org>
2024-04-24vppinfra: Add FreeBSD method for updating pmalloc lookup tableTom Jones1-1/+44
FreeBSD has a different interface to request memory mapping information. Add a FreeBSD specific method for reading physical addresses and make it available at build time. Type: improvement Change-Id: I3588dde8e0a6f6d53333040245341ed09cebef9d Signed-off-by: Tom Jones <thj@freebsd.org>
2024-04-24vppinfra: Add method for getting current executable nameTom Jones2-0/+28
Add a unix method for getting the current executable name. This is implemented to match the readlink api for existing calls. Type: improvement Change-Id: Id06a55892d09d0b305a56b55a424f53ffb685a72 Signed-off-by: Tom Jones <thj@freebsd.org> Signed-off-by: Damjan Marion <damarion@cisco.com>
2024-04-09vppinfra: add support for precomputed SHA2 HMAC key and chained buffersDamjan Marion1-209/+285
Change-Id: Ic1fa3bd164e80c2ca1146be001870da0238a5f2e Type: improvement Signed-off-by: Damjan Marion <damarion@cisco.com>
2024-04-08vppinfra: fix mask compare and compress OOB readsDmitry Valter3-33/+297
Use mask_load_zero to avoid out-of-buffer reads in vectorized function versions. Type: fix Signed-off-by: Dmitry Valter <d-valter@yandex-team.com> Change-Id: I12bcb817ccf2db210c1c99fdfa444dc3f540035b
2024-04-05api: fix [un]formatting in vpp/api/types.cKlement Sekera2-0/+31
vl_api_prefix_t.len is 1 byte only, but unformat %d writes 4 bytes add helper functions unformat_u(8|16) which don't write more than appropriate amount of bytes fix other similar errors in vpp/api/types.c Type: fix Change-Id: I74a61a377147c373f8c25ed083052b2287763c39 Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
2024-04-02vppinfra: fix array_mask_u32 underrunDmitry Valter1-0/+1
Properly handle small buffers in the AVX256 version of array_mask_u32. Type: fix Signed-off-by: Dmitry Valter <d-valter@yandex-team.com> Fixes: f62ed3f9c1ec3e8db36f63d6a54f46b7bea43723 Change-Id: Idf1cb43ccf37bd7c439d11e4f68fe30064c6d09a
2024-03-29vlib: improve automatic core pinninghsandid2-0/+34
Type: feature Auto core pinning now fetches vpp cpu affinity list using pthread api. This enables us to do core-pinning in environments where the host cpu list does not necessarily align with cpus available to vpp Change-Id: Ife8c2a2351c08c5c6c4fdf7c729eeff2697bc39a Signed-off-by: hsandid <halsandi@cisco.com>
2024-03-20vppinfra: Define EBADFD on FreeBSDTom Jones1-0/+4
Type: improvement Change-Id: I303a8a7333d44f6eab902d4d61023cfa96760dd2 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-03-18vppinfra: os agnostic api for getting CPU informationDamjan Marion6-7/+69
Avoid direct sysfs reads when possible... Type: improvement Change-Id: I2b84cd18f3da47925d068951f24b79b5b6e20bb1 Signed-off-by: Damjan Marion <damarion@cisco.com>
2024-03-12misc: remove GNU Indent directivesDamjan Marion20-110/+0
Type: refactor Change-Id: I5235bf3e9aff58af6ba2c14e8c6529c4fc9ec86c Signed-off-by: Damjan Marion <damarion@cisco.com>
2024-03-04vppinfra: SHA2-256 ARM ISA supportDamjan Marion1-55/+104
Change-Id: I0fcda3e7afaab037bd12d0079d6639c6cbe8647e Type: improvement Signed-off-by: Damjan Marion <damarion@cisco.com>
2024-03-04vppinfra: add os_get_online_cpu_core() and os_get_online_cpu_node()Damjan Marion2-0/+30
Type: improvement Change-Id: I6f99f09c7724ce656a4f41a1d5f9c88d74c00faf Signed-off-by: Damjan Marion <damarion@cisco.com>
2024-02-19vppinfra: Stub out get_current_cpu and get_current_numa on FreeBSDTom Jones1-0/+8
FreeBSD has its own set of syscalls for getting current CPU and NUMA domain information. Stub out these calls and return CPU 0 and NUMA domain 0 as placeholders until we bring in FreeBSD specific calls. Type: improvement Change-Id: Id61df0273b0bcc6acf4844ee626e4f246f9f217b Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-18vppinfra: Place hugepage MMAP call behind linux specific ifdefTom Jones1-0/+6
Type: improvement Change-Id: I3a48ec4fd4a4063b6e3792b87def7bb796fc947c Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-18vppinfra: Provide FreeBSD implementation of clib_mem functionsTom Jones2-0/+476
Working from the implementation in linux/mem.c add FreeBSD specific functionality. This duplicates parts of the Linux implementation and a depuplication job could be run in the future. Stub out some parts of the API for now, they are either use unavailable features on FreeBSD or require further implementation than this initial implementation. Type: improvement Change-Id: I1e443e32304d19776a9a4d5e34adfa16ec919427 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-13vppinfra: Put clib_perf* behind Linux checks and provide stubs for FreeBSDTom Jones2-0/+38
As a placeholder stub out clib_perf functions on FreeBSD, the interface for performance counters on FreeBSD is different and will require its own implementation. Type: improvement Change-Id: I61511ebe5ee1fd6fe93d3179c7843c811f47a846 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-13vppinfra: Add netlink header on FreeBSDTom Jones1-1/+3
FreeBSD has support netlink since 13.2, but keeps its header in a slightly different place. Correctly include netlink/netlink.h for FreeBSD. Type: improvement Change-Id: Iec78ca72db74ea7f9c874e7039c7d17b6321f9dc Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-13vppinfra: Protect Linux specific features behind CLIB_LINUXTom Jones1-2/+4
Place Linux specific features behind CLIB_LINUX. The previous #ifdef calls would still pass even if CLIB_LINUX is set to 0 in clib.h, instead use #if. Type: improvement Change-Id: Ibe4424eee4bc0065f54764b017b9a56a3e854380 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-13vppinfra: Make program counter printing more portableTom Jones1-0/+8
Finding the program counter in the ucontext struct is platform and architecture specific, place the Linux checks inside an #ifdef and add a look up for the FreeBSD amd64 specific naming. Type: improvement Change-Id: I42fcef5f20227c23d84acee336e37c4870146bb4 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-13vppinfra: Add a stubbed out test_perf function for FreeBSDTom Jones1-0/+6
Type: improvement Change-Id: If136e0854dbaecfa62fc009ca2b0b94e8d9a56f2 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-13vppinfra: MAP_HUGETLB isn't available on FreeBSDTom Jones1-0/+2
Don't use the MAP_HUGETLB mmap flag on FreeBSD as it isn't available on the platform. Type: improvement Change-Id: Ie2046601c693f9ef12cf8113d6dbd87c322f1cf0 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-13vppinfra: Only prealloc hugepages on LinuxTom Jones1-0/+2
FreeBSD doesn't support sysfs or preallocating hugepages directly. In lieu of refactoring clib_sysfs calls place this one behind an #ifdef linux. Type: improvement Change-Id: I4079ca70175e4cec44d913db2b0407a3ca6306c9 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-13vppinfra: Don't build perfmon on FreeBSDTom Jones1-3/+4
FreeBSD has platform specific APIs for interfacing with performance counters. Until we bring in FreeBSD support, don't build perfmon on platforms which aren't linux. Type: improvement Change-Id: Iabc418922c0d2e851c6098508761135f53433ae8 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-02-13vppinfra: Place SIGPWR behind a linux defineTom Jones1-0/+2
The SIGPWR signal is specific to Linux, place it behind a Linux flag to help the build on FreeBSD. Type: improvement Change-Id: Ie36c2ceb201afff98e92bbe64595c3953b11c457 Signed-off-by: Tom Jones <thj@freebsd.org>
2024-01-23vppinfra: fix clib_array_mask_u32 OOB readsDmitry Valter2-7/+28
Handle non-even n_elts for the larger array instead of reading past the source buffer. Type: fix Fixes: f62ed3f9c1ec3e8db36f63d6a54f46b7bea43723 Signed-off-by: Dmitry Valter <d-valter@yandex-team.com> Change-Id: Ic1708a3f33fe71ca752345b5c77b6ae7a2d42bcd
2024-01-19vppinfra: fix test_bihashDmitry Valter1-2/+2
Correctly wrap data indices in test_bihash. Type: fix Signed-off-by: Dmitry Valter <d-valter@yandex-team.com> Change-Id: I740fa1cf9f8c382c12f01f607095c5995be6845f
2024-01-19vppinfra: fix bracket balanceGeorgy Borodin1-1/+2
fix bracket balance in pool_put_will_expand Type: fix Fixes: 66d4cb5a217d556aa7bd2471f02a39badb6d5cd2 Change-Id: I921366c0898cca39cc728b7c7ef4c4c725c6b87d Signed-off-by: Georgy Borodin <bor1-go@yandex-team.ru>
2024-01-19vppinfra: fix vec_prepend use-after-freeDmitry Valter1-7/+9
Don't access free'd memory in vec_prepend. Don't allow prepend when v1 == v2 as it also causes a use-after-free. Found via ASAN. Type: fix Signed-off-by: Dmitry Valter <d-valter@yandex-team.com> Change-Id: I21f8422c007d07d40d237e873b84c042be1fe8e8