summaryrefslogtreecommitdiffstats
path: root/src/vlib
AgeCommit message (Collapse)AuthorFilesLines
2020-03-12vppinfra: refactor clib_timebase_tDave Barach1-1/+8
Add a clib_time_t * argument to clib_timebase_init(...), to encourage client code to share the vlib_main_t's clib_time_t object. Display the current day / date in GMT via the "show time" debug CLI. Fix the test framework so it processes the new "show time" output format. Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I5e52d57eb164b7cdb6355362d520df6928491711
2020-03-12vlib: fix unix cli SIGSEGV for empty line inputFan Zhang1-1/+2
When logging is enabled, an empty line input (press Enter only) will cause SIGSEGV. This patch fixes the problem by checking the command length first. Type: fix Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com> Change-Id: Ib4cbd1c7bfd6a694e289d28958875c7d2356a93e
2020-03-11vlib: unix cli - log cli commands one per linePaul Vinciguerra1-0/+2
This changeset modifies the log output so that cli commands now look like: cat /tmp/vpp-cli.log 2020/03/10 19:24:42:186: ***** Start: PID 29570 ***** /* [0] is stdin */ 2020/03/10 19:24:53:518[0]: show clock 2020/03/10 19:24:56:078[0]: show clock 2020/03/10 19:25:01:983[0]: show pci /* [1] is vppctl socket */ 2020/03/10 19:26:14:372[1]: show ver 2020/03/10 19:26:23:395[1]: show hardware-interfaces 2020/03/10 19:26:28:507[1]: q instead of: cat /tmp/vpp-cli.log 2020/03/01 00:40:12:834: ***** Start: PID 29974 ***** 2020/03/01 00:40:24:969[0]: show interface2020/03/01 00:40:31:945[0]: show clo2020/03/01 00:40:41:288[0]: show classify 2020/03/01 00:40:43:753[0]: show classify ?2020/03/01 00:40:53:392[0]: show classify tables2020/03/01 00:40:57:352[0]: quit Type: improvement Change-Id: I38d85535977296d174db7121ae340850b6476a39 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-03-02rdma: improve rx loopDamjan Marion1-0/+18
Type: improvement Change-Id: If81847bc0c92d167ce03e1e94a2f8e18f8154af2 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-02-25vlib: Punt reason allocation listener enable/disable callbackNeale Ranns2-4/+39
Type: improvement allow clients that allocate punt reasons to pass a callback function that is invoked when the first/last client registers to use/listen on that punt reason. This allows the client to perform some necessary configs that might not otherwise be enabled. IPSec uses this callback to register the ESP proto and UDP handling nodes, that would not otherwise be enabled unless a tunnel was present. Change-Id: I9759349903f21ffeeb253d4271e619e6bf46054b Signed-off-by: Neale Ranns <nranns@cisco.com>
2020-02-24vlib: Alias RX or TX to directionNeale Ranns1-0/+8
Type: improvement for those that find that name usefull. Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: I6c99bcdbb10ca1615aeea6924c2d93a68b5b7684
2020-02-18vlib: calculate per-worker loops/second metricDave Barach3-1/+48
Use exponential smoothing. Each sample has a half-life of 1 second. reported_rate(t) = reported_rate(t-1) * K + rate(t)*(1-K) Sample every 20ms, i.e. 50 samples per second K = exp (-1.0/20.0); K = 0.95; Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I9aea5dd5fecfaefffb78245316adb4bf62eb2bd4
2020-02-17vlib: fix code of getting numa node with specific cpu_idLijian.Zhang1-3/+18
Use below sysfs files to check which numa node a specific cpu_id belongs to. /sys/devices/system/node/online /sys/devices/system/node/node0/cpulist /sys/devices/system/node/node1/cpulist Type: fix Change-Id: I124b80b1fd4a20dd7bd76f0ae27d5ab23a3a8ff1 Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com>
2020-02-11vppinfra: remove the historical mheap memory allocatorDave Barach2-97/+2
The mheap allocator has been turned off for several releases. This commit removes the cmake config parameter, parallel support for dlmalloc and mheap, and the mheap allocator itself. Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I104f88a1f06e47e90e5f7fb3e11cd1ca66467903
2020-02-11misc: fix coverity warningsDave Barach1-4/+6
Type: fix Ticket: VPP-1837 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I6b1ea13fc83460bf4ee75cb9249d83dddaa64ded
2020-02-11vlib: Skip core 0 if workers are configured.Jon Loeliger1-0/+15
According to the description in the startup.conf, the assignment of worker threads starts with the lcore following the main_lcore. A non-zero skip_cores will correctly achieve this assignment. However, prior to this patch when workers are assigned, the code picks up and assigns core 0 even thought it shouldn't. This patch determins if a non-zero number of workers are desired and if so, marks CPU unavailable for a worker assignment. Type: fix Change-Id: I1fdf73a6f218dcbf146fda2efc90c553f7cd6d20 Signed-off-by: Jon Loeliger <jdl@netgate.com>
2020-02-10vppinfra: use vm memory allocator for numa mappingFlorin Coras2-5/+4
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I13b239cd572ae6dfaec07019d3d9b7c0ed3edcfa
2020-02-10vlib: properly configure main thread's core idJon Loeliger1-0/+2
Prior to this patch, the main thread's core id was always reported as 0. This patch makes a call to vlib_get_thread_core_socket() on the main thread so that its core id is set properly. Type: fix Fixes: 5d64c7868f67749a6c99eb4ee5998b518ab6c71c Change-Id: I019cb95eec031da25197e48d956038c4bd6b5040 Signed-off-by: Jon Loeliger <jdl@netgate.com>
2020-02-10misc: add FEATURE.yaml filesDave Barach1-0/+13
For src/vnet/classify, src/vnet/cop, src/vnet/pg, and src/vlib/unix Type: docs Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ib6ab734608693a1e9562a44808246950616e8d36
2020-02-06vlib: add plugin override supportDave Barach6-36/+205
Allow a plugin to override (suppress loading of) other plugins. This mechanism allows a developer to prevent specific plugins from being loaded. To do so, provide an "overrides" list in the plugin definition: VLIB_PLUGIN_REGISTER () = { <snip> .overrides = "avf_plugin.so,ioam_plugin.so,dpdk_plugin.so", }; or some such. Simply list the plugins in question as shown above. The .overrides structure member is limited to 256 octets. The named .elf section mechanism used to discover the vlib_plugin_registration_t's precludes the use of a variable-length array of strings. Use the vlib log to eliminate plugin and built-in vat plugin loader console spew. Added vlib_log_register_class_rate_limit(...) to allow procedural configuration of the log rate-limit. We *never* want to rate-limit plugin loader messages. Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I0a9327b8cf5508482f057342783252112cb44170
2020-02-05vppinfra: numa vector placement supportDave Barach4-16/+100
Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I7e7d95a089dd849c1f01ecea84529d8dbf239f21
2020-01-30vppinfra: improve clocks_per_second convergenceDave Barach1-3/+7
Apply exponential smoothing to the clock rate update calculation in clib_time_verify_frequency(), with a half-life of 1 minute and a sampling frequency of 16 seconds. Within 5 minutes or so, the calculation converges With each rate recalculation: reset total_cpu_time based on the kernel timebase delta since vpp started, and the new clock rate Improve the "show clock [verbose]" debug CLI command. BFD echo + echo fail tests marked off until the BFD code can be reworked a bit. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I24e88a78819b12867736c875067b386ef6115c5c
2020-01-07vlib: fix coverity warning / real bugDave Barach1-1/+1
The path must be next-to-impossible to hit, because the code has been wrong for at least 5 years. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I23b8c4e1631827e7931f353c561c1e19c596c598
2019-12-17misc: don't os_exit(1) causing core on SIGINTChristian E. Hopps1-1/+5
It's not typical for a program to core when it receives a SIGINT, so keep this from happening. Type: fix Signed-off-by: Christian E. Hopps <chopps@chopps.org> Change-Id: I2c15985a57e6ea898ff05c4001e4b30b41154eba
2019-12-17vlib: add max-size configuration parameter for pmallocjieqiang wang1-0/+3
Enable 'max-size' configuration parameter to set maximum size of memory space allocated for pmalloc module. This parameter along with existing 'base-addr' falls into physmem section. Both are dedicated parameters to pmalloc module. Type: feature Change-Id: I939f25156b9a43440a24d69a7397d57eb6c2d392 Signed-off-by: Jieqiang Wang <Jieqiang.Wang@arm.com>
2019-12-17vlib: fix startup-config-process stack overflowGordonNoonan1-0/+1
Type: fix Startup config setting an i40e/ice interface up in Debug VPP consumes more than the currently available stack space. Signed-off-by: GordonNoonan <gordon.noonan@intel.com> Change-Id: I98b52c5596799017b97f802a8661b76cd1bb3245
2019-12-17vlib: fix an issue with show pciVratko Polak1-1/+1
The fix has been received over e-mail from Lijian Zhang. https://lists.fd.io/g/vpp-dev/message/14808 Type: fix Ticket: VPP-1805 Change-Id: I73e5fe7dcbe2b0b1c639d844f29183eab3b6dd66 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-12-17vlib: fix vector-as-C-string overflowBenoît Ganne2-3/+3
Type: fix Change-Id: If0419ff1a82d45e5b3326973008e1b9feb290c5a Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-12-12vlib: fix "<command> help"Dave Barach1-13/+9
Walk the sub_commands vector directly. Type: fix Fixes: 6b3f25caff262b536a5449ac5461dd041c92a655 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I3022b39e5a739647ec68effc6756166ce2da85b6
2019-12-09vlib: improve test coverageDave Barach5-181/+25
Add tests. Remove unused rule-based parser code. Type: test Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I3ca3a9dd9da8ee8f3a47004c98f2f5644db10057
2019-12-05classify: vpp packet tracer supportDave Barach3-1/+58
Configure n-tuple classifier filters which apply to the vpp packet tracer. Update the documentation to reflect the new feature. Add a test vector. Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Iefa911716c670fc12e4825b937b62044433fec36
2019-11-27vlib: add 'wait' cli commandPaul Vinciguerra1-0/+40
When running exec scripts, there can be a need to wait between statements. Type: feature Change-Id: I2a45b390697e09fc222358c9354f28e3368a06ba Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-11-27misc: add address sanitizer heap instrumentationBenoît Ganne2-4/+4
Introduce AddressSanitizer support: https://github.com/google/sanitizers/ This starts with heap instrumentation. vlib_buffer, bihash and stack instrumentation should follow. Type: feature Change-Id: I7f20e235b2f79db72efd0e756f22c75f717a9884 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-11-26misc: add gdb helpers for vlib buffersBenoît Ganne1-0/+7
Type: feature Change-Id: I7e619040857310fffd33c355f6c491a55f7a4a02 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-11-20vlib: improve code coverage, part deuxDave Barach2-29/+0
Type: test Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: If31f4b50da7a6e4a9704ceb3415c582143c08355
2019-11-20vlib: pci: fix non-NULL terminated C-stringBenoît Ganne1-2/+2
Type: fix Change-Id: I6f25d9295b973ab7133071b6dc325ecd86386898 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-11-18session: Increasing the Header lengthe sizeSrikanth Akula1-1/+0
Type: feature For some deployments(mobile traffic) we need few extra bytes of space Signed-off-by: Srikanth Akula <srakula@cisco.com> Change-Id: I3367561dc23dbb8b266dea583e23b9430fd7dcab
2019-11-11vlib: fix handoff queue sequencing bugDave Barach1-1/+2
Set vm->check_frame_queues after actually enqueuing a frame. Under obscure circumstances, the code managed to set check_frame_queues so far in advance that 100 dispatch cycles could elapse before the frame enqueue succeeded. That resulted in permanent lack of queue service. Type: fix Ticket: VPP-1734 Fixes: 18191 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: If2d398202b4ba2b96581d25e8142daef3f74c9e5
2019-11-04vlib: fix for vlib_node_add_next_with_slotChristian Hopps1-1/+10
- vlib_node_add_next_with_slot was not cleaning the old next node references to the given slot when replacing it with new next node. This mostly worked until one tried to set the slot to a previously (but not currently) used next node for that slot. Type: fix Signed-off-by: Christian Hopps <chopps@labn.net> Change-Id: I7ee607625da874e320158b80f12ddc16e377f8e9
2019-11-02vlib: enhance the "show cli" debug CLI commandDave Barach2-49/+209
Dump the entire CLI, mp-safe commands, non-mp-safe commands, commands which have been executed. Optionally, clear the hit counters. Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ie38fc664b7deaabc35ca35be68db7e159272f551
2019-11-01vlib: Handle race in thread barrier processingAlexander Kabaev1-1/+1
When CLIB_DEBUG is enabled, vlib_foreach_main macro asserts that vlib_main it currently looks at is safely parked in barrier, by checkling that vlib_main->parked_at_barrier is not 0. Unfortunately, the check is racy - workers first increment the atomic counter to indicate that they have reached the barrier and _then_ set this_main->parked_at_barrier to 1. For the last worker to suspend this opens the race - main thread is free to execute and assert immediately after atomic counter has been incremented, before worker gets to write to own parked_at_barrier. Fix this by simply swapping the order of two operations. Type: fix Signed-off-by: Alexnader Kabaev <kan@FreeBSD.org> Change-Id: Iae47abd6ca0be1c5413f5ecaefabc64cd7eac2ed
2019-10-31vlib: only dump 1st buffer in chain by defaultBenoît Ganne3-4/+15
Several nodes include buffers in their traces, but only the 1st. When formatting the trace we must not try to iterate through all chained buffers. Default to display only the 1st buffer. Type: fix Change-Id: Ib3c668bbf4ab70ae68eba2ac402c7b7329825b70 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-10-30vlib: fix subclass name being truncated in outputPaul Vinciguerra1-1/+1
Type: fix Change-Id: I50816cca4eb88f58209138a348fc5954ab835f5b Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-10-30vlib: Trivial - fix typo in short helpPaul Vinciguerra1-1/+1
Type: fix Change-Id: Ifada594088984291ce2e79da0bbbbd1f500640c9 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-10-28vlib: don't use vector for keeping buffer indices in the poolDamjan Marion3-35/+57
Type: refactor Change-Id: I72221b97d7e0bf5c93e20bbda4473ca67bfcdeb4 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-10-28vlib: unix trivial- clean up typos in docsPaul Vinciguerra1-2/+2
seen while reading through the code. Type: style Change-Id: I7a2f021b9f06d0eebb2ea3d0cafb6955ccb14781 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-10-25mdata: buffer metadata change tracker pluginDave Barach1-8/+11
A handy tool in case you need to know which metadata will be changed when a packet visits a certain node. Reflect metadata changes into format functions used by the vpp-specific wireshark dissector. Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I96fe8a24db4082bb29fe2a33cc522e8616a3a1bb
2019-10-20vlib: linux: fix wrong iommu_group value issue when using dpdk-pluginYulong Pei1-22/+19
When VPP work with dpdk-plugin, linux_vfio_main_t->container_fd is always -1 since it never have chance to run open("/dev/vfio/vfio") to get the fd. But this lead to a potential issue of VPP, that is, when start VPP without uio-driver field setup in /etc/vpp/startup.conf, VPP will run to automatical select uio driver in vlib_pci_bind_to_uio() and the function depend on iommu_group value to decide to work on vfio or vfio-noiommu mode. Since in vlib_pci_get_device_info() have the condition container_fd != -1, so the iommu_group value will be always -1 at this scenario, this caused that VPP mistake to run with vfio-noiommu driver on intel_iommu=on state. Actually in order to get iommu_group and iommu_group/name value, no need to depend on linux_vfio_main_t->container_fd value, so the fix remove the condition lvm->container_fd != -1, then it can get the correct iommu_group value. Type: fix Change-Id: I3f162fc4971b9a2b8717205f8f3b52e30c5e5b69 Signed-off-by: Yulong Pei <yulong.pei@intel.com>
2019-10-18vlib: enable worker-thread dispatch pcap traceDave Barach1-3/+7
Needed a bit of foreach_vlib_main(...) action to turn on/off all instances of vm->dispatch_pcap_enable, and to pick up the pcap_main_t pointer from vlib_global_main. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I49b69b87934c7dc7a9835cd07aa2c5c4d3c79f18
2019-10-08vlib: fix cli process stack overflowChenmin Sun1-1/+1
Type: fix Some cli processes, including configuring an test flow on an i40e interface consume more than the currently available stack space. Signed-off-by: Chenmin Sun <chenmin.sun@intel.com> Change-Id: I3df53d251cd43286f94647384d6e50a463bad15c
2019-10-07vlib: move thread barrier around mod of global node next dataChristian E. Hopps1-6/+5
The old code modified the node next array prior to obtaining the thread barrier. Then it updated the runtime node data, and upon barrier release caused reforking of each worker thread. The reforking clones the main thread nodes and reconstructs the runtime node structure. This cloning is not 100% "deep" in the sense that the node next array is shared (i.e., only the pointer is copied). So prior to the barrier being obtained the node's next array is being changed while workers are actively using it (bad). Treating the node next array as read-only in the workers and sharing it is a decent optimization so instead of trying to fix that just move the barrier a little earlier in the process to protect the node next array as well. This was tripping an assert in next frame ownership change by way of the ip4-arp node. The assert verifies that the node's next array length is equal to the runtime next node count. The race above was lost and the node next array data was updated in the main thread while the arp code was still executing in a worker. This was being hit when many arp requests were being sent from both ends of a tunnel during which the add next node function was called, which often led to an assert b/c the next node array was out of sync with the runtime next node count. - PS#2 update - move barrier sync to just above code that modifies state. Ticket: VPP-1783 Type: fix Signed-off-by: Christian E. Hopps <chopps@chopps.org> Change-Id: I868784e28f994ee0922aaaae11c4894a3f4f1fe7 Signed-off-by: Christian E. Hopps <chopps@chopps.org>
2019-10-05misc: add "show run summary"Dave Barach1-11/+19
Prints the interior node vector rate, rx / tx / drop rates Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I57130db0f99e852a8498aa90d01e52f7ac33dcc9
2019-10-05vlib: pci: set pci driver name to none when no driver is loadedBenoît Ganne1-0/+2
If no Linux PCI driver module is loaded, then the driver_name in the PCI info struct is NULL. This can triggers crash when checking driver name eg. in vlib_pci_device_open(). Default to "<NONE>" as driver name, which should never match. Type: fix Change-Id: I9e69889a7566467bd8220b92bbbaa72ada957257 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-10-02vlib: improve summary vector-rate statisticsDave Barach4-78/+54
Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I4b77879b0a84fdec3c1518a972cf003d5135222d Signed-off-by: Ole Troan <ot@cisco.com>
2019-09-30vlib: fix old nodes vector overflow in reforkBenoît Ganne1-5/+2
Type: fix Change-Id: I81c4cf0ce87288bb2d3c7b9f31e9419290d588b4 Signed-off-by: Benoît Ganne <bganne@cisco.com>