summaryrefslogtreecommitdiffstats
path: root/src/vppinfra
AgeCommit message (Collapse)AuthorFilesLines
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>