summaryrefslogtreecommitdiffstats
path: root/src/vlib
AgeCommit message (Collapse)AuthorFilesLines
2017-12-06Remove unused, uninteresting codeDave Barach3-1279/+0
Move elog_sample.c to src/examples/vlib Change-Id: I7d32c83c424b9ca4a057372c7fc6a6e2b7dab034 Signed-off-by: Dave Barach <dave@barachs.net>
2017-12-06fix bug in pagerNeale Ranns1-2/+3
the format statement can return NULL before the pager has pages. Change-Id: Ibabfd107e64fc9ab0eb142c28c155506f0d25828 Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-12-04vlib: switch when frames are differentEyal Bari1-10/+12
[ebari] no need to switch if next2, next3 are equal to next_index [dbarach] change fix_speculation calculaton to a branch-free xor/or tree Change-Id: I0131dc4499218363d5b0ce8f6440ce74e0b22bb9 Signed-off-by: Eyal Bari <ebari@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
2017-11-29Configure vat-plugin-path and vat-plugin-name-filterDave Barach2-1/+24
To facilitate in-tree plugin API testing, via the "binary-api..." debug CLI command. Change-Id: If7ee88a6a0dbc8e8f4555cb41e259db24e378a64 Signed-off-by: Dave Barach <dave@barachs.net>
2017-11-28net/virtio: support modern device idGabriel Ganne1-0/+7
Add legacy and modern macros to pci_config header. This follows dpdk commit: 4c7903658f6b5a8f4901224ef405445541b91e4a And PCI Device Conformance doc : docs.oasis-open.org/virtio/virtio/v1.0/cs02/virtio-v1.0-cs02.html#x1-640001 Change-Id: Iacd40ea8c06f220736ca0bc7ce68bcf1e55b68f6 Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>
2017-11-27vlib: make vlib_buffer_alloc inline functionDamjan Marion4-93/+72
Currently, every alloc involves callback function call. With this change callback function is called only if there is no empty buffers on the free list. Change-Id: I2238c19ece7ce182c49ba0f2485add52f335f3b6 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-11-18Call a plugin init function by nameDave Barach1-0/+26
Use this macro to arrange init function ordering between friend plugins. Fails in the usual manner if the plugin doesn't exist, or if the init function symbol is AWOL. clib_error_t * thisplug_init (vlib_main_t *vm) { clib_error_t *error = 0; if ((error = vlib_plugin_init_function ("otherplug.so", otherplug_init))) return error; <etc> return error; } VLIB_INIT_FUNCTION(thisplug_init); Change-Id: Ideecaf46bc0b1546e85096e54be8ddef87946565 Signed-off-by: Dave Barach <dave@barachs.net>
2017-11-13dpdk: introduce AVX512 variants of node functionsDamjan Marion1-9/+15
Change-Id: If581feca0d51d0420c971801aecdf9250c671b36 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-11-13Instead of a min term size, use a default (VPP-1061)Chris Luke1-16/+21
- In the bug report, Docker was sometimes giving shells a 0,0 terminal size. The minimum-term-size logic meant that VPP assumed the terminal had 1 row. The pager functioned, but of course overwrote the one line with its own prompt. - Instead of a minimum size, always use a default size when the either terminal dimension is 0. Change-Id: Iee5a465f0e4cbb618ef2222b40a52994aefa54bf Signed-off-by: Chris Luke <chrisy@flirble.org>
2017-11-09buffers: fix bug in free list n_alloc trackingKlement Sekera1-0/+1
This change avoids hitting ASSERT (vec_len (f->buffers) == f->n_alloc); in vlib_buffer_delete_free_list_internal by updating vlib_buffer_free_list_t->n_alloc in case when buffers are removed from the free list due to overfill. Change-Id: Id60fa97e8cb0f02ef529b05816265a57a4e7d998 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-10-31physmem: register region with IOMMUDamjan Marion1-0/+57
VFIO file descriptor is extracted in a hackish way, as DPDK doesn't provide imethod to retrieve it. This fixes issue with DPDK drivers not working correctly when IOMMU is enabled and external buffer memory is used. Change-Id: I5eaa8e78741c50504d87d44e706b5997c8189554 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-10-25vlib: add support for multiple buffer poolsDamjan Marion5-23/+42
Change-Id: Icaf7d7ad47284aea7a56e8006b69f45874d64202 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-10-24Add extern to *_main global variable declarations in header files.Dave Wallace1-1/+1
- Global variables declared in header files without the use of the 'extern' keword will result in multiple instances of the variable to be created by the compiler -- one for each different source file in which the the header file is included. This results in wasted memory allocated in the BSS segments as well as potentially introducing bugs in the application. Change-Id: I6ef1790b60a0bd9dd3994f8510723decf258b0cc Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2017-10-20Thread_index for thread0 in vlib_global_main not initialisedKeith Burns (alagalah)1-0/+1
Change-Id: Ie49ee865b197e8fe7bba170c115a4ccbf1013e5f Signed-off-by: Keith Burns (alagalah) <alagalah@gmail.com>
2017-10-19VPP-1024: rewrite buffer trajectory tracerDave Barach2-43/+25
Use a proper u16 * vector to capture node indices, since vpp w/ plugins now exceeds 255 graph nodes Change-Id: Ic48cad676fa3a6116413ddf08c083dd9660783f1 Signed-off-by: Dave Barach <dave@barachs.net>
2017-10-14VPP-1029: Don't call clib_longjmp(...) directly from the SIGTERM handlerDave Barach2-4/+8
It's way too easy to imagine leaving a mutex or a spin-lock held in the /vpe-api shared-memory segment, or elsewhere. Set a volatile variable and check it in a safe place... Change-Id: I9d91c38cffeb921143c272162d055c9c24a6c312 Signed-off-by: Dave Barach <dave@barachs.net>
2017-10-04[aarch64] Fixes CLI crashes on dpaa2 platform.Christophe Fontaine5-5/+5
- always use 'va_args' as pointer in all format_* functions - u32 for all 'indent' params as it's declaration was inconsistent Change-Id: Ic5799309a6b104c9b50fec309cba789c8da99e79 Signed-off-by: Christophe Fontaine <christophe.fontaine@enea.com>
2017-10-03Repair vlib API socket serverDave Barach2-2/+2
- Teach vpp_api_test to send/receive API messages over sockets - Add memfd-based shared memory - Add api messages to create memfd-based shared memory segments - vpp_api_test supports both socket and shared memory segment connections - vpp_api_test pivot from socket to shared memory API messaging - add socket client support to libvlibclient.so - dead client reaper sends ping messages, container-friendly - dead client reaper falls back to kill (<pid>, 0) live checking if e.g. a python app goes silent for tens of seconds - handle ping messages in python client support code - teach show api ring about pairwise shared-memory segments - fix ip probing of already resolved destinations (VPP-998) We'll need this work to implement proper host-stack client isolation Change-Id: Ic23b65f75c854d0393d9a2e9d6b122a9551be769 Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-09-26Add thread-safe event signaller, use RPC where requiredDave Barach3-2/+59
Update ping code to use the new function Change-Id: Ieb753b23f8402cbe5667c22747896784c8ece937 Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
2017-09-22Fix vpp "unix interactive" when running under emacs + gdbDave Barach1-3/+8
In this specific corner-case setup, ioctl (0, TIOCGWINSZ) returns window height = 0 and width = 0. Rather than declaring the terminal to be non-interactive, set the window size parameters to 80 x 24. Change-Id: If66f5f0883f1940518ec1c6e26228c9bb6f32852 Signed-off-by: Dave Barach <dave@barachs.net>
2017-09-21vppctl,cli: Improve non-interactive vppctl (VPP-944)Chris Luke1-51/+308
Short version: Make vppctl behave as expected when run from scripts, or without a controlling terminal, and especially when using it with VPP commands on its command line ("non-interactively"). In particular, prevent the welcome banner and VPP CLI prompt from being sent by VPP when being used in these ways. vppctl ------ - Improve vppctl's detection of non-interactive sessions. - Pass non-interactiveness in the terminal type telnet option as a value distinct from "dumb" (which means non-ANSI capable.) - Make tty setup handling more robust. - Only send non-interactive command once we've sent the terminal type, to ensure correct event sequence; we need the VPP cli session to be in line-by-line mode. - Ignore stdin when it looks something like /dev/null. - Skip NUL bytes received from VPP. VPP CLI ------- - Detect "non-interactive" terminal types and set session parameters accordingly. - Add an "interactive" flag that controls whether the welcome banner and CLI prompt are sent. - Detect if telnet options processing switched us into line mode and act accordingly for the rest of the current input buffer. This was causing the command string to be echoed by the CLI editor code. - For non-interactive sessions, send a NUL byte after the input buffer has been processed. This is because vppctl depends on seeing traffic before it will try to close the session; a command with no output would cause it to hang. NUL bytes are ignored by all decent terminals, but we have vppctl strip them out anyway. - Prevent certain commands from running in non-interactive sessions since they manipulate interactive-related features. - For interactive sessions, quench the prompt that prints on VPP shutdown. - Detect and handle socket errors in the CLI; sessions were leaking. - Pevent SIGPIPE from ever being raised; handle EPIPE instead. We don't need VPP to die just because a socket closed just before we try to write to it! - Add a command to dump a list of current CLI sessions; mostly this was to detect session leakage, but it may have some general utility. Change-Id: Ia147da013317180882c1d967b18eefb8519a55fb Signed-off-by: Chris Luke <chrisy@flirble.org>
2017-09-20CLI: fix segfault when browsing an empty historyYoann Desmouceaux1-3/+1
When one starts VPP, types a command, presses up rather than enter, then types a new command, unix_cli_line_process_one() segfaults. This is due to cf->cursor not being reset upon pressing up if the history is empty. Change-Id: Ie503f20a9cb551e735abb8b0f4feb8c0006d2b61 Signed-off-by: Yoann Desmouceaux <ydesmouc@cisco.com>
2017-09-20Fix DHCP client so it works for worker threadsJohn Lo1-0/+3
Fix dhcp_client_for_us() function to utilize rpc_call_main_thread to call vlib_process_signal_event() to ensure proper handling irrespective of it being called in main thread or worker thread. Added ASSERT to vlib_process_sinal.. path to make sure it is called in main thread. Change-Id: I4109cc049d8e4225d896ce492ce201011dc9c911 Signed-off-by: John Lo <loj@cisco.com>
2017-09-18Fixes for issues Coverity has reported (VPP-972)Chris Luke2-1/+31
177117: fstat() returns -1 on error; the code is checking for any positive value instead 175142: final return could never be reached; simple refactoring 175235,175236: Warning suppressed with an explicit cast to (void) 174817: Final return couldn't be reached; is is_in_order is 0 then 'rv' is already returned above 172095,172093: If is_is_set does not get set to 1, then return 0 has already been invoked 174405: Re-kill this (nothing sets rv) 171136: Looks like a cmd line flag to set test_bytes was missing; added it, and refactored the argc/argv processing to avoid two other potential segv's 176813: Add range checking for term width/height. First stab at a reasonable range is 1-512 for both. 175350: Fix implicit casting in shift operation 174272: Not a c+p error; try using a coverity annotation to ignore it 174273,175320: Annotated FORWARD_NULL Change-Id: I58d0f860fc2209f59f8d1b6b344d631b8d429ace Signed-off-by: Chris Luke <chrisy@flirble.org>
2017-09-15dpdk: cli to check for buffer leakageFlorin Coras1-1/+1
Use buffer pre_data and existing buffer trace trajectory code to find out dpdk buffer leakages. Change-Id: I26a5d8bd2f23d01cb6070ffc3ddcc6d3d863b575 Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-09-15vppinfra: add clib_mem_vm_ext_alloc functionDamjan Marion7-536/+45
Change-Id: Iff33694fc42cc3bcc73cf1372339053a6365039c Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-14clib_socket: add sendmsg / recvmsg with ancillary data supportDamjan Marion1-2/+2
Change-Id: Ie18580e05ec12291e7026f21ad874e088a712c8e Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-12physmem: remove debug leftoversDamjan Marion1-1/+0
Change-Id: I5a5dc0794d3398e749b64b07dfd1e2fc2230089b Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-11Recombine diags and minimum barrier open time changes (VPP-968)Colin Tregenza Dancer3-11/+340
Support logging to both syslog and elog Also include DaveB is_mp_safe fix, which had been lost Change-Id: If82f7969e2f43c63c3fed5b1a0c7434c90c1f380 Signed-off-by: Colin Tregenza Dancer <ctd@metaswitch.com>
2017-09-09move unix_file_* code to vppinfraDamjan Marion7-161/+98
This will allow us to use this code in client libraries without vlib. Change-Id: I8557b752496841ba588aa36b6082cbe2cd1867fe Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-08physmem: make fake allocation non-fatal if we cannot pick numa nodeDamjan Marion1-4/+11
Change-Id: I563c043ed82e3ef199fc3d47931108f31cc01728 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-08vlib: move linux-specific code to vlib/linuxDamjan Marion8-266/+356
Change-Id: Id79d2c2be7a98e15416a537c890a8f2dd6d4464d Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-08Fixes for issues reported by Coverity (VPP-972)Chris Luke1-4/+4
Change-Id: I25238debb7081b4467aec4620dfdef33fbef3295 Signed-off-by: Chris Luke <chrisy@flirble.org>
2017-09-07vlib physmem reworkDamjan Marion12-495/+662
This patch adds supprot support for multiple numa-aware physmem regions. Change-Id: I5c69a6f4da33c8ee21bdb8604d52fd2886f2327e Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-09-05Add pidfile cmdline optionPierre Pfister3-9/+98
Change-Id: Ibaa61b624eb6683b1be6901a7b29f5f73aad27b2 Signed-off-by: Pierre Pfister <ppfister@cisco.com>
2017-09-05Refork worker thread data structures in parallel (VPP-970)Colin Tregenza Dancer3-136/+214
Change the rebuilding of worker thread clone datastructures to run in parallel on the workers, instead of serially on main. Change-Id: Ib76bcfbef1e51f2399972090f4057be7aaa84e08 Signed-off-by: Colin Tregenza Dancer <ctd@metaswitch.com>
2017-08-31Set runtime_path properly when running non-rootDamjan Marion1-2/+11
non-root users should use /run/user/$PID/... Change-Id: I1ca136df7a339eff193ed9c9a396d6965b192d0e Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-08-30Thread safe internal buffer manager, take twoDamjan Marion3-4/+32
First attempt to make internal buffer manager thread safe was not succesfull, so trying again. This time with more testing. Change-Id: I01b8385a9c26d233934a3339255ea4bd31c865ac Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-08-25TCP horizontal scalingDave Barach3-21/+8
- Remove frame handoff support machinery. We haven't used it in a long time. - Configuration support for the local endpoints bihash table - Drop lookup failure packets in tcp46_syn_sent Change-Id: Icd51e6785f74661c741e76fac23d21c4cc998d17 Signed-off-by: Dave Barach <dave@barachs.net>
2017-08-24Make VPP runtime directory configurableDamjan Marion4-20/+63
New startup config command: unix { runtime-dir /run/vpp } Also, adds recursive mkdir funtion for use in deifferent places like cli-config socket path and dpdk hugepage directory path. Change-Id: I1446ceab9c220c25804e73a743a3ebb383450124 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-08-11Fix tcp multi buffer segments retransmissionFlorin Coras1-1/+6
- Fix tcp/udp sw checksum computation - Fix allocation of multi buffer tcp segments for retransmits - Send FIN only if/when tx fifo is empty Change-Id: I2e43a14b87a72c9e547b4339b9a51811cf5732c4 Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-08-02Fix tcp tx buffer allocationFlorin Coras2-8/+10
- Make tcp output buffer allocation macro an inline function - Use per ip version per thread tx frames for retransmits and timer events - Fix / parameterize tcp data structure preallocation - Add a couple of gdb-callable show commands - Fix local endpoint cleanup Change-Id: I67b47b7570aa14cb4634b6fd93c57cd2eacbfa29 Signed-off-by: Florin Coras <fcoras@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
2017-07-27Thread safe internal buffer managerDamjan Marion4-9/+18
Change-Id: I45845b952aa42a854e1c2c396b85f905de987020 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-07-26VPP-905: Wrong define used in function start_workers.JingLiuZTE1-1/+2
Change-Id: I6a5faebb63e9360cebfcfb1bc3f3c0eb6b15e937 Signed-off-by: JingLiuZTE <liu.jing5@zte.com.cn>
2017-07-17Fix unlinking of /dev/shm files.Dave Wallace1-9/+9
- api-segment prefix not used when unlinking shm files - unlink root region on exit if no clients referenced - stale reference to freed segment name - don't add fake client to /db unless CLIB_DEBUG > 2 - turn off the gmond plugin - clean up unused vars in vpp/api Change-Id: I66451fcfd6ee64a12466c2d6c209050e3cdb74b7 Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Signed-off-by: Dave Barach <dave@barachs.net>
2017-07-14Introduce l{2,3,4}_hdr_offset fields in the buffer metadataDamjan Marion3-38/+68
To save space in the first cacheline following is changed: - total_length_not_including_first_buffer moved to the 2nd cacheline. This field is used only when VLIB_BUFFER_TOTAL_LENGTH_VALID and VLIB_BUFFER_NEXT_PRESENT are both set. - free_list_index is now stored in 4bits inside flags, which allows up to 16 free lists. In case we need more we can store index in the 2nd cachelin Change-Id: Ic8521350819391af470d31d3fa1013e67ecb7681 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-07-13VPP-895 multi-thread: fix vpp crash on show runtimeIgor Mikhailov (imichail)1-0/+29
In multi-threaded model (e.g. 1 main and 1 worker threads), after an ethernet interface is deleted (e.g. vhost-user interface), 'show runtime' command produces garbled output and sometimes leads to vpp crash. The reason is because vlib_node_rename() frees and reallocates node's 'n->name' vector, however the change is not propagated into copies of the node on worker threads. Change-Id: Ibf22422913b7f2df22f70f3b2fe8dafd34c1dd06 Signed-off-by: Igor Mikhailov (imichail) <imichail@cisco.com> (cherry picked from commit 02989064e4c26a4940a5292ba6c47023e6dd3131)
2017-07-13dpdk: fix dpdk_buffer_pool_create nameChris Luke1-3/+0
- vnet_buffer_pool_create should probably be named dpdk_buffer_pool_create since that is what it does. - Its prototype should also be in a DPDK plugin header, not in vlib/buffer_funcs.h, since the implementation is in the plugin and nobody else should be calling it. Change-Id: I7ba259afa4b888bc94f3ad257305e286b41e7370 Signed-off-by: Chris Luke <chrisy@flirble.org>
2017-07-10vlib: store buffer memory information in the buffer_mainDamjan Marion5-44/+87
Currently, buffer index is calculated as a offset to the physmem region shifted by log2_cacheline size. When DPDK is used we "hack" physmem data with information taken from dpdk mempool. This makes physmem code not usable with DPDK. This change makes buffer memory start and size independent of physmem basically allowing physmem to be used when DPDK plugin is loaded. Change-Id: Ieb399d398f147583b9baab467152a352d58c9c31 Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-07-10vlib: fix issues with PCI handling codeDamjan Marion2-7/+7
- PCI devices not properly discovered - vlib_pci_bus_master_enable () not working Change-Id: I7433ab1b19b890b8900635b43037b9a2017a1921 Signed-off-by: Damjan Marion <damarion@cisco.com>