aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
AgeCommit message (Collapse)AuthorFilesLines
2020-08-06misc: harmonize namesDave Barach5-17/+19
Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ibad744788e200ce012ad88ff59c2c34920742454
2020-07-24pci: fix non NULL-terminated vector used as C string overflowBenoît Ganne1-4/+5
Type: fix Change-Id: Iab512ba8c72c9e20aeba2d4265276bcabf095d46 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-07-16misc: add callback hooks and refactor pmcTom Seidenberg9-83/+155
Callbacks for monitoring and performance measurement: - Add new callback list type, with context - Add callbacks for API, CLI, and barrier sync - Modify node dispatch callback to pass plugin-specific context - Modify perfmon plugin to keep PMC samples local to the plugin - Include process nodes in dispatch callback - Pass dispatch function return value to callback Type: refactor Signed-off-by: Tom Seidenberg <tseidenb@cisco.com> Change-Id: I28b06c58490611e08d76ff5b01b2347ba2109b22
2020-07-16vlib: fix asan compilation with gccBenoît Ganne1-1/+1
clang tends to force alignment of all sections when compiling for address sanitizer, confusing VPP plugin infra. On the contrary, GCC does not support this attribute on sections. Selectively enable it depending upon the compiler. Type: fix Fixes: cea46522e79637f6ec37c03ec3fbeb87b160a378 Change-Id: I2dd6e52e70e6b4d89c101171cafc813e175ec472 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-07-16misc: add tracedump API pluginDave Barach1-0/+2
Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I586547508003b95eaa74e18e4a5ac6f72986822c
2020-07-01vlib: wake up workers if interrupts are postedBenoît Ganne4-2/+8
Type: fix Change-Id: If8dbbcb46193fd057fe8d704058609a3a8787d6c Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-06-23vlib: debug CLI macro expander, part deuxDave Barach1-11/+34
Deal with circular macro definitions instead of crashing due to stack overflow. Separate macro tables, per CLI session Add documentation to the Sphinx docs Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I55fc9152bd37ad0c15fa3959f38b07b63100e634
2020-06-19vlib: add recursive macro expander to debug cliDave Barach1-1/+142
All of the pieces have been sitting around for years. Added several debug CLI commands: "define <variable-name> <value>" "undefine <variable-name>" "show macro [noeval]" "echo <whatever>" Macros may refer to other macros. To defer evaluation: "define foo \$(bar)" or some such. The macro evaluator is not smart about "define foo \$(foo)" or more complicated circular definitions, so don't do that. Environment variables are available, simply use $<name-of-environment-vbl> The macro expander has a table of (overrideable) builtin names, which are evaluated by calling functions. Simple example: echo $USER define ip1 192.168.1.1/24 define ip2 192.168.2.1/24 loop create loop create set int ip address loop0 $ip1 set int ip address loop1 $ip2 show int addr show macro undefine ip1 undefine ip2 Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I08a800647bac573d8ae3cfd75c40061d41c5f976
2020-06-17docs: add more FEATURE.yaml documentationDave Barach1-0/+14
This patch documents the DNS plugin, vlib packet tracing, vnet feature arcs, and the vppinfra library. Type: docs Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Idb16ec0593d428ce78fe8404374a823a56b4b420
2020-06-16vlib: address sanitizer support for stack switch, enable clangDamjan Marion6-11/+82
Type: improvement Change-Id: I81df4b61d1f0b8c1df77c1ee9bebcb491e155b69 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-06-15buffers: fix non-default sized buffers initializationBenoît Ganne1-5/+21
Type: fix Change-Id: I4a93e1d9936414c514cb237a22624986b3ef5b3d Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-06-12vlib: node recyling and node deletion missing triggering graph node syncSteven Luong1-27/+1
When recycling a graph node vnet_register_interface, it is missing an explicit call to vlib_worker_thread_node_runtime_update(). However, there is an implicit call to vlib_worker_thread_node_runtime_update() via vnet_sw_interface_set_flags_helper() if it enables a new feature on the interface for the first time. But that implicit call is not guaranteed. For example, if an interface is created, deleted, and created, then it may skip the implicit call to vlib_worker_thread_node_runtime_update(). When that happens, the graph nodes on thread 0 are not sync'ed to the worker threads. So the worker thread's graph nodes are out of sync momentarily with the main thread's graph nodes until some other event happens which calls for a sync is needed. During this window, the worker thread's graph node is vulnerable and may experience a crash. When deleting a graph node, we never trigger a sync to the worker thread. A patch was committed 3 years ago via https://gerrit.fd.io/r/c/vpp/+/7523 to fix a show run crash. In hindsight, the approach taken by 7523 is not orthogonal. While at it, let's fix it right for both issues with a call to vlib_worker_thread_node_runtime_update() in the appropriate place and remove 7523. Type: fix Ticket: VPPSUPP-86 Fixes: gerrit 7523 / 19e9d954bd9eb4f04d48640d6540198e84ef65d7 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ic9472bd2d3a212dbfeceb526506ed0400983a142
2020-06-08vlib: stop inlining vlib_add_trace(...)Dave Barach2-2/+17
Packet tracing performance doesn't justify inlining vlib_add_trace(...) over 500 times. It makes a 15% text-segment size difference in a representative use-case: Inline: $ size .../vnet_skx.dir/ipsec/ipsec_input.c.o text data bss dec hex filename 6831 80 0 6911 1aff .../vnet_skx.dir/ipsec/ipsec_input.c.o Not inline: $ size .../vnet_skx.dir/ipsec/ipsec_input.c.o text data bss dec hex filename 5776 80 0 5856 16e0 .../vnet_skx.dir/ipsec/ipsec_input.c.o Retain the original code as vlib_add_trace_inline, instantiate once as vlib_add_trace. Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Iaf431dbf00c4aad03663d86f9dd1322e84d03962
2020-06-08vlib: Coverity fixDave Barach1-1/+1
Fix a nit warning: we're not likely to create a vlib process with more than 4gb of stack. Type: fix Ticket: VPP-1888 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I8bc7f64287c2802b0c286ce3d04443ac723a9a33
2020-06-04fib: add barrier sync, pool/vector expand casesDave Barach2-0/+41
load_balance_alloc_i(...) is not thread safe when the load_balance_pool or combined counter vectors expand. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I7f295ed77350d1df0434d5ff461eedafe79131de
2020-06-03vlib: improve node interrupt handlingDamjan Marion3-47/+81
- add ability to pass data together with interrupt - avoid locking for local interrupts (same thread) Type: improvement Change-Id: I73a2ab2e716bb887a1f02c87788ae83e329f9b40 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-26pci: improve vfio loggingDamjan Marion3-20/+77
Type: improvement Change-Id: Ic49a43651b80b79fa278e29964da5cb2ead2a818 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-21vlib: enforce buffer alloc return value checkDamjan Marion1-6/+6
Type: improvement Change-Id: I33cd702f9c4d995520509fdb16e3b8f8fd50e535 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-20vlib: mmap process stacksDamjan Marion4-59/+42
Instead of allocating stack from the main heap, this patch mmaps stack memory together with guard page. This aproach reduces main heap usage, and stack memory is prefaulted on demand, so bigger process stacks will have zero impact on memory usage as long as stack memory is not needed for real. In addition, it fixes issue with systems which have bigger default page size (observed with 65536). Type: improvement Change-Id: I593365c603d4702e428967d80fd425fdee2c4a21 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-15vlib: restore commands for non-interactive sessionsBenoît Ganne1-8/+13
'quit' and 'show terminal' are valid for non-interactive sessions too. Type: fix Fixes: a58be82dda89d6496f92e451b42eee31f0cf47b4 Change-Id: Ib63244c7b64ad2e30c257ed19e982295f59bfffa Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-05-15misc: removed executable bits from source filesRay Kinsella2-0/+0
Identified and removed executable bit from source files in the tree. find . -perm 755 -name *.[ch] -exec chmod a-x {} \; Type: improvement Signed-off-by: Ray Kinsella <mdr@ashroe.eu> Change-Id: I00710d59fcc46ce5be5233109af4c8077daff74b
2020-05-15ikev2: add support for NAT traversalFilip Tehlar1-5/+6
Type: feature * initiator behind NAT supported * tested with static NAT mappings * works only with pre-configured tunnels The pre-configured tunnel has to be defined as follows: initiator (i) side: src=ip(i) dst=ip(r) responder (r) side: src=ip(r) dst=ip(nat) Change-Id: Ia9f79ddbbcc3f7dc8fde6bbeca2a433e3b784e94 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2020-05-14vlib: fix unix cli commands crash without sessionBenoît Ganne1-15/+23
If a cli command is run while there are no cli session, then cm->cli_file_pool will not be initialized and we should not try to operate on it. Type: fix Change-Id: Iaea15a23f7efd5b17fab13e6c1cbb3a9a34080e0 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-05-11vlib: fix u64 error counter cli printingFlorin Coras1-3/+3
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ie35dc623394cfb6c358740361fd85aa0924ab187
2020-05-06misc: fix coverity warningsDave Barach1-1/+1
Type: fix Ticket: VPP-1837 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I51660e4b02f449bd2db12a8cfd395c6c343d2dee
2020-05-02vlib: add nosyslog unix optionRuslan Babayev2-3/+12
The "nosyslog" option disables syslog just like the "interactive" mode but can be used together with "nodaemon". This is useful for when VPP is running under a process supervisor like runit or daemontools that pipe the stdout/stderr to a dedicated logger service. Type: feature Change-Id: Ic4287338d6836fea9f3eabdcf960dc1f51875dd1 Signed-off-by: Ruslan Babayev <ruslan@babayev.com>
2020-04-30build: rework x86 CPU variantsDamjan Marion1-1/+1
Type: improvement Change-Id: Ief243f88e654e578ef9b8060fcf535b364aececb Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-04-28vlib: add ASSERT to vlib_time_now(...)Dave Barach1-0/+7
Calling vlib_time_now (&vlib_global_main) from a worker thread is a bad mistake. ASSERT (vm->thread_index == __os_thread_index) will catch it. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I55af6de84e06143f8f43adc62103b77267a7a441
2020-04-28vlib: use flexible array in vlib_buffer for GCC-10Benoît Ganne1-1/+1
GCC-10 increase overflows-related warnings but gets confused by 0-length arrays. Use C99 flexible length array instead. Type: fix Change-Id: Ie62cfa8faaa408479a598785fd3f06ffd0233c7a Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-04-28vlib: startup multi-arch variant configurationRay Kinsella4-1/+229
Support for startup node multi-arch variant selection through startup.conf. This is to facilitate unit, functional testing and benchmarking of non-default multi-arch variant node code path. Also added parameters to make test, to specific using multi-arch variants in unit testing. Type: improvement Signed-off-by: Ray Kinsella <mdr@ashroe.eu> Change-Id: I94fd332bb629683b7a7dd770ee9f615a9a424060
2020-04-28stats: add apis to delete simple/combined countersOle Troan3-0/+36
vlib_free_simple_counter() vlib_free_combined_counter() Frees the name and two dimensional vector from the stats segment. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: If1becf7d09520ba41a3d59e2df94958ecfcf6948
2020-04-27vlib: deprecate i2c and cjDave Barach7-672/+0
i2c follows its only use case - the original 82599 driver - into extras/deprecated. cj is/was an emergency debug tool unused in several years. Move to extras/deprecated/vlib Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ib55b65373f62630db295c562974bd8f2456c3107
2020-04-21vlib: queue_hi_thresh fix to avoid deadlockElias Rudberg1-2/+4
Adapt queue_hi_thresh value using num_threads to avoid risk of deadlock between threads which could happen for example when different NAT threads try to handoff work to each other at the same time when their frame queues are congested. This change ensures that each thread can reserve a queue entry without causing problems even in the most extreme case when all threads attempt to add to the same queue simultaneously when the queue is nearly full. Type: fix Signed-off-by: Elias Rudberg <elias.rudberg@bahnhof.net> Change-Id: I9e02f753bd00833d8dd500d181b0d4f9a454d703
2020-04-13buffers: configurable buffer fault injectorDave Barach7-0/+108
When configured at compile time via the cmake VPP_BUFFER_FAULT_INJECTOR option, the buffer allocator will appear to fail a certain fraction of the time. By default, the allocator succeeds 80% of the time. Detailed command line configuration options are available, but only when the image has been compiled with cmake option described above: vlib { buffer-alloc-success-rate [0.0 ... 1.0] buffer-alloc-success-seed <nnnn> } Modify vlib_buffer_pool_create(...) so 0 is always an invalid buffer index. Debug images: add checks for bad buffer index enqueues, and also verify that f->n_vectors doesn't accidentally map one or more instances of the frame poison pattern 0xfefefefe. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Iab939858014463d1e664682805013d334d6fcbe5
2020-04-09misc: fix error handling in punt_replicateDave Barach1-2/+7
If vlib_buffer_clone (...) fails due to a buffer allocation error, update *n_dispatched with the actual number of clones, not the requested number of clones. Punt_replicate(...) should not set *to_next[0] = bi0. The original buffer is enqueued separately in punt_dispatch_node(...) Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I774ad8f8c1a0633de4cf8ae5530629201c229347
2020-04-07l2: handle complete clone fail in l2_floodDave Barach1-2/+2
vlib_buffer_clone(...) may not manage to produce any buffer clones at all. vlib_buffer_clone_256 should not smash the original buffer reference count if no clones are produced. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I14d9d53637a220485c7a0036cfc75a4149b264ea
2020-03-31vlib: move pci api types from vnet/pci to vlib/pciJakub Grajciar4-0/+103
Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I1a60809a8bbbbb8ac8b65ab990d51aae1229647f Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2020-03-21vlib: leave SIGPROF signal with its default handlerJieqiang Wang1-0/+1
When profiling VPP with MAP (a software profile suite on Arm CPUs, see details in https://www.arm.com/products/development-tools/server-and-hpc/forge/map) on Arm servers, VPP will receive SIGPROF signal because MAP uses SIGPROF signal to drive its sampler to do profiling on VPP. However, the default action of SIGPROF signal handler in VPP such as unix_signal_handler() is process termination. To profile VPP with MAP, the SIGPROF handler should be left as default, and MAP sampler will overwrite it with its own implementation. Type: feature Change-Id: Ie14e513d35ec27a66e95067689408bad8ed1ad6b Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com>
2020-03-21vlib: allow using core 0 as a last resortVladimir Isaev1-15/+12
Right now even following configuration fails: cpu { corelist-workers 0 } I think we should allow user to use CPU 0 if he explicitly configured it or as the last automatically assigned core. Type: improvement Signed-off-by: Vladimir Isaev <visaev@netgate.com> Change-Id: I041c30349bace558c673475e9a0cffccae5821f7
2020-03-21vlib: complain if workers are configured twiceVladimir Isaev1-1/+10
Right now following configuration leads to crash: cpu { corelist-workers 2 workers 2 } because threads count will be set to 2, but we have only one core in coremask. Type: fix Signed-off-by: Vladimir Isaev <visaev@netgate.com> Change-Id: Ia93b892733971e7c8ddfceaaec5f4eb8bf9063ac
2020-03-21vlib: fix error when creating avf interface on SMP systemJieqiang Wang1-1/+13
On SMP architecture, '/sys/bus/pci/devices/<devices id>/numa_node' file will return -1 as a valid value if it does not have any NUMA node information. Using -1 as a valid node id to access data structures will cause memory issue. Fix the error by setting the value of numa_node to 0 if '/sys/bus/pci/devices/ <devices id>/numa_node' returns -1 and it is a SMP system. Type: fix Change-Id: Ib60e79c3656fe5b17e08fd9011122683e8b08b6f Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com>
2020-03-20rdma: ring db only once per vector on txBenoît Ganne1-0/+18
Type: improvement Change-Id: I09b017d60bc38ff8a4a7a73aff42b27611bd8955 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-03-13vlib: add verbose sh node optionFlorin Coras1-3/+28
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I915dace4afe07ac3281f248ef7468fa5247c9668
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