aboutsummaryrefslogtreecommitdiff
path: root/helper
AgeCommit message (Collapse)Author
2023-04-14helper: ipsec: fix pass-by-valueTuomas Taipale
Instead of passing capability structure to `odph_ipsec_alg_check()` as value, pass read-only pointer to it. Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2023-04-06linux-gen, helper: debug: add a space in logs after line informationJere Leppänen
To improve readability of logs, add a space after the file, line and function information. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2023-04-06helper: debug: reduce code duplication in ODPH_LOGJere Leppänen
Call fprintf() in just one place in ODPH_LOG. As a nice side effect, print format warnings also appear just once, instead of three times. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2023-04-06helper: debug: re-enable print format warningsJere Leppänen
Commit a0237360e745 ("helper: debug: fix variadic macro build errors") also disabled print format warnings as a side effect. Remove the pragma used in that commit, and instead avoid the variadic macro warnings with '__extension__' keyword. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2023-02-20helper: test: chksum: fix IPv4 header initializationJere Leppänen
Initialize also tos, frag_offset and ttl. Uninitialized values can cause the test to fail. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-11-03helper: threads: improve odph_thread_create() timeout error messageJuha Kauraniemi
Add more debug information to thread startup timeout error message from odph_thread_create(). Signed-off-by: Juha Kauraniemi <juha.kauraniemi@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-10-26Revert "helper: provide options to explicitly link static libodphelper via ↵Jere Leppänen
pkg-config --static" This reverts commit b0aac4a0fcb21a7ddaa7a3540857878df6197ecb. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Carl Wallen <carl.wallen@nokia.com>
2022-10-19helper: provide options to explicitly link static libodphelper via ↵Jere Leppänen
pkg-config --static On some distros (Fedora), $CC -static doesn't work, because static system libraries are not available. Provide options to explicitly link static libodphelper via pkg-config --static, so that application can link libodphelper statically without the -static linker option. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-09-20helper: cli: add command odp_schedule_printJere Leppänen
Add command odp_schedule_print. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-09-20helper: cli: add command odp_pool_print_allJere Leppänen
Add command odp_pool_print_all. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-09-20helper: cli: alphabetize commandsJere Leppänen
Alphabetize CLI commands. Also, use a macro to make the command registering code more compact. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-09-20helper: cli: prefix pktio_*_stats_print commandsJere Leppänen
Prefix pktio_*_stats_print commands with "odp_". Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-09-20helper: cli: drop the call commandJere Leppänen
Drop the "call" command and put all the commands on top level. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-09-15helper: threads: fix synchronized thread start in process modeMatias Elo
Memory for odph_thread_create() output thread table is given by application, so there is no guarantee that the memory can be used to synchronize child process startup. Fix this by using mmap() to create the necessary memory for thread startup synchronization. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-09-12Revert "helper: allow cli.h to be included individually"Jere Leppänen
This reverts commit 65a7f559c173ddbe9738c9c03bf9dbfc52279bc0. cli.h is optional, so it cannot be included unconditionally. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-09-09helper: ip: avoid conversion warnings with gcc-7Jere Leppänen
Use an explicit cast to avoid conversion warnings, when application is compiled with gcc-7 and -Wconversion option. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-09-09helper: ip: avoid conversion warning in odph_ipv4_csum()Jere Leppänen
Use an explicit cast to avoid conversion warning in odph_ipv4_csum(), when application is compiled with -Wconversion option. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-09-09helper: allow cli.h to be included individuallyJere Leppänen
Allow application to individually include cli.h, instead of only via odph_api.h. In order to do this, move the conditional to cli.h and include the autoheader there as well. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-09-09configure: use ODP_*FLAGS instead of *FLAGSJere Leppänen
Instead of setting CFLAGS (and CXXFLAGS, LDFLAGS) in configure, use ODP_CFLAGS instead. Then, in main level Makefile.inc, set AM_CFLAGS based on ODP_CFLAGS. Consequently, program_CFLAGS will work as intended. Also, don't do AC_SUBST([LIBS]). LIBS is handled automatically, since it's a preset variable. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-09-08helper: cli: check for vsnprintf errorsJere Leppänen
If vsnprintf() fails, log an error and return error status. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Tuomas Taipale <tuomas.taipale@nokia.com>
2022-08-12helper: cli: add more packet I/O statistics printing commandsTuomas Taipale
Add commands to print packet I/O total, queue, event queue and extra statistics. Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2022-03-22helper: add missing odp_api.h includesPetri Savolainen
Added three missing ODP API header includes and removed one include that was not needed. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2022-03-02api: remove deprecated odp.h headerMatias Elo
Remove deprecated odp.h header file which has been replaced by odp_api.h. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2022-02-03helper: thread: get rid of an unsigned-signed comparison warningJanne Peltonen
Get rid of a warning by GCC 11 about a comparison between an unsigned variable and a signed literal. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-12-08helper: remove usage of deprecated ODP_SHM_SW_ONLY flagMatias Elo
Stop using deprecated SHM flag ODP_SHM_SW_ONLY. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-11-12helper: threads: deprecate old functions and parametersJere Leppänen
Deprecate odph_thread_param_t::instance, odph_odpthread_t, odph_odpthread_params_t, odph_odpthreads_create() and odph_odpthreads_join(). Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-11-12helper: implement deprecationJere Leppänen
Implement deprecation in the helper library. Deprecated helper APIs may be enabled with the --enable-helper-deprecated configure option. By default, deprecated helper APIs are not enabled. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-11-12helper: cli: remove unused instance parameter from odph_cli_init()Jere Leppänen
Now that the CLI helper no longer creates a thread, the ODP instance is not needed by odph_cli_init(). Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-11-11helper: test: thread: rename odp_instance variableMatias Elo
Rename thread helper test's global variable 'odp_instance', which clashes with the new odp_instance() API. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-10-21helper: fix zero-size array build errorsMatias Elo
Fix "ISO C forbids zero-size array" errors when building with 'pedantic' option. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-10-21helper: debug: fix variadic macro build errorsMatias Elo
Fix "ISO C99 requires at least one argument for the "..." in a variadic macro" and "token pasting of ',' and __VA_ARGS__ is a GNU extension" errors when building with 'pedantic' option. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-09-30helper: cli: allow user to provide own hostnameLifang Zhang
Hostname will be displayed as the first part of the prompt. Signed-off-by: Lifang Zhang <lifang.zhang@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-09-30helper: cli: delete max_user_commands from struct cli_shm_tLifang Zhang
After adding odph_cli_param_t to struct cli_shm_t in the previous commit, max_user_commands is redundant since it is also included in struct odph_cli_param_t. Signed-off-by: Lifang Zhang <lifang.zhang@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-09-30helper: cli: add odph_cli_param_t to cli_shm_tLifang Zhang
This allows other functions to access cli parameters without modifying their function parameters. Signed-off-by: Lifang Zhang <lifang.zhang@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-09-30helper: cli: add new API function odph_cli_log_va()Lifang Zhang
This new function is similar to odph_cli_log() except that it takes its arguments as a va_list. Signed-off-by: Lifang Zhang <lifang.zhang@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-09-30helper: cli: don't create the server threadJere Leppänen
Add odph_cli_run() and remove odph_cli_start(). Don't create a thread in the CLI helper. Instead, the caller may create a thread and call odph_cli_run() to run the CLI. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com> Cc: Lifang Zhang <lifang.zhang@nokia.com>
2021-09-30helper: threads: deprecate odph_odpthread_t and odph_odpthread_params_tJere Leppänen
Document odph_odpthread_t and odph_odpthread_params_t as deprecated. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-09-30helper: test: test new thread parametersJere Leppänen
Create threads also with non-default values for the new thread parameters stack_size and sync_timeout. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-09-30helper: test: test odph_thread_create() instead of odph_odpthreads_create()Jere Leppänen
Test the newer odph_thread_create() and odph_thread_join() functions instead of the deprecated odph_odpthreads_create() and odph_odpthreads_join(). Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-09-30helper: threads: add thread stack size parameterJere Leppänen
Add a parameter in odph_thread_param_t, which allows specifying the minimum thread stack size. This parameter is used only in odph_thread_create(), it is ignored in odph_odpthreads_create(). Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-09-30helper: threads: add synchronized thread creation timeout parameterJere Leppänen
Add a parameter to odph_thread_common_param_t, which allows specifying the time to wait for the synchronization signal in synchronized thread creation. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-09-30use odph_thread_param_init()Jere Leppänen
Use the new odph_thread_param_init() function to initialize odph_thread_param_t. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-09-30helper: threads: add odph_thread_param_init()Jere Leppänen
Add helper API function to initialize thread parameters. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-09-30use odph_thread_common_param_init()Jere Leppänen
Use the new odph_thread_common_param_init() function to initialize odph_thread_common_param_t. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-09-30helper: threads: add odph_thread_common_param_init()Jere Leppänen
Add helper API function to initialize thread common parameters. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
2021-07-08helper: ipsec: check ICV length when checking auth capabilityJanne Peltonen
When checking IPsec algorithm support, check that the default ICV length is supported. This patch does not add support for non-default ICV lengths in the helper. Add a helper function that returns the default ICV length for an algorithm. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Anoob Joseph <anoobj@marvell.com>
2021-07-05helper: ipsec: add AES-CMAC in capability checking helperJanne Peltonen
AES-CMAC authentication algorithm is supported in ODP IPsec API but was not recognized by the IPsec algorithm capability checking helper function. Add AES-CMAC in the helper. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Jere Leppänen <jere.leppanen@nokia.com>
2021-06-01helper: cli: add user command functionsJere Leppänen
Allow user to register CLI commands with a name, function, and an optional help text. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-06-01helper: cli: try to avoid closing reused file descriptorsJere Leppänen
The only way to stop cli_loop() is to close the socket. But after closing, cli_loop() still uses or closes the file descriptor, which is a problem if the file descriptor has already been reused. Try to avoid this problem by using dup2() to switch to a higher file descriptor number. Also avoid double closes outside cli_loop() with a couple of small tweaks. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
2021-05-07helper: cli: add command "call odp_queue_print_all"Jere Leppänen
Add a CLI command, which calls the new odp_queue_print_all() API function. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>