summaryrefslogtreecommitdiffstats
path: root/src/vlib
AgeCommit message (Collapse)AuthorFilesLines
2020-10-19misc: don't export symbols from pluginsDamjan Marion1-1/+1
Type: improvement Change-Id: I2a176fe2871d2e54b010bffc4f1f7a3616f0c455 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-15vlib: add cgo-friendly plugin registration supportDave Barach2-9/+128
Allows us to declare plugin registrations in a non-disgusting way: var plugin_reg = vpp.PluginRegistration{ Description: "The CGO plugin", Version: "My Version", Overrides: "sample_plugin.so", } It turns out that the specific compiler setup generates (.data section offset, length) pairs in the .vlib_plugin_r2 section: Contents of section .vlib_plugin_r2: 1ba9d0 00000000 00000000 50a81800 00000000 ........P....... 1ba9e0 0a000000 00000000 00000000 00000000 ................ 1ba9f0 00000000 00000000 00000000 00000000 ................ 1baa00 00000000 00000000 00000000 00000000 ................ 1baa10 00000000 00000000 70a81800 00000000 ........p....... 1baa20 0e000000 00000000 ........ Contents of section .data: 18a800 00a81800 00000000 00000000 00000000 ................ 18a810 00000000 00000000 00000000 00000000 ................ 18a820 00000000 00000000 00000000 00000000 ................ 18a830 00000000 00000000 00000000 00000000 ................ 18a840 00000000 00000000 14000000 00000000 ................ 18a850 4d792056 65727369 6f6e0000 00000000 My Version...... 18a860 00000000 00000000 14000000 00000000 ................ 18a870 54686520 45474f20 706c7567 696e0000 The CGO plugin.. 18a880 00000000 00000000 0c000000 00000000 ................ <etc> Unfortunately, it seems impossible to torture clang / gcc into producing anything like this. This patch fabricates a plausible vlib_plugin_registration_t from the so-called vlib_plugin_r2_t. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I8c0c5a24f3b7bfea07d5181a7250b3d9685e8446
2020-10-14vlib: avoid clipping in show errorFlorin Coras1-4/+4
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ia884d745a11565918c7bf89435ceb0e17b6aef59
2020-10-13stats: counters data modelOle Troan5-27/+76
This adds a new data model for counters. Specifying the errors severity and unit. A later patch will update vpp_get_stats to take advantage of this. Only the map plugin is updates as an example. New .api language: A new "counters" keyword to define counter sets. counters map { none { severity info; type counter64; units "packets"; description "valid MAP packets"; }; bad_protocol { severity error; type counter64; units "packets"; description "bad protocol"; }; }; Each counter has 4 keywords. severity, which is one of error, info or warn. A type, which is one of counter64 or gauge64. units, which is a text field using units from YANG. paths { "/err/ip4-map" "map"; "/err/ip6-map" "map"; "/err/ip4-t-map" "map"; "/err/ip6-t-map" "map"; }; A new paths keyword that maps the counter-set to a path in the stats segment KV store. Updated VPP CLI to include severity so user can see error counter severity. DBGvpp# show errors Count Node Reason Severity 13 ethernet-input no error error Type: feature Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Ib2177543f49d4c3aef4d7fa72476cff2068f7771 Signed-off-by: Ole Troan <ot@cisco.com>
2020-10-09vlib: save signal handler data to global vblsDave Barach1-4/+4
Turns out that clang is a bit too enthusiastic about mapping static variables to registers, which makes it hard to extract (especially) the faulting VA from an optimized core file. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I836e5d9695aeb4c5ee4a27f9565acf08ee4eaac0
2020-10-08pci: add vlib_pci_get_msix_file_indexDamjan Marion2-0/+13
Type: improvement Change-Id: Ibc15aa6f75e989b2b7caa9a57e3665b1ffc7cc18 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-06vppinfra: add heap header in front of dlmalloc spaceDamjan Marion2-12/+1
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 Barach4-1/+21
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-06feature: Add packet trace APIJon Loeliger2-37/+90
Also spiffed up the vpp_api_test plugin loader so it executes VLIB_INIT_FUNCTIONs and VLIB_API_INIT_FUNCTIONs. Type: feature Change-Id: Id9a4f455d73738c41bcfea220df2112bb9679681 Signed-off-by: Jon Loeliger <jdl@netgate.com> Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
2020-10-02vlib: always replace bootstrap vlib_mainsDave Barach1-8/+7
Fixes an obscure issue when spinning up pure pthreads which don't have vlib_main_t clones. VLIB_REGISTER_THREAD () = { <snip> .use_pthreads = 1, .no_data_structure_clone = 1, } Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ifae5a2a35865de057eea7782ee71b1011a21c88e
2020-10-02vppinfra: use clib_mem_create_heap() to create numa heap(s)Damjan Marion1-2/+5
Type: improvement Change-Id: Ie04302c576869bc7bfaa9f13ed2ea8a403a393d4 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-01vlib: fix line-mode cli memory leakBenoît Ganne1-0/+1
Type: fix Change-Id: Iaf60ec93ee9750074f52ba4dbe955355de5dbccc Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-09-28vppinfra: don't call dlmalloc API directly from the codeDamjan Marion2-23/+20
- it is confusing from end consumer perspective that some thing is somewhere called heap and somewhere mspace - this is base for additional work where heap pointer is not the same thing like mspace Type: improvement Change-Id: I644d5a0de17690d65d164d8cec3c5654571629ef Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-24vlib: fix the last errorMohsin Kazmi1-1/+2
Type: fix Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I788678d85dfa1d5b99497013806047440028eb97
2020-09-18vlib: add decrement counter methodSergey Matov1-0/+19
Currently there is no way to decrease simple counter. To extend counters API new method allows to decrement counter by given value. This might be useful in implementation of statistics stored in stats segment. Type: improvement Change-Id: I7c08c62bffa6a2d50e9e2cf884f7b2d48538f34b Signed-off-by: Sergey Matov <sergey.matov@travelping.com> Signed-off-by: Dave Barach <dave@barachs.net>
2020-09-17vlib: show FD in 'show memory map'Damjan Marion1-4/+11
Type: improvement Change-Id: I04752c011e4ca58f56aa53f6ae27bae93a5c4590 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-17vlib: map thread stack instead of allocating them from heapDamjan Marion2-30/+18
Heap may use different page sizes so we will not be able to create stack protection page. Type: improvement Change-Id: Ibb35c9f0a151c464ee0167d17f2bd773ef6f530b Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-17vppinfra: support main heap with different page sizesDamjan Marion2-6/+47
Type: improvement Change-Id: I381fc3dec8580208d0e24637d791af69011aa83b Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-17vppinfra: allow handoff to main threadDamjan Marion1-18/+16
Type: improvement Change-Id: If2e907967c9b75997b581ff0c058bd5c15e823f5 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-16vppinfra: introduce clib_mem_mainDamjan Marion2-14/+17
To hold more data later... Type: improvement Change-Id: I4006d22dcacd788988c4907f2c263fd4e4a9d398 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-11avf: add assert to ensure that adminq is used only from avf processDamjan Marion1-0/+7
Type: improvement Change-Id: Ib64c9b8207776986656e5a26c13a221edc6cc950 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-11vlib: fix call to vlib_get_node_by_nameBenoît Ganne1-1/+4
Type: fix Change-Id: I1b4f52e186165b04db5bd5f11058dc77b647bc94 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-09-09vlib: support interrupt re-arm from nodev21.01-rc0Damjan Marion1-10/+21
Type: improvement Change-Id: I13517bff4129497644e0efc3495d0ee7897fe5a7 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-05vlib: vlib_get_node_by_name fails via APINathan Skrzypczak1-2/+1
Type: fix Calling vlib_get_node_by_name via the VPE api doesn't work due to hash weirdness. Haven't gotten around the real cause of this. But this fixes it. Change-Id: I89f95dba2bcd9573b8f1f435e063e9dd57f9ca93 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2020-09-04buffers: improve cache occupancyDamjan Marion1-2/+8
Adjust buffer allocation so it always have odd number of cache lines. That should result in better distribution of cachelines among cache sets. Type: improvement Change-Id: I0d39d4cf01cff36ad6f70a700730823a96448c22 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-03vlib: exit 0 (nocore) on SIGHUPChristian Hopps1-2/+2
Scenarios where SIGHUP is sent would include the user closing an xterm while in interactive/nodaemon mode, or similarly when running vpp in the same mode during testing (e.g., using ssh to run VPP on a DUT). VPP should exit in these cases; however, generating a core is unwanted. Type: fix Signed-off-by: Christian Hopps <chopps@labn.net> Change-Id: Ibccfe5e676547e913c8a205ff16ab56d9abb1c82
2020-09-02fib: IPv6 lookup data structure MP safe when prefixes changeNeale Ranns3-1/+53
Type: fix adding routes should be MP safe. When new prefixes with differrent prefix lengths are added, adjust the sorted list in an MP safe way. Change-Id: Ib73a3c84d01eb86d17f8e79ea2bd2505dd9afb3d Signed-off-by: Neale Ranns <nranns@cisco.com>
2020-08-31vlib: extend telnet protocol guardVladimir Isaev1-1/+1
There is a number of TERMs with big length, such as 'screen.konsole-256color' (23). These TERMs can not be processed properly by vpp because maximum telnet byte stream supported is 24 and we need 6 more service bytes to send TTYPE. So I extended maximum depth guard to 32. Type: fix Signed-off-by: Vladimir Isaev <visaev@netgate.com> Change-Id: I9ca506996a97e9567d06483c5f020d6cc394329c
2020-08-31vppinfra: convert A_extend_to_B to B_from_A format of vector inlinesDamjan Marion1-6/+6
Make it shorter and same format when converting to biggor or smaller types. Type: refactor Change-Id: I443d67e18ae65d779b4d9a0dce5406f7d9f0e4ac Signed-off-by: Damjan Marion <damarion@cisco.com>
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