summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
AgeCommit message (Collapse)AuthorFilesLines
2017-07-12vppinfra: revert clib_memcpy optimizationDamjan Marion2-10/+14
Looks like some compiler versions are producing wrong code when we are copying 9-16 bytes so reverting back to the original code. Change-Id: I74b5fa54a3b01f6288648f1cb0926030edd3b26f Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-07-10VPP-904: fixes zero length CLI parameters parseAlexander Kotov1-2/+3
Change-Id: I21fbc9aff2b97a8b3f4cbed202c00b6d84557a6e Signed-off-by: Alexander Kotov <kot@yandex.ru> (cherry picked from commit 28160f38488743b8cee0a7bd62b432a9dd8f4bfd)
2017-07-09format: Check for NaN when rendering doublesChris Luke2-1/+14
- The result of 0.0/0.0 was being rendered as a lot of zeroes in the integer portion, as in this example: DBGvpp# show physmem 0: 16 objects, 576k of 582k used, 3k free, 0 reclaimed, 2k overhead, 16380k capacity alloc. from small object cache: 0 hits 0 attempts (0.00%) replacements 0 alloc. from free-list: 0 attempts, 0 hits (0.00%), 0 considered (per-attempt 0.00) alloc. from vector-expand: 16 allocs: 16 73643.06 clocks/call frees: 0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00 clocks/call - Add two macros to vppinfra/math.h that use compiler builtins to check for NaN and Infinity and then use them in format_float(). Change-Id: Iccc03997e6e33d6b888d1e7e20cd78df0cfd02e8 Signed-off-by: Chris Luke <chrisy@flirble.org> (cherry picked from commit bb18ee6f1c7c172d30cb0c98153499af571777ee)
2017-07-04Refactor API message handling codeKlement Sekera2-13/+36
This is preparation for new C API. Moving common stuff to separate headers reduces dependency issues. Change-Id: Ie7adb23398de72448e5eba6c1c1da4e1bc678725 Signed-off-by: Klement Sekera <ksekera@cisco.com> (cherry picked from commit 58eb866b15a45514dc356170f28640d6c9db8034)
2017-06-30VPP-893: handle multiple simultaneous event registrationsDave Barach2-1/+7
Change-Id: I8cd90820624987dbef848935e2de86fa66a86c17 Signed-off-by: Dave Barach <dave@barachs.net>
2017-06-21Add option to create clib_socket with group write permissionsDamjan Marion2-0/+10
Also allow group write as default for CLI socket connections. Change-Id: I6af1f277f70581358cd9241bf0f5cb0752fe250f Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-06-21Add knob to specify effective group id (gid) for VPP processDamjan Marion2-0/+29
Change-Id: Icf9bd4abda058fb380f1a25d5fe3917ffb38b1c4 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-06-20Parenthesize the usage of the macro argument within vec_search() macro ↵Andrew Yourtchenko1-1/+1
definition Change-Id: I488d7c2b864c0e3661c8abf0363e4b97984d4974 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2017-06-14VPP-874: fix coverity warnings in tw_timer_template.cDave Barach1-4/+4
Best guess, tested carefully, should do no harm. Clang doesn't complain either way; it's not certain that this patch will make the coverity warnings in tw_timer_template.c disappear. Change-Id: I75aa0cfd8970751e823a1165df2a755e947c4cf9 Signed-off-by: Dave Barach <dave@barachs.net>
2017-06-12three-level timer wheel implementation w/ overflow vectorDave Barach12-77/+1325
prep work for s/timing_wheel/tw_timer/ in the vlib process model Change-Id: I763f4968a8fce1764a3778b12def0afbd30086b1 Signed-off-by: Dave Barach <dave@barachs.net>
2017-06-12Fix build breakge post 6956Neale Ranns1-0/+2
Change-Id: I0ab0e3e40b00ed5c2a34f5c23d04b596c1e9aa5f Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-06-12Remove calls to crc_u32 and add clib_crc32c for armv8+crcChristophe Fontaine4-63/+35
crc_u32 was not defined for non x86_64 with SSE4.2 processors. Calls to "crc_u32" are removed and replaced by either a call to clib_crc32c or a call to clib_xxhash, as the result is not used as a check value but as a hash. Change-Id: I3af4d68e2e5ebd0c9b0a6090f848d043cb0f20a2 Signed-off-by: Christophe Fontaine <christophe.fontaine@enea.com>
2017-06-05vppinfra: fix vec_validate_init_empty_aligned macroDamjan Marion1-1/+1
Change-Id: Ieafd00c7d03fe5c090808c7af4aa2f86974a092e Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-06-05More GCC-7 errorsMarco Varlese1-0/+2
The Wmaybe-uninitialized is the new error included with Wall. This patch addresses the warning and fixes it. Change-Id: I8fdf9ff2d236c46b717024a14874fbbbad8af303 Signed-off-by: Marco Varlese <marco.varlese@suse.com>
2017-06-02Fix mac_age process crash in multi-threaded environmentSteve Shin1-2/+1
VPP crash is observed when MAC aging is enabled with multi-threaded mode. If a thread other-than-zero expands the working_copies vector, working_copy_lengths should be initialized with vec_validate_init_empty(..., -1) to fill -1 across lower-numbered working_copy_lengths vector element. Change-Id: I60959fc6511306b33acae323df9c6898fc6c50ce Signed-off-by: Steve Shin <jonshin@cisco.com>
2017-05-18VPP-847: improve bihash template memory allocator performanceDave Barach5-57/+111
Particularly in the DCLIB_VEC64=1 case, using vectors vs. raw clib_mem_alloc'ed memory causes abysmal memory allocator performance. Change-Id: I07a4dec0cd69ca357445385e2671cdf23c59b95d Signed-off-by: Dave Barach <dave@barachs.net>
2017-05-10completelly deprecate os_get_cpu_number, replace new occurencesDamjan Marion9-33/+44
Change-Id: I82c663bc0866c6c68ba354104b0bb059387f4b9d Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-05-10Add crc32c inline function, allows compilation on 32-bit systemsDamjan Marion3-10/+62
32-bit code still can use crc32c instructions, but it operates on 32 registers Change-Id: I9bb6b0b59635d6ea6a753584676ebcf59c8f6584 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-05-10vppinfra: optimize and simplify splat inline functionsDamjan Marion1-17/+11
Example for u32x4 case: Old code generates 2 instructions: vmovd %edi,%xmm0 vpunpckldq %xmm0,%xmm0,%xmm0 vpunpcklqdq %xmm0,%xmm0,%xmm0 New code uses only one instruction: mov %edi,-0x4(%rsp) vbroadcastss -0x4(%rsp),%xmm0 Change-Id: I989dc3025f5fe3f6c880972389ded11f31e2f3f6 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-05-09Fix remaining 32-bit compile issuesDamjan Marion1-1/+1
Change-Id: I9664214652229b663c3e3ba7406b4ede96bfb123 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-05-03Fix vnet unit testsFilip Tehlar1-4/+4
Change-Id: Ibe55e4399c6b78d83268d7c49ed498cab7bfdb43 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2017-04-25Define cache line size for x86 32-bitDamjan Marion1-1/+1
Change-Id: Ie70e805f342bda69207b9df9543f1eccb5e69612 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-04-21vppinfra: clib_memcpy improvementRay Kinsella2-10/+0
In the case where n is a constant 16 bytes, the second load/store is ignored by the load/store unit - it has neglible/zero cost. In the case where n is variable and greater than 512 bytes, the extra if (n == 16) branch has a very small performance impact. Change-Id: I04b313cf022c18fee31b1d9bcf6a128414659a99 Signed-off-by: Ray Kinsella <ray.kinsella@intel.com>
2017-04-01Clean up event log merge codeDave Barach3-70/+276
Fix a decade-old ridiculous qsort function bug. Managed to subtract floating-point numbers as if they were integers, leading to manufactured time-paradoxes. That completely confuses g2, leading to the summary disappearance of entire tracks' worth of data at high zoom levels. Add a manual alignment tweak parameter to elog_merge, users can dial-out time paradoxes caused by NTP-grade clock synchronization. The event-logger has a precision of O(100ns), whereas NTP synchronization is O(1ms). Change-Id: I69dedabaa314f69f9df74ec9ee66e21e6c87f703 Signed-off-by: Dave Barach <dave@barachs.net>
2017-03-30vppinfra: add spinlock inline functionsDamjan Marion1-0/+97
Change-Id: I86089e9bb604adfc260a111685001be1c897ce53 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-03-22Add memif - packet memory interface for intra-host communicationDamjan Marion1-0/+6
Change-Id: I94c06b07a39f07ceba87bf3e7fcfc70e43231e8a Signed-off-by: Damjan Marion <damarion@cisco.com> Co-Authored-By: Milan Lenco <Milan.Lenco@pantheon.tech>
2017-03-21armv8 - fix os_cpu_clock_frequency for armv8Gabriel Ganne1-0/+6
System timer of ARMv8 runs at a different frequency than the CPU's. The frequency is fixed, typically in the range 1-50MHz. It can be read at CNTFRQ special register. Change-Id: I6a21a6a9e2df783559df0caec63d5525c2258227 Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>
2017-03-04timing wheel: avoid queueing expired timers and caching wrong earliest ↵Andrew Yourtchenko1-2/+11
expiry value This commit addresses two issues: 1) Avoid refilling the timing wheel with stale timers in rare circumstances. The timing_wheel_advance() may call advance_cpu_time_base() to update the cpu_time_base, which is used as a starting point for 32-bit offsets of events on the timer wheel. If the timing_wheel_advance() is not called for a longer period of time, then advance_cpu_time_base() is called multiple times in a loop. advance_cpu_time_base() has two parts - the first part adjusting the base for the existing event, and the second part trying to fill with the new events from the overflow queue, which now fit into the 32-bit-sized time window off the new cpu_time_base. In doing so this second part incorrectly considers the timers which have just expired (have the time index == w->current_time_index) to still be unexpired and places them onto the wheel instead of returning them as expired. For quick successive executions of timing_wheel_advance() these events result in a relatively benign late expiry - the newly placed events expire during the next call to timing_wheel_advance(). If the successive executions of timing_wheel_advance() result in multiple invocations of advance_cpu_time_base(), the Nth iteration of it may place a stale event on the timer wheel if the event time index equals to the current time index (which has been previously purged), while the N+1th iteration of it will trigger an assert violation on this stale event, resulting in a reboot. As part of the testing, two test runs were done before and after the change. Each of the test runs consisted of the following command: for i in `seq 1 300`; do ./test_timing_wheel validate events 10000 synthetic-time verbose seed $i iter 10000 wait-time 2 max-time 300; done The test runs completed identically, however they uncovered the following assert failure: vpp/src/vppinfra/test_timing_wheel.c:225 (test_timing_wheel_main) assertion `min_next_time[0] <= tm->events[i]' fails This assert is the second issue covered by this commit: 2) Inserting a new element may result in incorrect cached expiry value The w->cached_min_cpu_time_on_wheel is being updated within timing_wheel_advance() every time the elements are expired. However, it is not touched if the new elements are inserted. Assuming current time is "T" and the cached min cpu time is "T+X", if a new element is being inserted whose expiry time is "T+Y", and Y is such that Y < X, then the value w->cached_min_cpu_time_on_wheel becomes incorrect until the next expiry event, during which it is updated. The test catches this transient condition which results in the asserts seen in the runs above. The solution is to update the w->cached_min_cpu_time_on_wheel within timing_wheel_insert_helper() as necessary. Change-Id: I56a65a9a11cc2a1e0b36937a9c6d5ad10233a731 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2017-03-03IPv6 RA improvementsNeale Ranns1-0/+26
1) tests for RA options 2) memleaks deleteing a ip6_radv_info_t 3) MLD prefix code refactoring Change-Id: I34db103994bd8fbdbbec50b202d72770dd145681 Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-03-01vppinfra: fix issue when copying 16 bytes with clib_memcpyDamjan Marion2-0/+10
Current code wos copying same data twice when length is 16. Change-Id: I8d935b32f61672aaea9789c097a5083ae8f78cdd Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-03-01VPP-598: tcp stack initial commitDave Barach4-0/+291
Change-Id: I49e5ce0aae6e4ff634024387ceaf7dbc432a0351 Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-02-24MFIB memory leak. free the per-source interface hashNeale Ranns1-5/+0
Change-Id: I0ccb337eb0ed50ccc64193533cd816f6e36e6db5 Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-02-22Fix last run time update for timer wheelFlorin Coras1-1/+1
Change-Id: I9ac04b15440297c154ed1e3fba888915044cb245 Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-02-16tw_timer_expire_timers() - add a maximum to the number of expiration per callGabriel Ganne2-3/+10
The idea is to prevent a huge processing burst if, say, the network goes down 10' for some reason, and so that we don't need to expire 1M timer sessions on the first call. The maximum is not an exact value, but a value after which the expiration process is postponed until the next call. That way, we don't have to process the same tick twice, nor to unlink timers once at a time when processing a tick. The fact that a timer slot could contain many entries should be dealt with by changing the number of ticks per second. Change-Id: I892d07f965094102a3d53e7dbf4e6f5ad22d4967 Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>
2017-02-16VPP-638: 'set interface ipsec key garbage' causes infinite loopBilly McFall1-0/+5
In the CLI parsing of 'set interface ipsec key garbage', the token 'garbage' enters the processing code for the <key>. This enters unformat_hex_string(..) which looks through the input for 0-9,a-f and drops out if a non-hex digit is encountered. The problem is that it returns 1, indicating that input has been processed, but in this case, no characters have been removed from the input string. This causes the calling function to go to the top of the loop and process the next token, which is now the same token and gets stuck in an infinite loop. Updated unformat_hex_string(..) to return 0 if no characters were processed. This funcitons is used in multiple CLI Commands, but most have token that preceeds the hex string. Since the token is stripped, the CLI command is able to avoid an infinte loop. Change-Id: Ib54f04f23c4d3563ec57a2450982d3648cedec0e Signed-off-by: Billy McFall <bmcfall@redhat.com>
2017-02-16tw_timer_expire_timers() return the number of expirationsGabriel Ganne2-9/+14
to be used for node statistics Also fix tw_timer_stop() description Change-Id: I84b529e330c4534fd55487e7e2b8b089ee68ca11 Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>
2017-02-06Add pool_get[_aligned]_will_expand(...)Dave Barach2-0/+67
Change-Id: Iefffcf7843dc11803d69a875a72704a2543911a1 Signed-off-by: Dave Barach <dave@barachs.net>
2017-02-05Wheel-timer infraDave Barach7-0/+1276
Change-Id: I5499dd6b768425a56936afae50bd578620c83d30 Signed-off-by: Dave Barach <dave@barachs.net>
2017-01-31Prep work for Coverity upload processing via JenkinsDave Barach1-0/+10
Change-Id: I2575d780d19e12ddf8a77e5596e5d7cc3dbf4233 Signed-off-by: Dave Barach <dave@barachs.net>
2017-01-27IP Multicast FIB (mfib)Neale Ranns4-15/+15
- IPv[46] mfib tables with support for (*,G/m), (*,G) and (S,G) exact and longest prefix match - Replication represented via a new replicate DPO. - RPF configuration and data-plane checking - data-plane signals sent to listening control planes. The functions of multicast forwarding entries differ from their unicast conterparts, so we introduce a new mfib_table_t and mfib_entry_t objects. However, we re-use the fib_path_list to resolve and build the entry's output list. the fib_path_list provides the service to construct a replicate DPO for multicast. 'make tests' is added to with two new suites; TEST=mfib, this is invocation of the CLI command 'test mfib' which deals with many path add/remove, flag set/unset scenarios, TEST=ip-mcast, data-plane forwarding tests. Updated applications to use the new MIFB functions; - IPv6 NS/RA. - DHCPv6 unit tests for these are undated accordingly. Change-Id: I49ec37b01f1b170335a5697541c8fd30e6d3a961 Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-01-18Fix coverity warnings, VPP-608Dave Barach1-5/+6
Change-Id: Ib0144ba3a9a09971d3946c932e8fed6d5c1ad278 Signed-off-by: Dave Barach <dave@barachs.net>
2017-01-02Handle execessive hash collisions, VPP-555Dave Barach4-84/+146
Change-Id: I55dad7b5cfb3d38c22b1105f7d2d61e7449410ea Signed-off-by: Dave Barach <dave@barachs.net>
2016-12-28Reorganize source tree to use single autotools instanceDamjan Marion154-0/+54547
Change-Id: I7b51f88292e057c6443b12224486f2d0c9f8ae23 Signed-off-by: Damjan Marion <damarion@cisco.com>