summaryrefslogtreecommitdiffstats
path: root/src/vlib
AgeCommit message (Collapse)AuthorFilesLines
2023-08-07vlib: support sibling node creation with vlib_register_node()Damjan Marion1-20/+54
Type: improvement Change-Id: I7e82a262692b2b6513f81889d78a43c10ca7bfb2 Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-08-07vppinfra: add clib_file_get_resolved_basenameDamjan Marion3-17/+8
more generic version of clib_sysfs_link_to_name with support for format strings... Type: improvement Change-Id: I0cb263748970378c661415196eb7e08450370677 Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-08-02vlib: remove dependency on libuuidDamjan Marion2-30/+55
Type: improvement Change-Id: I4e2b2e4f227dfcb3df36166db13c8aa5c0b603f5 Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-07-28vlib: fix gcc build breakageDave Wallace1-1/+3
Type: fix Fixes: 00ea98ad6 Change-Id: I4ac8c9c5902299d5f283ba4912d52d9bfcedef5c Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2023-07-28vlib: pci cleanup and improvementsDamjan Marion4-458/+527
Change-Id: Ieafbed6f2db3dec65e4b43d84a4661f6a1bbe891 Type: improvement Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-07-28vlib: fix coverity issue in vlib_node_set_interrupt_pendingDamjan Marion1-2/+5
Type: fix Fixes: cc8249c Change-Id: Iebfbbd1e00782c4097cc840460b5177d18921131 Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-07-26vlib: rename vnet_log_get_class_dataVratko Polak2-3/+3
It is a function in vlib, so no reason to mention vnet. Type: fix Fixes: bf179a91d8d224c64d08643a2bb52580f68ce96b Change-Id: Ic5f601d94d88b667f7ce44a017a0e1d5b4db5da1 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2023-07-25vlib: interrupt mode support for pre-input nodesDamjan Marion6-17/+53
Type: improvement Change-Id: Ic6e60597d2be63e3a0ae4399a81dbbd72392f30d Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-07-25classify: add bpf support to pcap classifierMaxime Peim2-2/+2
Type: feature Change-Id: I28fb38e49c89f4c4d4cc58c1a5c0aa8502678472 Signed-off-by: Maxime Peim <mpeim@cisco.com>
2023-06-30vlib: introduce trace filter functionsMohammed Hawari3-17/+179
Change-Id: I7a988fafe98599e4fcf7cdaa307a69b9d76650f0 Signed-off-by: Mohammed Hawari <mohammed@hawari.fr> Type: improvement
2023-06-22tests docs: fix lcov code coverage report generationDave Wallace1-11/+0
- Updated/rebased version of https://gerrit.fd.io/r/c/vpp/+/34199 Type: test Change-Id: I43913ecfd11a4578bdb10c4be76253fe38d57976 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2023-05-27vlib: add vlib_log_is_enabledDamjan Marion2-20/+34
Type: improvement Change-Id: I052e0d56cc6d89cd66c83a9bb81e2273d396d510 Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-04-12vlib dhcp: default to logging without elogsFlorin Coras1-1/+1
Some components, like dhcp, log constantly changing strings which in turn forces elog string table to grow unbound. To avoid this, as a workaround, only turn on elog logging if requested. Actual fix that adds configuration for logging subclasses should come in a later patch. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ie8b26251fb7115d866c2bd65353daa33cdab1ab6
2023-04-10vlib:process node scheduling use timing_wheel have problem.jinsh2-2/+6
The time wheel should not be started in the loop while processing expired events. can be set p->stop_timer_handle = ~0 to solve. Type: fix Signed-off-by: jinsh <jinsh11@chinatelecom.cn> Change-Id: Ie9a4293f39f981f50d280b39a5d958d319ee2300 Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2023-04-06vlib: reset stop_timer_handle on expired processesMatthew Smith1-8/+23
Type: fix The main loop populates a vector of suspended process nodes to dispatch by calling TW (tw_timer_expire_timers_vec), which identifies expired timers and appends the user handle for each one to the vector. Subsequently, the vector is iterated and the process node corresponding to each handle is dispatched. The vast majority of the time, the process node will end up suspending itself again to wait for a new timer or event. Given a process node A whose timer has expired, between the point when the timer expired and the point when A is dispatched and suspends itself again, its stop_timer_handle contains a stale value. If another process node B is dispatched before A is dispatched, it may end up using the timer ID that A formerly used. If another process node C is dispatched after B and before A and calls vlib_process_signal_event() to signal A, the timer started by B can be deleted by vlib_process_signal_event_helper(). After getting the vector of process node IDs for expired timers, reset the stop_timer_handle on each of those nodes. Change-Id: I266da438e76e1fc356016da0b9b4941efac1c28a Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2023-04-06vppinfra: refactor uword bitmapsDamjan Marion1-24/+22
Type: improvement Change-Id: I4f05a0435825cd23b8ad8a6f8f1397e60c522319 Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-04-02vlib: add vlib_frame_bitmap_{set,clear}_bit_at_indexDamjan Marion1-0/+16
Type: improvement Change-Id: I5703728f680f0c8431e4099b398827bd094b60df Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-03-30vlib: fix segfault on panic in workerMikhail Sokolovskiy1-1/+7
Vlib panic uses longjmp to exit main loop, but workers don't set main_loop_exit field on initialization, so this jump corrupts registers and causes segfault. There I add clib_warning and abort if longjmp context hasn't been set. Type: fix Signed-off-by: Mikhail Sokolovskiy <sokolmish@gmail.com> Change-Id: I0d705f1f139c4083af75066aeb525964ed0aa202
2023-03-14vlib: pre-alloc dma backend batchesMarvin Liu1-0/+1
Allocate and initialize dma batch structure when adding dma config. The number of required dma batches is set by max_batches parameter. Thus dma batches are not allocated dynamically in worker thread. Application need to check the return value of vlib_dma_batch_new. Type: improvement Signed-off-by: Marvin Liu <yong.liu@intel.com> Change-Id: I5d05a67b59634cf2862a377d5ab77cb1040343ce
2023-03-10vlib: 512-bit SIMD version of vlib_buffer_freeLeyi Rong1-1/+69
Process 8 packets perf batch in vlib_buffer_free_inline() when CLIB_HAVE_VEC512 is enabled. Type: improvement Signed-off-by: Leyi Rong <leyi.rong@intel.com> Change-Id: I78b8a525bce25ee355c9bf0e0f651698a8c45bda
2023-03-07vlib: stop worker threads on main loop exitVladislav Grishenko1-1/+2
If not, worker threads may continue own loops after deinit and/or thread0 exit with related crashes due no rpc capability, unmapped shared memory, etc. Main loop exit handlers that uses barrier sync will be happy too as long as recursive barrier sync is supported. Type: feature Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: I255a796b06936d96715683e3f062128060233dc6
2023-03-06vlib: fix vlib_log for elogluoyaozu1-8/+8
test output before fix: DBGvpp# event-logger clear DBGvpp# test log warn cli log test-log for-elog cli/log [warn ]: test-log for-elog DBGvpp# test log info cli log test-log for-elog cli/log [info ]: test-log for-elog DBGvpp# show event-logger 2 of 131072 events in buffer, logger running 53.022586433: log-notice: test-log for-elog 60.318329361: log-debug: test-log for-elog DBGvpp# test output after fix: DBGvpp# event-logger clear DBGvpp# test log warn cli log test-log for-elog cli/log [warn ]: test-log for-elog DBGvpp# test log info cli log test-log for-elog cli/log [info ]: test-log for-elog DBGvpp# show event-logger 2 of 131072 events in buffer, logger running 18.362721151: log-warn: test-log for-elog 25.124570555: log-info: test-log for-elog DBGvpp# Type: fix Signed-off-by: luoyaozu <luoyaozu@foxmail.com> Change-Id: Ie1122787f9efb611cdafc671b4ccf68b43984924
2023-03-06vlib: avoid non-mp-safe cli process node updatesVladislav Grishenko1-56/+34
Node renames, clone and node_by_name hash updates should be done in vlib_node_register() / vlib_node_rename() under barrier, or else runtime per-node stats can be either inaccurate or lead to UB. Drop cli process nodes renaming rather than adding barrier syncronization on reuse, nodes will get "unix-cli-process-ID" stable names, description and terminal names are preserved and can be obtained with "show cli-sessions" and "show terminal" commands. Also fix insufficient name width for "show cli-sessions" with table formatting, output sample: DBGvpp# sh cli-sessions PNI FD Name Flags 708 14 unix-cli-local:10558 iSLpa 710 15 unix-cli-127.0.0.1:33252 ISlpA DBGvpp# sh terminal Terminal name: unix-cli-127.0.0.1:33252 Terminal node: unix-cli-process-1 Terminal mode: char-by-char Terminal width: 158 Terminal height: 43 ANSI capable: yes Interactive: yes History enabled: yes History limit: 50 Pager enabled: yes Pager limit: 100000 CRLF mode: CR+LF Type: improvement Signed-off-by: Vladislav Grishenko <themiron@yandex-team.ru> Change-Id: I40af4c0a5e5be92d5e3ebcd440fa55390aeb0e8b
2023-03-06vlib: fix macro define command not work in startup config exec scriptXiaoming Jiang1-81/+8
Type: fix Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com> Change-Id: Idb34490199a78d5b0c1fe2382b6483a6e3a6fd1f
2023-03-06vlib: fix ASAN fake stack size set error when switching to processXiaoming Jiang1-1/+2
Type: fix Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com> Change-Id: I2add6cb8dba837e47596983ec8303883aba3a138
2023-03-06vppinfra: display only the 1st 50 memory traces by defaultBenoît Ganne1-1/+1
When using memory traces it can take a long time to display all traces bigger than 1k if there are lots of them, especially as we need to resolve symbols. It is better to display only the 1st 50 by default, unless verbose is used. Also fix the help string. Type: improvement Change-Id: I1e5e30209f10d2b05c561dbf856cb126e0cf513d Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-03-06stats: fix node name compare error when updating stats segmentXiaoming Jiang1-1/+1
Type: fix Signed-off-by: Xiaoming Jiang <jiangxiaoming@outlook.com> Change-Id: Ib39aa345415720dd05a1b3e12e3e03eac43c5606
2023-01-30vlib: chdir to runtime_dirDamjan Marion1-0/+3
Type: improvement Change-Id: Id8ab75ef4384a1029ab7ee84048f347708307830 Signed-off-by: Damjan Marion <dmarion@me.com>
2023-01-21vlib: make pending_interrupts valid for AddressSanitizerBenoît Ganne1-1/+1
vec_alloc_aligned() pre-allocates the vector memory but does not update its size, making ASan unhappy when trying to access it. Type: fix Change-Id: I80e753cf2458cf516d1180a24cfaca4f382339d5 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-01-18pci: fix musl crashBenoît Ganne1-8/+9
The musl libc does not support closedir(0) resulting in a crash. Only call closedir() if we successfully opened it. Type: fix Change-Id: I3198454f44735501047afc42b94b2fea273212f4 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2023-01-17vlib: install dma.h to fix out-of-tree pluginsMohammed Hawari1-0/+1
Change-Id: I7888ab58abced93859ce15d0dbd1c3d7c94a02f5 Signed-off-by: Mohammed Hawari <mohammed@hawari.fr> Type: fix Fixes: 0654242d1ef51566f0d58445a16053cf376e5a6e
2023-01-14vlib: add const to char* params of several funcsSergey Nikiforov2-2/+3
These functions do not need modifiable strings. It helps with linker sections as well as C++ compatibility. It is a good style to use const where approriate. Type: refactor Signed-off-by: void234@gmail.com Change-Id: Ib437a01663aa61860c6a938d869ed1111da71ec7
2023-01-12misc: use right include for fctnl.h and poll.hGuillaume Solignac1-1/+1
Musl is stricter than glibc and has a warning that including fctnl.h and poll.h should be prefered rather than their sys/ counterparts, which breaks -Wall setups. Type: fix Signed-off-by: Guillaume Solignac <gsoligna@cisco.com> Change-Id: Id101e999371951b0927cc8c4109f8f1536de1bc2
2023-01-11pci: add option to force uio bindingBenoît Ganne2-62/+66
Type: improvement Change-Id: Ifea4badd58f7e2b5e792d7506f6747851a08587f Signed-off-by: Benoît Ganne <bganne@cisco.com>
2022-12-02buffers: revert protect against bad thread indicesBenoît Ganne1-4/+1
This change was introduced to workaround a bug in the NAT code, but we should not woraround plugin bugs in infra. Type: fix Fixes: f8631ce7e8886136b4543a7926ffdf1bc760fb11 Change-Id: Id6ee281cf1fe8466b6522905fc2a176716e3d52f Signed-off-by: Benoît Ganne <bganne@cisco.com>
2022-11-30stats: add boot time in stats segmentOle Troan2-1/+5
Write time into /sys/boottime on VPP start. This allows a stateless control plane agent to validate if it's reconnecting to the same VPP instance. Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Iba7f334339c46142045e43da6efab11612e7b9c0 Signed-off-by: Ole Troan <ot@cisco.com>
2022-10-17vlib: Counter free needs to NULL the allocated counter vectorNeale Ranns1-2/+8
otherwise the next time the counter is validated this is dangling. Type: fix Fixes: 58fd481d73 Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Ifa8d5ff27175cf6dfb30cbf023fa3251fe5c780e
2022-10-12misc: fix issues reported by clang-15Damjan Marion2-3/+4
Type: improvement Change-Id: I3fbbda0378b72843ecd39a7e8592dedc9757793a Signed-off-by: Damjan Marion <dmarion@me.com>
2022-10-11vppinfra: fix AddressSanitizerBenoît Ganne3-0/+3
When checking for CLIB_SANITIZE_ADDR to enable specific behavior for AddressSanitizer, we must have vppinfra/clib.h included as it is defined there. Type: fix Change-Id: I9060c3c29c1289d28596c215a1d1709b2ea7c84e Signed-off-by: Benoît Ganne <bganne@cisco.com>
2022-09-12vlib: add vlib_frame_bitmap_is_bit_setDamjan Marion1-0/+8
Type: improvement Change-Id: I2f3fab893a10b060f91b07ee17b8727d241830ea Signed-off-by: Damjan Marion <dmarion@me.com>
2022-09-09vlib: don't leak node frames on reforkDmitry Valter6-10/+22
Free node frames in worker mains on refork. Otherwise these frames are never returned to free pool and it causes massive memory leaks if performed under traffic load Type: fix Signed-off-by: Dmitry Valter <d-valter@yandex-team.ru> Change-Id: I15cbf024a3f4b4082445fd5e5aaa10bfcf77f363
2022-08-30vlib: fix coverity 277203Andrew Yourtchenko1-1/+1
Fix integer overflow. Type: fix Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com> Change-Id: I72de6f88be064f188204d0f6d3167a3a8d7de58d
2022-08-29vlib: use error description when dropping packetsArthur de Kerhor1-1/+1
Using the error name makes it less explicit in the packet trace than the error description when a packet is dropped. Example of the trace when the TTL is <=1: 01:03:17:015278: drop ip4-input: time_expired We should have "ip4 ttl <= 1" instead of "time_expired" Type: fix Change-Id: Ic9decf10d609cc938e39d0f449359e41c406267e Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com>
2022-08-25vlib: introduce DMA infrastructureMarvin Liu5-0/+445
This patch introduces DMA infrastructure into vlib. This is well known that large amount of memory movements will drain core resource. Nowadays more and more hardware accelerators were designed out for freeing core from this burden. Meanwhile some restrictions still remained when utilizing hardware accelerators, e.g. cross numa throughput will have a significant drop compared to same node. Normally the number of hardware accelerator instances will less than cores number, not to mention that applications number will even beyond the number of cores. Some hardware may support share virtual address with cores, while others are not. Here we introduce new DMA infrastructure which can fulfill the requirements of vpp applications like session and memif and in the meantime dealing with hardware limitations. Here is some design backgrounds: Backend is the abstract of resource which allocated from DMA device and can do some basic operations like configuration, DMA copy and result query. Config is the abstract of application DMA requirement. Application need to request an unique config index from DMA infrastructure. This unique config index is associated with backend resource. Two options cpu fallback and barrier before last can be specified in config. DMA transfer will be performed by CPU when backend is busy if cpu fallback option is enabled. DMA transfer callback will be in order if barrier before last option is enabled. We constructs all the stuffs that DMA transfer request needed into DMA batch. It contains the pattern of DMA descriptors and function pointers for submission and callback. One DMA transfer request need multiple times batch update and one time batch submission. DMA backends will assigned to config's workers threads equally. Lock will be used for thread-safety if same backends assigned to multiple threads. Backend node will check all the pending requests in worker thread and do callback with the pointer of DMA batch if transfer completed. Application can utilize cookie in DMA batch for selves usage. DMA architecture: +----------+ +----------+ +----------+ +----------+ | Config1 | | Config2 | | Config1 | | Config2 | +----------+ +----------+ +----------+ +----------+ || || || || +-------------------------+ +-------------------------+ | DMA polling thread A | | DMA polling thread B | +-------------------------+ +-------------------------+ || || +----------+ +----------+ | Backend1 | | Backend2 | +----------+ +----------+ Type: feature Signed-off-by: Marvin Liu <yong.liu@intel.com> Change-Id: I1725e0c26687985aac29618c9abe4f5e0de08ebf
2022-08-24vlib: allow longer version stringMatthew Smith1-2/+2
Type: improvement When trying to use a version string in a downstream build that appends a timestamp to the standard version string, compiling fails because the version string is too long for the version and version_required fields in vlib_plugin_registration_t. Increase the size of those arrays from 32 to 64 chars. Signed-off-by: Matthew Smith <mgsmith@netgate.com> Change-Id: I3632139e5ae7110aa4769359f380ad29522ad4ed
2022-08-19vlib: memory leak in vlib_register_errors on create and delete interfaceSteven Luong1-0/+1
format returns a vector which must be free or memory is leaked. From show memory 3716528 66716 0x7fffbfeb0db0 _vec_resize_internal + 0xe6 _vec_add + 0x164 do_percent + 0xb82 va_format + 0xb9 format + 0x156 vlib_register_errors + 0x76c setup_tx_node + 0x5c vnet_register_interface + 0xca6 vnet_eth_register_interface + 0xdd memif_create_if + 0x975 memif_create_command_fn + 0x461 vlib_cli_dispatch_sub_commands + 0xec8 (gdb) list *(vlib_register_errors + 0x76c) 0x7ffff6e8280c is in vlib_register_errors (/home/sluong/vpp/vpp/src/vlib/error.c:224). 219 220 vec_validate (nm->node_by_error, n->error_heap_index + n_errors - 1); 221 222 for (u32 i = 0; i < n_errors; i++) 223 { 224 t.format = (char *) format (0, "%v %s: %%d", n->name, cd[i].name); 225 vm->error_elog_event_types[n->error_heap_index + i] = t; 226 nm->node_by_error[n->error_heap_index + i] = n->index; 227 } Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I2983f081b7e2c1b2d18d66afe45282933efbe127
2022-08-09vlib: vlib_validate_buffer_enqueue_with_aux_x1Mohammed Hawari2-0/+71
This change implement a flavour of vlib_validate_buffer_enqueue_x1 with aux data support Change-Id: I2ecf7af49cf15ecd23b12d8acd57fe90546c1af7 Type: improvement Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
2022-07-19stats: add loops per second counter in the stats segment.Radha krishna Saragadam1-3/+15
This change adds loops per second in the stats segment. Applications using the stats segment to monitor VPP can use this for better monitoring Type: fix Signed-off-by: Radha krishna Saragadam <krishna_srk2003@yahoo.com> Change-Id: I53081f40ee918eec9763513a639b9d8a02488b20
2022-07-06misc: pass NULL instead of 0 for pointer in variadic functionsAndreas Schultz3-16/+12
0 is not NULL (at least not in all cases), passing 0 into a variadic function in a place where the consumer reads it as pointer might leave parts of the pointer uninitilized and hence filled with random data. It seems that this used to work with gcc, but clang seems to treat the 0 in those places as a 32bit integer. Type: fix Signed-off-by: Ivan Shvedunov <ivan4th@gmail.com> Signed-off-by: Andreas Schultz <andreas.schultz@travelping.com> Change-Id: I37d975eef5a1ad98fbfb65ebe47d73458aafea00
2022-07-01buffers: protect against bad thread indicesJon Loeliger1-0/+3
There is a very rare bug in NAT processing that yeilds a thread index of ~0. When this happens, vlib_get_frame_queue_elt() suffers a segfault and VPP quits. Prevent an outright fault by dropping the packet instead. Type: fix Signed-off-by: Jon Loeliger <jdl@netgate.com> Change-Id: I48c7a268925bb821ea15e58db5d4bfb211c40c09