summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
AgeCommit message (Collapse)AuthorFilesLines
2021-02-15vppinfra: fix memcpy undefined behaviourBenoît Ganne6-80/+123
Calling mem{cpy,move} with NULL pointers results in undefined behaviour. This in turns is exploited by GCC. For example, the sequence: memcpy (dst, src, n); if (!src) return; src[0] = 0xcafe; will be optimized as memcpy (dst, src, n); src[0] = 0xcafe; IOW the test for NULL is gone. vec_*() functions sometime call memcpy with NULL pointers and 0 length, triggering this optimization. For example, the sequence: vec_append(v1, v2); len = vec_len(v2); will crash if v2 is NULL, because the test for NULL pointer in vec_len() has been optimized out. This commit fixes occurrences of such undefined behaviour, and also introduces a memcpy wrapper to catch those in debug mode. Type: fix Change-Id: I175e2dd726a883f97cf7de3b15f66d4b237ddefd Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-02-11vppinfra: fix membulk coverity warningsFlorin Coras1-2/+2
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I4830656ad852de62211e31574a0e0afb62d00f37
2021-02-10vppinfra: fix bihash test-debug aarch64 sporadic failureDave Barach1-0/+3
Turns out that both the multi-core and single-core add / del tests run for just under 5 seconds (aarch64, debug image). Increase the vapi => debug CLI timeout to avoid spurious failures. Type: test Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ia64bffa82a908172a21c34f3ae4402ad774af28a
2021-02-08virtio: add atomic call for kickingMohsin Kazmi1-0/+3
Type: fix Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I41faa2ca249ff75e564a732af896e6b5d76bf665
2021-02-04vppinfra: fix mem map mt issue due to snprintfFlorin Coras1-1/+1
Type: fix Apparently snprintf is not thread safe!? Thread 6 "vpp_wk_3" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffeed1a3700 (LWP 819375)] 0x00007ffff58fc2b4 in __GI__IO_default_xsputn (n=<optimized out>, data=<optimized out>, f=<optimized out>) at genops.c:394 394 genops.c: No such file or directory. (gdb) bt 0 0x00007ffff58fc2b4 in __GI__IO_default_xsputn (n=<optimized out>, data=<optimized out>, f=<optimized out>) at genops.c:394 1 __GI__IO_default_xsputn (f=0x7ffeec35e050, data=<optimized out>, n=9) at genops.c:370 2 0x00007ffff58e127c in __vfprintf_internal (s=s@entry=0x7ffeec35e050, format=format@entry=0x7ffff5f833ce "%s", ap=ap@entry=0x7ffeec35e1d0, mode_flags=mode_flags@entry=2) at ../libio/libioP.h:948 3 0x00007ffff58f611a in __vsnprintf_internal (string=0x7ffed57ed018 "", maxlen=<optimized out>, format=0x7ffff5f833ce "%s", args=args@entry=0x7ffeec35e1d0, mode_flags=2) at vsnprintf.c:114 4 0x00007ffff5997fd1 in ___snprintf_chk (s=<optimized out>, maxlen=<optimized out>, flag=<optimized out>, slen=<optimized out>, format=<optimized out>) at snprintf_chk.c:38 5 0x00007ffff5f7fd74 in clib_mem_vm_map_internal (base=<optimized out>, log2_page_sz=<optimized out>, size=<optimized out>, fd=<optimized out>, offset=<optimized out>, name=0x0) at /scratch/fcoras/vpp/src/vppinfra/linux/mem.c:502 Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I8ff7cfed422273dbdc55068772e11f5e550a9b60
2021-02-04vlib: "revert startup multi-arch variant configuration fix for interfaces"Damjan Marion1-20/+0
Type: fix This reverts commit 5a48b3b9d88fa2793793e2bf3db8bf156fe2951f. Change-Id: Ifa91b18bdbbc32bb729abc09d95637d9cdf42c3b Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2021-02-01vppinfra: add defines for bihash add and deletePaul Atkins2-1/+4
When calling the bihash_add_del... functions some callers add a comment beside the value to indicate this is the is_add param. Make the code easier to read by adding defines for add and delete that the callers can use instead of having to use 0 or 1. Type: improvement Signed-off-by: Paul Atkins <patkins@graphiant.com> Change-Id: Iab5f7c8e8df12ac62fc7e726ca1798622dcdb42c
2021-01-25vlib: startup multi-arch variant configuration fix for interfacesRadu Nicolau1-0/+20
Propagate the multi-arch variant selection to interfaces. Type: fix Signed-off-by: Radu Nicolau <radu.nicolau@intel.com> Change-Id: I99c4a7896f172f0d14d2ded22a27383825529a7d
2021-01-21avf: use write combining store for queues tail updateRadu Nicolau1-23/+32
Performance improvement: on supported platforms, currently only Intel Tremont, use a write combining store to update the tail pointers. Also, Tremont node variant is added for all. Type: improvement Signed-off-by: Radu Nicolau <radu.nicolau@intel.com> Change-Id: Ie9606e403b7d9655184f778e3ffee3027c8c9edd
2021-01-21interface: rx queue infra rework, part oneDamjan Marion3-0/+236
Type: improvement Change-Id: I4008cadfd5141f921afbdc09a3ebcd1dcf88eb29 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-01-21vppinfra: ensure _GNU_SOURCE is presentNathan Moos2-6/+13
Type: fix When building with musl, _GNU_SOURCE is required to be defined in more places. This patch defines it in those required places. Additionally, this patch changes the udphdr field names to the standard names. Change-Id: I0fec54214ccc8458289176488afb4218761e9d51 Signed-off-by: Nathan Moos <nmoos@cisco.com>
2021-01-21vppinfra: add bihash with 32 byte keyMatthew Smith2-0/+108
Type: feature Add header to define bihash_32_8. Change-Id: Ia8a21a1e76cf0c05b8f8a2d1f5dbc0dc586d7801 Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2021-01-20vppinfra: add option to use libexecinfoNathan Moos1-1/+5
Type: feature The musl libc does not provide <execinfo.h> or an implementation of the functions provided. This patch enables the use of libexecinfo as an alternative, which can be used on systems with musl. Change-Id: I76b5744ddf731b66e16144025a6fdedf72925260 Signed-off-by: Nathan Moos <nmoos@cisco.com>
2021-01-15vlib: fix counter_will_expand predictionMiklos Tirpak1-0/+15
vlib_validate_combined_counter_will_expand() was calling _vec_resize_will_expand() with wrong arguments, which resulted in false return value. Apart from the initial call, it never indicated a vector resize. The callers relying on this function did not perform a barrier sync because of the wrong prediction even if the vector got extended by a subsequent vlib_validate_combined_counter() call. The fix introduces a new, simplified macro that is easier to call. vec_resize_will_expand() accepts the same arguments as vec_resize(). Type: fix Signed-off-by: Miklos Tirpak <miklos.tirpak@gmail.com> Change-Id: Ib2c2c8afd3e665e0e3d6ae62ff5cfa287acf670f
2020-12-23vppinfra: mem bulk testFlorin Coras1-1/+1
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Icd44ede9604c29839af250a2be93ecf467467aa0
2020-12-23svm: remove fifo segment heapFlorin Coras1-0/+3
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I518e096fe13847759806ff62009e73fd8f7451b7
2020-12-22vppinfra: add bulk memory allocatorDamjan Marion3-0/+249
Small fixed size object memory allocator. Type: improvement Change-Id: I727705d9d4292b6b38d41e239871103b15aa9038 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-18misc: deprecate old perfmonDamjan Marion2-47/+0
Type: refactor Change-Id: I1303219f9f2a25d821737665903b0264edd3de32 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-16vppinfra: fix vec_max_lenFlorin Coras1-1/+2
Return 0 if the supplied vector pointer is NULL. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Icb0aab70e0b7c9c1ddcf607c9dfb7e5715f177d1
2020-12-14misc: refactor clib_bitmap_foreach macroDamjan Marion3-9/+15
Type: refactor Change-Id: I077110e1a422722e20aa546a6f3224c06ab0cde5 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-14misc: move to new pool_foreach macrosDamjan Marion6-70/+70
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-14vppinfra: simpler and faster pool_foreachDamjan Marion1-15/+31
- reduces number of instructions generated 4 times compared to old code - adds pool_foreach2 which is more friendly to clang-format Type: improvement Change-Id: I51e9c7fb09655c60d883987dadf5b2666c12b3f7 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-01session: allow small pacer burstsFlorin Coras1-0/+8
Instead of enforcing a "strict" release of data, which relies on frequent rescheduling of sessions, allow some pacer coalescing, i.e., short bursts, that can minimize load on scheduler/session layer and potentially leverage tso. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I67e38e5b8dc335bd214113b70c68c27ae92bd6da
2020-11-25vlib: add elog events for vlib log entriesDave Barach2-6/+18
Pretty interesting to see how long plugins take to load. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: If496eb73b2e1fd9dd714142cd5195fa7ccd93ebd
2020-11-25api: vat2 and json autogeneration for api messagesOle Troan3-0/+3395
VAT2: A completely auto-generated replacement of VAT. Reads input message in JSON from stdin and outputs received messages in JSON. A VAT2 plugin is automatically built for a .api file. There no longer a need for a separate _test.c. Example: vat2 show_version {} { "_msgname": "show_version_reply", "retval": 0, "program": "vpe", "version": "21.01-rc0~411-gf6eb348a6", "build_date": "2020-11-19T09:49:25", "build_directory": "/vpp/autogen3" } vat2 sw_interface_dump '{"sw_if_index": -1, "name_filter_valid": 0, "name_filter": ""}' [{ "_msgname": "sw_interface_details", "sw_if_index": 0, "sup_sw_if_index": 0, "l2_address": "00:00:00:00:00:00", "flags": "Invalid ENUM", "type": "IF_API_TYPE_HARDWARE", "link_duplex": "LINK_DUPLEX_API_UNKNOWN", "link_speed": 0, "link_mtu": 0, "mtu": [0, 0, 0, 0], "sub_id": 0, "sub_number_of_tags": 0, "sub_outer_vlan_id": 0, "sub_inner_vlan_id": 0, "sub_if_flags": "Invalid ENUM", "vtr_op": 0, "vtr_push_dot1q": 0, "vtr_tag1": 0, "vtr_tag2": 0, "outer_tag": 0, "b_dmac": "00:00:00:00:00:00", "b_smac": "00:00:00:00:00:00", "b_vlanid": 0, "i_sid": 0, "interface_name": "local0", "interface_dev_type": "local", "tag": "" }] This is the first phase and vat2 is not integrated in packaging yet. Type: feature Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Ib45ddeafb180ea7da8c5dc274a9274d7a4edc876 Signed-off-by: Ole Troan <ot@cisco.com>
2020-11-24buffers: add page-size configNathan Skrzypczak1-31/+18
Type: feature Add a `buffers {page-size}` parameter to specify page size for buffers. This also fixes an issue with the parsing in unformat_log2_page_size. Change-Id: I7d7b1fa0bb7febaa7509cf2c625882f07eeafaad Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2020-11-19svm: move chunk locks to linked listFlorin Coras1-0/+3
Type: improvement We only need to protect the linked lists. Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ie1542073f3993acfc66d99096b08bf9ecd10a49b
2020-11-16tests: move bihash tests to src/vppinfra/testDave Wallace1-0/+71
- Refactor make test code to be co-located with the vpp feature source code. Type: test Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: I0133a00def595fe1c08ab881633ef9f89148a286
2020-11-10vpp: use vpp heap for libcBenoît Ganne1-5/+7
This makes libc use vpp main heap instead of the default libc heap. This gives better visibility (accounting, tracing) on allocations happening in external libraries called from vpp (eg. OpenSSL). Type: feature Change-Id: I5d8a673472145a4e090bedb443b8c58a967d1cca Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-11-05vppinfra: mspace_get_aligned should respect MALLOC_ALIGNMENTDamjan Marion1-22/+1
While underlying mspace_malloc() respects MALLOC_ALIGNMENT (16) mspace_get_aligned moves start of data for 4 bytes making final result not aligned to MALLOC_ALIGNED. Type: fix Change-Id: Ib1584f315e3658b3b748ebf4886fb7389ce640fe Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-11-05build: link time optimization for release buildsDamjan Marion1-0/+1
Type: improvement Change-Id: I0e24f1d2ad5c7a11a8bd40125428f86aca867bec Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-26vppinfra: clib_mem_vm_{un}map thread safeDamjan Marion2-0/+25
Type: improvement Change-Id: I1ab1b100000b4d7212c58e10312e16e7527bd333 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-23vppinfra: add bihash_8/24_16 to headers listjiangxiaoming1-0/+2
Type: improvement Signed-off-by: jiangxiaoming <jiangxiaoming@outlook.com> Change-Id: Ic67977995dbcba97240009373a4b9e9b57c63706
2020-10-22vppinfra: missing __clib_export va_unformatJuraj Linkeš1-1/+1
Fix an issue observed on aarch64 systems when running with dpdk plugin: dpdk_plugin.so: undefined symbol: va_unformat Type: fix Fixes: dae1c7ed38e9f7a86e66f3674de62778cc981331 Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech> Change-Id: I22b7ee842dc606f96effdeb7aa4e161496986aed
2020-10-21vppinfra: missing __clib_exportNathan Skrzypczak1-1/+1
Type: fix Change-Id: I2dbd435d04a09f632286e5d669edc5fafd384f94 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2020-10-21vlib: print logs to stderr if interactive or nosyslog setDamjan Marion1-1/+3
If VPP is started in interactive mode, instead of sending logs to syslog server we print them directly to stderr. Output is colorized, but that can be turned off with unix { nocolor } Type: improvement Change-Id: I9a0f0803e4cba2849a6efa0b6a86b9614ed33ced Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-21ipsec: Add to the SA info directly in the bihashNeale Ranns2-0/+211
Type: improvement this save the cache miss on the protect structure. Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: I867d5e49df5edfd6b368f17a34747f32840080e4
2020-10-21vppinfra: fix ASAN annotationBenoît Ganne1-0/+1
Type: fix Change-Id: I90b537eba7f56dbb1928f0ab5f157218affb43f5 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-10-20vppinfra: export elog_read_file_not_inline()Dave Barach1-1/+1
Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ib9fb1723b55bf322c9fd9f928a3e3b4a529bca5b
2020-10-19vppinfra: minor refactor in lock.hDave Barach1-2/+4
For whatever reason, "typedef struct { ... } *foo_t" gives cgo a horrible case of indigestion. A minor refactor makes the pain go away. Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I856b2abf9b16348d2f6145178e683e722914c756
2020-10-18vppinfra: add export symbolsDave Barach2-3/+3
format_one_elog_event() vec_len_not_inline() vec_free_not_inline() Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I0432c1b41b985de380e0b73886d0b03ecc19c703
2020-10-17vppinfra: export elog_get_events()Dave Barach1-1/+1
Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ifc1bcbd8b5f8597796c993a2a5caf3a6c8d2471c
2020-10-17vppinfra: explicitly export symbolsDamjan Marion40-225/+229
Type: improvement Change-Id: I57a9f85f7df1fc48656b72592349f4c544302f77 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-08vppinfra: memory leak be goneDave Barach1-1/+1
Type: fix Fixes: ab1a50cf7407e31097b550226c2b6954d6371bea / gerrit 29272 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ic8146a66b54bb9ac6223cf984d4566554b73276d
2020-10-08vppinfra: fix coverity warningsDave Barach2-5/+5
Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I654747d618cc4fe99b7774827303769fe43392ed
2020-10-06vppinfra: add heap header in front of dlmalloc spaceDamjan Marion7-188/+220
This patch adds smal header in front of dlmalloc space, and it stores some additional information about the heap. Immediate benefit of this patch is that we know the underlying page size si we can display heap page statistics / real memory usage. Type: improvement Change-Id: Ibd6989cc2f2f64630ab08734c9552e15029c5f3f Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-06misc: add xxx_not_inlineDave Barach1-2/+2
vlib_main_t *vlib_get_main_not_inline(void) vlib_thread_main_t *vlib_get_thread_main_not_inline(void) elog_main_t *vlib_get_elog_main_not_inline() Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I6de306d567283ad28ef34c9be0cf27452aecbf6c
2020-10-05vppinfra: address sanitizer: do not instrument dlmalloc internalsBenoît Ganne1-0/+1
Type: fix Change-Id: I8b50777b6ce7df461e5256921591a58e52877628 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-10-02vppinfra: use clib_mem_create_heap() to create numa heap(s)Damjan Marion3-216/+0
Type: improvement Change-Id: Ie04302c576869bc7bfaa9f13ed2ea8a403a393d4 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-02vppinfra: Function to check if a bihash has been initialisedNeale Ranns2-0/+7
Type: improvement Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: Ic31f7721f326ca9d78d645abcea63ce58df5bd5b