summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
AgeCommit message (Collapse)AuthorFilesLines
2020-09-01vppinfra: Fix bihash coverity warningNathan Skrzypczak1-2/+2
Type: fix Hitting a code not reachable when setting BIHASH_KVP_AT_BUCKET_LEVEL = 1 Change-Id: I24d539df67ae7650a3b1969f5709a6f7366d786b Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2020-08-31vppinfra: convert A_extend_to_B to B_from_A format of vector inlinesDamjan Marion3-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-28vppinfra: add clib_mem_destroy_mspace(void *ms)Dave Barach2-0/+19
Also clib_mem_destroy() to destroy the current mspace. Handy when an application wants to make a memory allocation arena disappear. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I020db902fbe2473545506fecbc230c2b048992f8
2020-08-27vppinfra: Multiarch support for OCTEONTX2 SoCNitin Saxena1-4/+16
Type: feature - Added multiarch support for Marvell OCTEONTX2 - Corrected Marvell THUNDERX2 spelling Signed-off-by: Nitin Saxena <nsaxena@marvell.com> Change-Id: I42d3654aeda89759a2db9d695592ee3227b26c2b
2020-08-26vppinfra: elog multi-track g2 test patternDave Barach1-0/+64
Type: test Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ia4504629cb5e87067a337d16f43e044399b87cac
2020-08-21vppinfra: add format_one_elog_eventDave Barach2-0/+10
To avoid ridiculous pointer gymnastics in golang Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ic5a641c18281970e2b9bc3013a54cfc3ae92e372
2020-08-19vppinfra: minor tweaks for cgo interoperationDave Barach5-13/+67
'type' is a keyword in golang, so s/type/event_type/ in elog.h and elsewhere. Add vec_len_not_inline(...), elog_write_file_not_inline(...) and elog_read_file_not_inline(...) since the inline forms aren't usable. More such tweaks may follow. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I9a80a6afa635f5cdedee554ee9abe400fafc1cb6
2020-08-17vppinfra: fix RC in bihash instantiationNathan Skrzypczak2-5/+5
There can be a race condition in the case a thread tries to do a bihash_search while another instantiates the bihash. Type: fix Change-Id: Ic61b590763beb409e112957c43a5a66cd10afb28 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2020-08-06vppinfra: harmonize function namesDave Barach3-16/+16
Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Icce7eab4510785e15bdcf97e4d1881b0f46f6899
2020-08-06misc: harmonize namesDave Barach1-5/+5
Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ibad744788e200ce012ad88ff59c2c34920742454
2020-08-03vppinfra: fix clib_count_equal_u8/16/32/64 overflowBenoît Ganne1-47/+30
Type: fix Change-Id: Id5ca868cd7a2abc9320206f0336aa3348f5906e3 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-07-23vppinfra: add *_zero() vector inlinesDamjan Marion1-0/+9
Type: improvement Change-Id: Ia63d1d7de273967ab7725d83634c0b6dd481c6c0 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-07-16misc: add callback hooks and refactor pmcTom Seidenberg3-4/+319
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-0/+12
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-16vppinfra: fix format_c_identifier vector overflowBenoît Ganne1-1/+1
In case of vector, we must check length before trying to access element. Also fix wrong DPDK plugin workaround. Type: fix Change-Id: I2ecef1c88ebef2362f48cab0d462699aa43cd4b9 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-07-16vppinfra: enable STATIC_ASSERT with clangBenoît Ganne2-6/+3
For some reason clang does not support &((struct foo*)0)->field in static assertion contrary to gcc. Use offsetof() macro implementation provided by both compilers instead. Type: fix Change-Id: I3311cdd29c5861e45dc0ef92f2bbd66242ca73b8 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-07-15vppinfra: more vector inlinesDamjan Marion3-0/+60
Type: improvement Change-Id: Ie0de374b89ec3a17befecf3f08e94951597609ec Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-07-01vlib: wake up workers if interrupts are postedBenoît Ganne1-1/+1
Type: fix Change-Id: If8dbbcb46193fd057fe8d704058609a3a8787d6c Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-06-30tcp: avoid rcv wnd more than RX fifo can enqueueRyujiro Shibuya1-0/+6
Type: fix Signed-off-by: Ryujiro Shibuya <ryujiro.shibuya@owmobility.com> Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ie358b731f8ecb1fcaebd6e79f5ce5c10802c2814
2020-06-25misc: add gdb macrosDave Barach1-2/+3
These gdb macros should prove very helpul when poking around in core files. Pifi (pool_is_free_index) is not straighforward. Best to work it out once. Others: bitmap_get = clib_bitmap_get vl = vec_len pe = pool_elts node_name_from_index, as described vnet_buffer_opaque, prints the primary buffer opaque vnet_buffer_opaque2, prints the secondary buffer opaque Fix vppinfra unit-test compile error Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Id2a2391a47e5a07cf3757f473e3805cc04784161
2020-06-23vppinfra: fix u32x4_gather definitionDamjan Marion1-1/+1
Type: fix Change-Id: I3df8d3f277bfadee95bfc329e8ce8b929a986af6 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-06-23vlib: debug CLI macro expander, part deuxDave Barach2-4/+14
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 Barach3-33/+92
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/+57
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-05-27vppinfra: fix SIGBUS in bihash init when running unpriviledged, take twoDamjan Marion1-1/+1
Looks like MAP_LOCK is not enough, so call mlock(...) instead.... Type: fix Change-Id: I1bc668a2bf3c861ca1c2d376c0fb6bfea87d4f48 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-24vppinfra: fix SIGBUS in bihash init when running unpriviledgedDamjan Marion1-1/+1
Obserbed when VPP is running in k8s container. Type: fix Change-Id: Ibbff9c3921bd7f4f97d47cb6f10eed8ed5efe269 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-22vppinfra: remove includeDamjan Marion1-1/+0
Type: refactor Change-Id: Iea83e0ea8a6e13f3c9ece1a13f891c1fa0956711 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-21vlib: enforce buffer alloc return value checkDamjan Marion1-0/+1
Type: improvement Change-Id: I33cd702f9c4d995520509fdb16e3b8f8fd50e535 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-19vppinfra: refactor mpcap.hDave Barach1-88/+4
vppinfra source files MUST NOT #include <vlib/vlib.h>, <vnet/vnet.h> or similar. Move mpcap_add_packet(...), mpcap_add_buffer(...) to a new file: src/vnet/mpcap.h. Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Id517aef6fe49b618f853ce32940b91ba45a1e60d
2020-05-18vppinfra: OpenPOWER ELF V2 ABI version of clib_{longjmp,setjmp,calljmp}Damjan Marion1-47/+93
Type: improvement Change-Id: Iea8e08dc18b72334f69af77c2753e900be6b97fb Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-16vppinfra: use byte swap builtinsDamjan Marion1-41/+3
Type: improvement Change-Id: I438206513b3cc3dedc0241b43c4ce037afa83e2b Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-15vppinfra: remove trailing whitespace in longjmp.SDamjan Marion1-110/+110
Type: refactor Change-Id: I2acbd864186c1d7694701c047ba72f58750a8558 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-05-15misc: removed executable bits from source filesRay Kinsella1-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-08vppinfra: set explicit found in search_free_list loopSteven Luong1-2/+6
While https://gerrit.fd.io/r/c/vpp/+/26948 fixed avoid using -1 to index into h->free_lists[b][l] by changing the loop counter, the check for the value of the loop counter (l < 0) cannot be trusted to decide whether we've found a large enough object within the bin or not. When the loop is terminated, the value of the variable l could be ambiguous if it equals to 0 and it is never less than 0, ie, when we bail out of the loop, we don't know if it was due to the breaking out of the condition in if ((s = f_size - size) >= 0) break; or while (l > 0); The fix is to explicitly set a variable when we have found a large enough object inside the loop to be used to test whether the loop was prematurely terminated (found == 1) or the loop just ran exhausted (found == 0) Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I0161813fbd44dcba8982a767eac2e0930e9d77e3
2020-05-08vppinfra: fix u32x4_byte_swap on ArmLijian.Zhang1-1/+1
Fix the endianness conversion function u32x4_byte_swap() on Arm. Here's an example of using this function with and without the fix. This issue is seen using Mellanox NIC RDMA driver on Arm servers. The packet length cannot be parsed correctly. Testing code: u32x4 s = {0x12345678, 0x23456789, 0x3456789a, 0x456789ab}; u32x4 ss = u32x4_byte_swap (s); Without the code change: (gdb) p /x s $1 = {0x12345678, 0x23456789, 0x3456789a, 0x456789ab} (gdb) p /x ss $2 = {0x23456789, 0x12345678, 0x456789ab, 0x3456789a} With the code change: (gdb) p /x s $3 = {0x12345678, 0x23456789, 0x3456789a, 0x456789ab} (gdb) p /x ss $4 = {0x78563412, 0x89674523, 0x9a785634, 0xab896745} Type: fix Change-Id: Ie5f263e94331783940e7c00397092a64e4fc4279 Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com> Reviewed-by: Jieqiang Wang <Jieqiang.Wang@arm.com> Reviewed-by: Govindarajan Mohandoss <Govindarajan.Mohandoss@arm.com>
2020-05-07vppinfra: loop counter off by 1 in search_free_list()Steven Luong1-1/+1
In search_free_list(), we have this do while loop. do { l--; f_index = h->free_lists[b][l]; f = elt_at (h, f_index); f_size = heap_elt_size (v, f); if ((s = f_size - size) >= 0) break; } while (l >= 0); When (l == 0), we still go back up to execute l--. Then l become -1. The next statement is we index h->free_lists[b][-1]. After that, elt_at() would probably cause a crash in the ASSERT. Type: fix Ticket: VPPSUPP-63 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I617d122aa221cfdfe38f8be50f4e0f0e76e11bb5
2020-05-07rdma: fix alignment issueDamjan Marion1-0/+3
Type: fix Change-Id: I0ff7a6f3354066c2252c1ebd0d43ac59db278bf0 Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Elias Rudberg <elias.rudberg@bahnhof.net>
2020-05-06docs: clean up make docs jobPaul Vinciguerra1-1/+2
Type: docs Change-Id: I9b5e5137eb4c1e89f6e8d7a278cd11a0fd496471 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-04-30build: rework x86 CPU variantsDamjan Marion3-6/+20
Type: improvement Change-Id: Ief243f88e654e578ef9b8060fcf535b364aececb Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-04-30build: support arch-specific compiling for Neoverse N1Lijian.Zhang1-0/+11
Enable arch-specific compiling and dynamic optimal function selection for Arm Neoverse-N1. Support for -march=armv8.2-a+crc+crypto -mtune=neoverse-n1 for Neoverse-N1 is added starting from gcc-9.2.0 without change with change improvement [L2 - 1x flows] 11.00 Mpps 11.46 Mpps 4% [L2 - 10Kx flows] 6.83 Mpps 7.17 Mpps 5% [L3 - 1x flows] 10.39 Mpps 10.78 Mpps 3.7% [L3 - 10Kx flows] 6.67 Mpps 7.19 Mpps 7.8% Type: feature Change-Id: I5d24d17820b3dd6909b913202e8c31fc7d48650f Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com> Reviewed-by: Jieqiang Wang <Jieqiang.Wang@arm.com> Reviewed-by: Govindarajan Mohandoss <Govindarajan.Mohandoss@arm.com>
2020-04-28vppinfra: type prove vec_new and vec_resizeAndreas Schultz1-6/+10
Some vector functions (e.g. vec_new) pass the vector pointer through vec_resize. This turn the pointer from a real type into a void pointer. Explicitly cast the pointer back to its original type to catch type mismatches. Type: improvement Signed-off-by: Andreas Schultz <andreas.schultz@travelping.com> Change-Id: Id13e52d4f038af2cee28e5abf1aca720f8909378
2020-04-28vppinfra: improve test coverageDave Barach1-1/+1
Bonus corner-case bugfix in bitmap.h, found during the exercise. Issue dates from 2001 or thereabouts. Please review this specific change carefully. lcov_post: filter system include directories and generated files in build-root Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Iaa0b63e9dc571dfe3d992197ac49ba4d93403c61
2020-04-27vppinfra: selectively disable false-positive GCC-10 warningsBenoît Ganne3-0/+24
GCC-10 increase overflows-related warnings but is confused by SIMD operations. Type: fix Change-Id: Iafde754c2fbec60e2d0a328f295b1f5c156d8234 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-04-27vppinfra: selectively disable false-positive GCC-10 warningsBenoît Ganne1-0/+9
GCC-10 increase overflows-related warnings but failed to infer that b->n_cached_bytes is always < sizeof(uword). Type: fix Change-Id: I956ae609abc9e39d4a932e5801510999d7d27b79 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-04-27build: add vppinfra/warnings.h to exported headers listBenoît Ganne1-0/+1
To allow the use of WARN_ON/OFF macros to selectively disable build warnings. Type: fix Change-Id: Iceb9d28b2b80c373afb51900880c23041be836db Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-04-24vppinfra: finish deprecating qsort.cDave Barach2-272/+7
Minor change to vec_sort_with_function(...): don't depend on the qsort implementation to deal with null, zero-long, or 1-long vectors Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I7bd7b0421673d2a025363089562aa7c6266fba66
2020-04-23nat: add/del ed_ext_ports only if the table is instantiatedDave Barach1-0/+3
Add a suitable ASSERT in the bihash template in case this happens again. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ib370d4238f6bae2995bc30fd17fad5c41053c3d1
2020-04-23vppinfra: more bihash optimizatonsDamjan Marion3-66/+67
* Avoid doing expensive bit extraction for most likely case where bucket .log2_page_size == 0 and .linear_search == 0, saves 3-5 cycles for lookup, data_prefetch and add operation * use bextr instruction when available (x86 BMI instruction set) Type: improvement Change-Id: I163df36a29287482c5f133be8b21d62a2f7440de Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-04-22vppinfra: move unused code to extras/deprecated/vppinfraDave Barach37-12383/+1
Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Id28299a188feefa1899d835fd499f018af95d81b
2020-04-22misc: fix coverity warningsDave Barach1-1/+1
Type: fix Ticket: VPP-1837 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I9ec87d2293d8f92c3e488a0f61083cf815ac496c