aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
AgeCommit message (Collapse)AuthorFilesLines
2021-01-25vlib: startup multi-arch variant configuration fix for interfacesRadu Nicolau1-4/+18
Propagate the multi-arch variant selection to interfaces. Type: fix Signed-off-by: Radu Nicolau <radu.nicolau@intel.com> Change-Id: I99c4a7896f172f0d14d2ded22a27383825529a7d (cherry picked from commit 5a48b3b9d88fa2793793e2bf3db8bf156fe2951f)
2020-12-15classify: add pcap/trace classfier mgmt API callsJon Loeliger4-10/+11
Add lookup/get/set API calls to manage both PCAP and Trace filtering Classifier tables. The "lookup" call may be used to identify a Classifier table within a chain of tables taht matches a particular mask vector. For efficiency, this call should be used to determine to which table a match vector should be added. The "get" calls return the first table within a chain (either a PCAP or the Trace) set of tables. The "set" call may be used to add a new table to one such chain. If the "sort_masks" flag is set, the tables within the chain are ordered such that the most-specific mask is first, and the least-specific mask is last. A call that "sets" a chain to ~0 will delete and free all the tables with a chain. The PCAP filters are per-interface, with "local0", (that is, sw_if_index == 0) holding the system-wide PCAP filter. The Classifier used a reference-counted "set" for each PCAP or trace filter that it stored. The ref counts were not used, and the vector of tables was only used temporarily to establish a sorted order for tables based on masks. None of that complexity was actually warranted, and where it was used, the same could be achieved more simply. Type: refactor Signed-off-by: Jon Loeliger <jdl@netgate.com> Change-Id: Icc56116cca91b91c631ca0628e814fb53f3677d2
2020-12-14misc: refactor clib_bitmap_foreach macroDamjan Marion6-20/+20
Type: refactor Change-Id: I077110e1a422722e20aa546a6f3224c06ab0cde5 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-14misc: move to new pool_foreach macrosDamjan Marion4-15/+15
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-12-06vlib: vlib_log for "linux device up" warningsDave Barach1-3/+4
Make it easy to figure out why vpp didn't bind a particular hardware interface in the most common case: the Linux interface is up. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I99534dd91e0030601c09171a9fbc9ad45af6bf08
2020-11-26vlib: fix vlib log elog vector overrunBenoît Ganne1-1/+1
vlib log strings are vectors not necessarily null-terminated C-string. Type: fix Fixes: bc867c3d2137dab4b1395196c1936233517980ab Change-Id: Ia805ecdf4e76ccb1001dc93647161ee1c3adebc9 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-11-26vlib: clean up event-logger CLIDave Barach1-12/+12
Change "elog trace" to "event-logger trace"; corresponding change in test/test_vlib.py, verified that the vlib test vectors still pass even though they're not run on a regular basis ("make GCOV_TESTS=yes TEST=test_vlib ...") Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Idee4aa036573865e071a9bab87e27fb5d53b4933
2020-11-25vlib: add elog events for vlib log entriesDave Barach5-10/+51
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-25pci: add PCIe Gen4 link speedDamjan Marion1-2/+4
Type: improvement Change-Id: Iccf4fabe912ab7ac45b6fc082824a67d4fd9f216 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-11-24buffers: add page-size configNathan Skrzypczak2-41/+64
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-23vlib: Fix sh int addrNathan Skrzypczak1-0/+5
format_l2_input might return s=0 which causes vlib_cli_output to print weird things when calling sh int addr Type: fix Change-Id: I3fe747979355e41aed51656f3b44e0eb76d33ef9 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2020-11-23vlib: add format_vlib_thread_nameDamjan Marion2-0/+27
Type: improvement Change-Id: I2231f8e32964868ff6ef154b8ef431d99643c6a5 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-11-16tests: move cli tests to src/vlib/testDave Wallace1-0/+89
- 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: Ic27fb8c476cfd95879dec645c3c0cd6db341ee00
2020-11-16tests: move buffer tests to src/vlib/testDave Wallace1-0/+29
- 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: Id3f856d9c8de1695edd5b968b8acfa2b382a0139
2020-11-13vlib: macro definition erroryult1-6/+6
in 'VLIB_DECLARE_INIT_FUNCTION(x, tag)' '_vlib_init_function_##tag_##x' should be '_vlib_init_function_##tag##_##x' Type: fix Signed-off-by: yult <oopsadm@gmail.com> Change-Id: I091c8aa6091fe6e314e50fa00201d035869a1d96
2020-11-13vlib: vlib_buffer_t should be always 128 bytes, not 2 cachelinesDamjan Marion1-4/+8
Fixes issues on systems with 128-byte cacheline. Type: fix Change-Id: I33689ffa5ef0a879b4bf93c25d48618dd43daf58 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-11-10ip6-nd: fix memory leaksDave Barach1-0/+1
Quite a noticeable amount of memory. Recoded ra event tx and rx fns in the usual manner, which terminated the leaks. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I486d348456b465ad3940a280d4cf489e8dd655a5
2020-11-09vlib: support macros in initial config fileDave Barach1-15/+59
Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: If8a19eb6688755311a3430437331ddf13c7e28c8
2020-11-09vlib: fix trace number accountingBenoît Ganne2-10/+20
When using classifier to filter traces, not all packets will be traced. In that case, we should only count traced packets. Type: fix Change-Id: I87d1e217b580ebff8c6ade7860eb43950420ae78 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-11-04vlib: add postmortem pcap dispatch traceDave Barach5-14/+92
Inspired by a real-life conundrum: scenario X involves a vpp crash in ip4-load-balance because vnet_buffer(b)->ip.adj_index[VLIB_TX] is (still) set to ~0. The problem takes most of a day to occur, and we need to see the broken packet's graph trajectory, metadata, etc. to understand the problem. Fix a signed/unsigned ASSERT bug in vlib_get_trace_count(). Rename elog_post_mortem_dump() -> vlib_post_mortem_dump(), add dispatch trace post-mortem dump. Add FILTER_FLAG_POST_MORTEM so we can (putatively) capture a ludicrous number of buffer traces, without actually using more than one dispatch cycle's worth of memory. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: If093202ef071df46e290370bd9b33bf6560d30e6
2020-10-26vlib: add VLIB_REGISTER_LOG_CLASS macroDamjan Marion2-38/+84
Type: improvement Change-Id: Iafcaeb88fa3569e042fb9cb270cf062b145416e2 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-23vlib: log: fix non-null terminated stringsjiangxiaoming1-0/+1
Type: fix Signed-off-by: jiangxiaoming <jiangxiaoming@outlook.com> Change-Id: Id61966048875ca56a416caa520125c8c2366bf7b
2020-10-22pci: set PCI memory enable before mapping PCI BARMohammed Hawari1-0/+12
This change mitigates software faults issued by some versions of the linux kernel vfio-pci driver when VF PCI BARs are used without setting the memory enable bit in the PCI configuration. This problem is mentionned in https://lkml.org/lkml/2020/6/25/628 Change-Id: Idc177be4a5adb6ee467b4dd8f055f133ff267fe1 Type: improvement Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
2020-10-21vlib: per-class logging configuration in startup.confDamjan Marion2-3/+97
logging { class avf { rate-limit 200 level debug syslog-level debug } class dpdk/cryptodev { rate-limit 200 level disabled syslog-level disabled } } Type: improvement Change-Id: Iebe49b3ed4dfbfd589e80fcd2f9a63a8fe66b83b Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-10-21vlib: print logs to stderr if interactive or nosyslog setDamjan Marion5-51/+115
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-20stats: crash when adding/deleting interfacesOle Troan1-4/+3
create tap delete tap tap0 create loopback interface delete loopback interface intfc loop0 create tap <- here I hit a segmentation fault Type: fix Fixes: 148c7b768721231325a349fa82db693190513b53 Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: If270cc57610e2ded7422e7030d8c1f9fadd4d233
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>