path: root/lib
AgeCommit message (Collapse)Author
2019-04-05ethdev: fix typo in error messagesDekel Peled
Correct minor typing mistake: pre-queue ==> per-queue Fixes: bea1e0c70cfc ("ethdev: convert static log type usage to dynamic") Cc: Signed-off-by: Dekel Peled <> Reviewed-by: Andrew Rybchenko <>
2019-04-05cfgfile: replace strcat with strlcatChaitanya Babu Talluri
Replace strcat with strlcat to avoid buffer overflow. Fixes: a6a47ac9c2 ("cfgfile: rework load function") Cc: Signed-off-by: Chaitanya Babu Talluri <> Acked-by: Ferruh Yigit <>
2019-04-05eal: fix typo in comment of vector functionDekel Peled
Remove redundant item 'a4' in comment. Fixes: 86c743cf9140 ("eal: define generic vector types") Cc: Signed-off-by: Dekel Peled <>
2019-04-05power: remove unused variablePallantla Poornima
Variable pfi_str is removed since it is unused. Fixes: 450f0791312c ("power: add traffic pattern aware power control") Cc: Signed-off-by: Pallantla Poornima <> Reviewed-by: Rami Rosen <> Acked-by: Aaron Conole <> Acked-by: David Hunt <>
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 <>
2019-04-04replace snprintf with strlcpy without adding extra includeBruce Richardson
For files that already have rte_string_fns.h included in them, we can do a straight replacement of snprintf(..."%s",...) with strlcpy. The changes in this patch were auto-generated via command: spatch --sp-file devtools/cocci/strlcpy-with-header.cocci --dir . --in-place Signed-off-by: Bruce Richardson <>
2019-04-04eal: tighten permissions on shared memory filesBruce Richardson
When creating files on disk, e.g. for EAL configuration or shared memory locks, etc., there is no need to grant any permissions on those files to other users. All directories are already created with 0700 permissions, so we should create all files with 0600 permissions. Cc: Signed-off-by: Bruce Richardson <>
2019-04-04ring: fix namesize macro documentation blockGage Eads
'/**<' style comments apply to the previous member, which caused doxygen to emit the RTE_RING_NAMESIZE documentation for RTE_RING_MZ_PREFIX. Fixes: 38c9817ee1d8 ("mempool: adjust name size in related data types") Cc: Signed-off-by: Gage Eads <>
2019-04-04stack: add C11 atomic implementationGage Eads
This commit adds an implementation of the lock-free stack push, pop, and length functions that use __atomic builtins, for systems that benefit from the finer-grained memory ordering control. Signed-off-by: Gage Eads <> Reviewed-by: Olivier Matz <> Reviewed-by: Honnappa Nagarahalli <>
2019-04-04stack: add lock-free implementationGage Eads
This commit adds support for a lock-free (linked list based) stack to the stack API. This behavior is selected through a new rte_stack_create() flag, RTE_STACK_F_LF. The stack consists of a linked list of elements, each containing a data pointer and a next pointer, and an atomic stack depth counter. The lock-free push operation enqueues a linked list of pointers by pointing the tail of the list to the current stack head, and using a CAS to swing the stack head pointer to the head of the list. The operation retries if it is unsuccessful (i.e. the list changed between reading the head and modifying it), else it adjusts the stack length and returns. The lock-free pop operation first reserves num elements by adjusting the stack length, to ensure the dequeue operation will succeed without blocking. It then dequeues pointers by walking the list -- starting from the head -- then swinging the head pointer (using a CAS as well). While walking the list, the data pointers are recorded in an object table. This algorithm stack uses a 128-bit compare-and-swap instruction, which atomically updates the stack top pointer and a modification counter, to protect against the ABA problem. The linked list elements themselves are maintained in a lock-free LIFO list, and are allocated before stack pushes and freed after stack pops. Since the stack has a fixed maximum depth, these elements do not need to be dynamically created. Signed-off-by: Gage Eads <> Reviewed-by: Olivier Matz <> Reviewed-by: Honnappa Nagarahalli <>
2019-04-04stack: introduce stack libraryGage Eads
The rte_stack library provides an API for configuration and use of a bounded stack of pointers. Push and pop operations are MT-safe, allowing concurrent access, and the interface supports pushing and popping multiple pointers at a time. The library's interface is modeled after another DPDK data structure, rte_ring, and its lock-based implementation is derived from the stack mempool handler. An upcoming commit will migrate the stack mempool handler to rte_stack. Signed-off-by: Gage Eads <> Reviewed-by: Olivier Matz <> Reviewed-by: Honnappa Nagarahalli <>
2019-04-04eal/x86: fix pedantic buildThomas Monjalon
When enabling pedantic compilation with CONFIG_RTE_LIBRTE_MLX5_DEBUG, the compiler complains about non standard 128-bit integer type: include/rte_atomic_64.h:223:3: error: ISO C does not support ‘__int128’ types [-Werror=pedantic] It must be marked as an extension of the standard C language to be accepted in pedantic compilation. Fixes: 640c5f09ef2c ("eal/x86: add 128-bit atomic compare exchange") Cc: Reported-by: Ferruh Yigit <> Signed-off-by: Thomas Monjalon <> Acked-by: Gage Eads <> Tested-by: Ferruh Yigit <>
2019-04-02ipsec: de-duplicate crypto op prepareKonstantin Ananyev
For sym_crypto_op prepare move common code into a separate function(s). Signed-off-by: Konstantin Ananyev <> Acked-by: Akhil Goyal <>
2019-04-02ipsec: reorder packet process for ESP inboundKonstantin Ananyev
Change the order of operations for esp inbound post-process: - read mbuf metadata and esp tail first for all packets in the burst first to minimize stalls due to load latency. - move code that is common for both transport and tunnel modes into separate functions to reduce code duplication. - add extra check for packet consitency Signed-off-by: Konstantin Ananyev <> Acked-by: Akhil Goyal <>
2019-04-02ipsec: reorder packet check for ESP inboundKonstantin Ananyev
Right now check for packet length and padding is done inside cop_prepare(). It makes sense to have all necessary checks in one place at early stage: inside pkt_prepare(). That allows to simplify (and later hopefully) optimize cop_prepare() part. Signed-off-by: Konstantin Ananyev <> Acked-by: Akhil Goyal <>
2019-04-02ipsec: move inbound and outbound codeKonstantin Ananyev
sa.c becomes too big, so decided to split it into 3 chunks: - sa.c - control path related functions (init/fini, etc.) - esp_inb.c - ESP inbound packet processing - esp_outb.c - ESP outbound packet processing Plus few changes in internal function names to follow the same code convention. No functional changes introduced. Signed-off-by: Konstantin Ananyev <> Acked-by: Akhil Goyal <>
2019-04-02ipsec: change the way unprocessed mbufs are accountedKonstantin Ananyev
As was pointed in one of previous reviews - we can avoid updating contents of mbuf array for successfully processed packets. Instead store indexes of failed packets, to move them beyond the good ones later. Signed-off-by: Konstantin Ananyev <> Acked-by: Akhil Goyal <>
2019-04-02ipsec: change order in filling crypto opKonstantin Ananyev
Right now we first fill crypto_sym_op part of crypto_op, then in a separate cycle we fill crypto op fields. It makes more sense to fill whole crypto-op in one go instead. Signed-off-by: Konstantin Ananyev <> Acked-by: Akhil Goyal <>
2019-04-02ipsec: add Tx offload template into SAKonstantin Ananyev
Operations to set/update bit-fields often cause compilers to generate suboptimal code. To avoid such negative effect, use tx_offload raw value and mask to update l2_len and l3_len fields within mbufs. Signed-off-by: Konstantin Ananyev <> Acked-by: Akhil Goyal <>
2019-04-02mbuf: add function to generate raw Tx offload valueKonstantin Ananyev
Operations to set/update bit-fields often cause compilers to generate suboptimal code. To help avoid such situation for tx_offload fields: introduce new enum for tx_offload bit-fields lengths and offsets, and new function to generate raw tx_offload value. Add new test-case into UT for introduced function. Signed-off-by: Konstantin Ananyev <> Acked-by: Akhil Goyal <> Acked-by: Olivier Matz <>
2019-04-02cryptodev: add RSA private key feature flagAyuj Verma
Add feature flag to reflect RSA private key operation support using quintuple (crt) or exponent type key. if PMD support both, then it should set both. App should query cryptodev feature flag to check if Sign and Decryt with CRT keys or exponent is supported, thus call operation with relevant key type. Signed-off-by: Ayuj Verma <> Signed-off-by: Shally Verma <> Acked-by: Akhil Goyal <>
2019-04-02eventdev: check timer adapter status before startPavan Nikhilesh
Check if timer adapter is already started before starting it. Update the unit test accordingly. Signed-off-by: Pavan Nikhilesh <> Acked-by: Erik Gabriel Carrillo <>
2019-04-03eal: allow to override init macros per OSJerin Jacob
baremetal execution environments may have a different method to enable RTE_INIT instead of using compiler constructor and/or OS specific linker scheme. Allow an option to override RTE_INIT* macros using rte_os.h or appropriate header file. Signed-off-by: Jerin Jacob <> Acked-by: Thomas Monjalon <>
2019-04-03eal/x86: add 128-bit atomic compare exchangeGage Eads
This operation can be used for non-blocking algorithms, such as a non-blocking stack or ring. It is available only for x86_64. Signed-off-by: Gage Eads <> Reviewed-by: Honnappa Nagarahalli <>
2019-04-03hash: support lock-free extendable bucketDharmik Thakkar
This patch enables lock-free read-write concurrency support for extendable bucket feature. Suggested-by: Honnappa Nagarahalli <> Signed-off-by: Dharmik Thakkar <> Reviewed-by: Ruifeng Wang <> Reviewed-by: Gavin Hu <> Reviewed-by: Honnappa Nagarahalli <> Acked-by: Yipeng Wang <>
2019-04-03mem: limit use of address hintShahaf Shuler
The commit below added an address hint as starting address for 64-bit systems in case an explicit base virtual address was not set by the user. The justification for such hint was to help devices that work in VA mode and has a address range limitation to work smoothly with the eal memory subsystem. While the base address value selected may work fine for the eal initialization, it easily breaks when trying to register external memory using rte_extmem_register API. Trying to register anonymous memory on RH x86_64 machine took several minutes, during them the function eal_get_virtual_area repeatedly scanned for a good VA candidate. The attempt to guess which VA address will be free for mapping will always result in not portable, error prone code: * different application may use different libraries along w/ DPDK. One can never guess which library was called first and how much virtual memory it consumed. * external memory can be registered at any time in the application run time. In order not to break the existing secondary process design, this patch only limits the max number of tries that will be done with the address hint. When the number of tries exceeds the threshold the code will use the suggested address from kernel. Fixes: 1df21702873d ("mem: use address hint for mapping hugepages") Cc: Signed-off-by: Shahaf Shuler <> Tested-by: Anatoly Burakov <> Acked-by: Alejandro Lucero <>
2019-04-03ring: fix an error messageStephen Hemminger
Log message should end with newline. Fixes: 4e32101f9b01 ("ring: support freeing") Signed-off-by: Stephen Hemminger <> Reviewed-by: Rami Rosen <>
2019-04-03eal: align hexdump outputStephen Hemminger
This fixes the issue where if the length of the output is not a multiple of 16 the formatting was off. Before: 00000000: 45 00 00 1C 12 34 2C E0 40 06 B8 2E C0 A8 01 12 | E....4,.@....... 00000010: C0 A8 01 37 | | | | | | | | | | | | | ...7 After: 00000000: 45 00 00 1C 12 34 2C E0 40 06 B8 2E C0 A8 01 12 | E....4,.@....... 00000010: C0 A8 01 37 | ...7 Signed-off-by: Stephen Hemminger <>
2019-04-03eal: clean formatting of hexdump functionsStephen Hemminger
The hexdump code obviously came from somewhere else originally. It is not formatted according to DPDK coding style. Also, drop the comment which is not useful the docbock comment is already in the rte_hexdump.h Signed-off-by: Stephen Hemminger <>
2019-04-03eal: make u64 reciprocal divisor constStephen Hemminger
The divisor is not modified here. Doesn't really matter for optimizaton since the function is inline already; but helps with expressing intent. Signed-off-by: Stephen Hemminger <> Reviewed-by: Maxime Coquelin <>
2019-04-03build: add workarounds for Windows helloworldAnand Rawat
Added meson workarounds to build helloworld on Windows. Windows currently only supports kvargs and eal libraries. This change restricts the build flow to supported libraries only. Signed-off-by: Anand Rawat <> Signed-off-by: Pallavi Kadam <> Reviewed-by: Jeff Shaw <> Reviewed-by: Ranjit Menon <> Acked-by: Harini Ramakrishnan <>
2019-04-03eal/windows: add minimum viable codeAnand Rawat
Add Windows specific logic for eal.c, eal_lcore.c, eal_debug.c and eal_thread.c. Updated header files to contain suitable function declarations. Signed-off-by: Anand Rawat <> Signed-off-by: Pallavi Kadam <> Reviewed-by: Jeff Shaw <> Reviewed-by: Ranjit Menon <> Acked-by: Harini Ramakrishnan <>
2019-04-03eal/windows: add headers for compatibilityAnand Rawat
Added headers to support Windows environment for common source. These headers will have Windows specific implementions of the system library APIs provided in Linux and FreeBSD. Signed-off-by: Anand Rawat <> Signed-off-by: Pallavi Kadam <> Reviewed-by: Jeff Shaw <> Reviewed-by: Ranjit Menon <> Acked-by: Harini Ramakrishnan <>
2019-04-03eal/windows: add sys/queue.h implementation copyAnand Rawat
Adding sys/queue.h on Windows for supporting common code. This implementation has BSD-3-Clause licensing. Signed-off-by: Ranjit Menon <> Signed-off-by: Anand Rawat <> Reviewed-by: Jeff Shaw <> Acked-by: Harini Ramakrishnan <>
2019-04-03build: add module definition files for WindowsAnand Rawat
Updated lib/ to create shared libraries on Windows. Added DEF files to list the exports for the eal and kvargs libraries. Signed-off-by: Bruce Richardson <> Signed-off-by: Anand Rawat <> Reviewed-by: Pallavi Kadam <> Reviewed-by: Ranjit Menon <> Acked-by: Harini Ramakrishnan <>
2019-04-03eal/windows: add wrappers for string functionsAnand Rawat
Updated rte_common.h to include rte_os.h to contain OS specific macros and functions. Updated rte_string_fns.h to include rte_common.h for rte_os.h Signed-off-by: Anand Rawat <> Reviewed-by: Pallavi Kadam <> Reviewed-by: Ranjit Menon <> Acked-by: Harini Ramakrishnan <>
2019-04-03eal: add OS specific header fileAnand Rawat
Added rte_os.h files to support OS specific functionality. Updated build system to contain OS headers in the include path. Signed-off-by: Anand Rawat <> Reviewed-by: Pallavi Kadam <> Acked-by: Harini Ramakrishnan <> Acked-by: Thomas Monjalon <>
2019-04-03eal/windows: introduce Windows supportAnand Rawat
Added initial stub source files and required meson changes for Windows support. kernel/windows/meson is a stub file added to support Windows specific source in future releases. Signed-off-by: Pallavi Kadam <> Signed-off-by: Anand Rawat <> Reviewed-by: Jeff Shaw <> Reviewed-by: Ranjit Menon <> Acked-by: Harini Ramakrishnan <>
2019-04-02eal: remove exec-env directoryThomas Monjalon
Only one header file (rte_kni_common.h) was in the sub-directory include/exec-env/ This file was installed in a sub-directory of the same name in the makefile-based build. Source and install directories are moved as below: lib/librte_eal/linux/eal/include/exec-env/ -> lib/librte_eal/linux/eal/include/ build/include/exec-env/ -> build/include/ The consequence is to have a file hierarchy a bit more flat. Signed-off-by: Thomas Monjalon <> Reviewed-by: David Marchand <> Tested-by: David Marchand <> Acked-by: Ferruh Yigit <>
2019-04-02mbuf: remove Intel offload checks from generic APIAndrew Rybchenko
rte_validate_tx_offload() is used in Tx prepare callbacks (RTE_LIBRTE_ETHDEV_DEBUG only) to check Tx offloads consistency. Requirement that packet headers should not be fragmented is not documented and unclear where it comes from except rte_net_intel_cksum_prepare() functions which relies on it. It could be NIC vendor specific driver or hardware limitation, but, if so, it should be documented and checked in corresponding Tx prepare callbacks. Signed-off-by: Andrew Rybchenko <> Acked-by: Olivier Matz <>
2019-04-02mem: do not use lockfiles for single file segments modeAnatoly Burakov
Due to internal glibc limitations [1], DPDK may exhaust internal file descriptor limits when using smaller page sizes, which results in inability to use system calls such as select() by user applications. Single file segments option stores lock files per page to ensure that pages are deleted when there are no more users, however this is not necessary because the processes will be holding onto the pages anyway because of mmap(). Thus, removing pages from the filesystem is safe even though they may be used by some other secondary process. As a result, single file segments mode no longer stores inordinate amounts of segment fd's, and the above issue with fd limits is solved. However, this will not work for legacy mem mode. For that, simply document that using bigger page sizes is the only option. [1] Signed-off-by: Anatoly Burakov <>
2019-04-02mem: refactor segment resizing functionAnatoly Burakov
Currently, segment resizing code sits in one giant function which handles both in-memory and regular modes. Split them up into individual functions. Signed-off-by: Anatoly Burakov <>
2019-04-02eal: initialize alarms earlyDarek Stojaczyk
On Linux, we currently initialize rte_alarms after starting to listen for IPC hotplug requests, which gives us a data race window. Upon receiving such hotplug request we always try to set an alarm and this obviously doesn't work if the alarms weren't initialized yet. To fix it, we initialize alarms before starting to listen for IPC hotplug messages. Specifically, we move rte_eal_alarm_init() right after rte_eal_intr_init() as it makes some sense to keep those two close to each other. We update the BSD code as well to keep the initialization order the same in both EAL implementations. Fixes: 244d5130719c ("eal: enable hotplug on multi-process") Cc: Signed-off-by: Darek Stojaczyk <>
2019-04-02eal: increase max number of interrupt vectorsPavan Nikhilesh
MSI-X permits a device to allocate up to 2048 interrupts as per PCIe spec. Increase the max number of vectors to a reasonable value of 512. Signed-off-by: Pavan Nikhilesh <>
2019-04-02telemetry: fix mapping of statisticsBruce Richardson
If we have two NIC ports which have a different set of NIC stats we can end up having two different stats registered with xstats with the same name. [Since the stats are updated in bulk as a contiguous set, the second driver re-using the registration of the first is not possible.] This causes issues with the invalid stat for one driver being found due to a lookup by name which is unnecessary. Instead of getting stat names involved do the lookup by ID instead. Fixes: 1b756087db93 ("telemetry: add parser for client socket messages") Cc: Signed-off-by: Bruce Richardson <> Acked-by: Kevin Laatz <>
2019-04-02power: add bit for high frequency coresDavid Hunt
This patch adds a new bit in the capabilities mask that's returned by rte_power_get_capabilities(), allowing application to query which cores have the higher frequencies, and can then pin the workloads accordingly. Returned Bits: 0 - Turbo Boost enabled 1 - Higher core base_frequency Signed-off-by: Liang Ma <> Signed-off-by: David Hunt <> Reviewed-by: Anatoly Burakov <>
2019-04-01power: fix governor storage to trim newlinesDavid Hunt
Currently the Power Libray stores the governor name with an embedded newline read from the scaling_governor sysfs file. This patch strips it out. Fixes: 445c6528b55f ("power: common interface for guest and host") Cc: Signed-off-by: David Hunt <> Acked-by: Anatoly Burakov <>
2019-03-29net: add PPPoE ethertypesNemanja Marjanovic
Add PPPoE ethertypes in to rte_ether.h. Signed-off-by: Nemanja Marjanovic <> Acked-by: Cristian Dumitrescu <>
2019-03-29pipeline: support QinQ PPPoE encapsulationNemanja Marjanovic
Add support of QinQ PPPoE packet encapsulation action. Signed-off-by: Nemanja Marjanovic <> Acked-by: Cristian Dumitrescu <>
2019-03-29meter: fix divide by zero for RFC4115Eelco Chaudron
RFC 4115 allows a meter with either cir and/or eir configured. When only one is configured a divide by zero would occur. Fixes: 655796d2b5fb ("meter: support RFC4115 trTCM") Signed-off-by: Eelco Chaudron <>