summaryrefslogtreecommitdiffstats
path: root/src/vlibmemory
AgeCommit message (Collapse)AuthorFilesLines
2018-11-13vlib rename vlib_frame_args(...) to vlib_frame_scalar_args(..)Damjan Marion1-2/+2
Typically we have scalar_size == 0, so it doesn't matter but vlib_frame_args was providing pointer to scalar frame data, not vector data. To avoid future confusion function is renamed to vlib_frame_scalar_args(...) Change-Id: I48b75523b46d487feea24f3f3cb10c528dde516f Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-11-01Move RPC calls off the binary API input queueDave Barach3-29/+50
Change-Id: I2476e3e916a42b41d1e66bfc1ec4f8c4264c1720 Signed-off-by: Dave Barach <dbarach@cisco.com>
2018-10-25Revert "Keep RPC traffic off the shared-memory API queue"Florin Coras3-38/+29
This reverts commit 71615399e194847d7833b744caedab9b841733e5. There seems to be an issue with ARPs when running with multiple workers. Change-Id: Iaa68081512362945a9caf24dcb8d70fc7c5b75df Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-10-24Keep RPC traffic off the shared-memory API queueDave Barach3-29/+38
Change-Id: Ib5c346641463768cf33eaf8cb5fab5b63171398d Signed-off-by: Dave Barach <dave@barachs.net>
2018-10-23c11 safe string handling supportDave Barach7-30/+30
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
2018-10-03sock api: fix registrations and client readsFlorin Coras5-28/+69
- When clients connect, instead of returing registration indicies return handles. By convention socket registrations will have the MSB set to 1. This makes it easy to distinguish them from shm registrations. - Fix client reads to allow for messages larger than 4kB (needed for the creat reply wherein the message table is provided). Change-Id: I7bc0a072d066dffbf2e3ad9ba3ed50291231af9d Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-10-02PAPI: Use UNIX domain sockets instead of shared memoryOle Troan5-39/+94
Adds support for running the API purely across Unix domain sockets. Usage: vpp = VPP(use_socket=True) Change-Id: Iafc1301e03dd3edc3f4d702dd6c0b98d3b50b69e Signed-off-by: Ole Troan <ot@cisco.com>
2018-09-19socket api: do not delay sending of messagesFlorin Coras2-64/+35
Instead of relying on main epoll loop to send messages, try to send as soon as possible. Change-Id: I27c0b4076f3599ad6e968df4746881a6717d4299 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-09-11remove libvlib from libvlibmemoryclient libsMatthew Smith1-1/+1
On CentOS 7, having libvlibmemoryclient link libvlib causes a SEGV when a program or library is run which links against libvlibmemoryclient and dlopen() is called. This is because dlopen() executes any functions with __attribute((constructor)) set. The VLIB_CLI_COMMAND macro creates CLI registration functions that have this attribute set. So CLI registration functions end up being run by applications which are clients of the VPP API. This doesn't occur on ubuntu 16.04, because ld seems to omit shared libraries that were listed on the command line if they are not used to resolve any symbols. Removing the link to libvlib on vlibmemoryclient to fix this problem results in another problem. Tests of libvcl_preload fail when running 'make test'. This happens because libvcl_preload calls dlopen but does not link against libdl. When libvlibmemoryclient had libvlib linked, these errors did not occur since libvlib links libdl. Adjusted the build of libvcl_preload to explicitly link libdl. Change-Id: I271ba2f9226ce1602e1f6c1525f3b093bb0345ed Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2018-08-26cmake: add add_vpp_library and add_vpp_executable macrosDamjan Marion1-14/+13
Change-Id: I1382021a6f616571b4b3243ba8c8999239d10815 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-08-25cmake: add more headers to the install listDamjan Marion1-0/+11
Change-Id: I3a0f48381232fcac1727034aa6d2504a8d1edb04 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-08-20CMake: generate .json from .api filesNeale Ranns1-2/+3
Change-Id: Ic18aa0fb42a72b5e0ebbfbebdefc7582cb46b5ea Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-08-17CMake as an alternative to autotools (experimental)Damjan Marion1-0/+41
Change-Id: Ibc59323e849810531dd0963e85493efad3b86857 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-08-17vlibapi: validate private segment rotor prior to useFlorin Coras1-1/+1
If the dead client scan removes the rotor position we're about to check next, we end up outside the private registration pool's bounds. Change-Id: If4e715593deeac4c06ae6b3fededc1965b042094 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-08-15Remove client_index field from replies in APIOndrej Fabry1-2/+0
- replies should not need to contain client_index since it is used to identify sender of requests to VPP Change-Id: Iece3853b3f020054ee1652b149d0cf8d9580db4e Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
2018-08-10vcl: support for eventfd mq signalingFlorin Coras1-2/+2
- support eventfd based mq signaling. Based on configuration, vcl epoll/select can use either condvars or epoll on mq eventfds. - add vcl support for memfd segments - vpp explicitly registers cut-through segments with apps/vcl - if using eventfd, make ldp allow one call to libc_epoll_create. Needed for the message queue epfd - update svm_queue_t to allow blocking calls with eventfd signaling. Change-Id: I064151ac370bbe29bb16c968bf4e3659c8286bea Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-08-09Fix "Old Style VLA" build warningsJuraj Sloboda1-2/+3
Change-Id: I8d42f6ed58ec34298d41edcb3d783e7e9ded3eec Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
2018-08-07api: compute msg table for private registrationsFlorin Coras1-2/+7
Change-Id: Ibaa236c09c2eeea72ee8a8cc603d407217b4af23 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-08-04socket api: multiple fds in one msgFlorin Coras5-20/+22
Change-Id: I77a6e092a42290eed7201ad4a62e0d00ef997d2b Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-08-03svm: add support for eventfd signaling to queueFlorin Coras2-11/+9
Support the use of eventfds to signal queue updates between consumer and producer pairs. Change-Id: Idb6133be2b731fff78ed520daf9d2e0399642aab Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-07-05VPP-1335 vapi crash when memclnt_keepalive receivedKlement Sekera1-4/+4
Change-Id: If33a7cc6c76147fd3ea9d8118370e7a508819b81 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-06-27gcc8 and Wstringop-truncationMarco Varlese1-4/+6
gcc8 introduced a new warning (Wstringop-truncation) which in our case is being treated as error. Disabling the warning globally might introduce bugs related to string truncation which are not desired by the developer (e.g. bug). Instead, this patch disables the warning only for those occurences which have been verified to be non-bugs but the desired behaviour as per developer will. Change-Id: I0f04ff6b4fad44061e80a65af633fd7e0148a0c5 Signed-off-by: Marco Varlese <marco.varlese@suse.com>
2018-06-26Fix api trace replay of handler to pass vm parameterJohn Lo1-2/+2
I suppose most API handlers do not use vm parameter so it has not been a problem so far. Now vl_api_vnet_set_ip6_ethernet_neighbor() was crashing when called from api trace replay because either of ip_neighbor_add_del_t_handler() vnet_arp_set_ip4_over_ethernet() need vm to be correct when it calls vlin_time_now() to update the neighbor timestamp. Change-Id: Iffb2084a7c90f92c4b86b339ea11800dd41117eb Signed-off-by: John Lo <loj@cisco.com>
2018-06-14Use __attribute__((weak)) references where necessaryDave Barach1-5/+1
It should be possible to use vlib without the vlibmemory library, etc. Change-Id: Ic2316b93d7dbb728fb4ff42a3ca8b0d747c9425e Signed-off-by: Dave Barach <dave@barachs.net>
2018-06-08export counters in a memfd segmentDave Barach2-6/+16
also export per-node error counters directory entries implement object types Change-Id: I8ce8e0a754e1be9de895c44ed9be6533b4ecef0f Signed-off-by: Dave Barach <dave@barachs.net>
2018-06-05VPP API: Memory traceOle Troan2-16/+28
if you plan to put a hash into shared memory, the key sum and key equal functions MUST be set to constants such as KEY_FUNC_STRING, KEY_FUNC_MEM, etc. -lvppinfra is PIC, which means that the process which set up the hash won't have the same idea where the key sum and key compare functions live in other processes. Change-Id: Ib3b5963a0d2fb467b91e1f16274df66ac74009e9 Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Ole Troan <ot@cisco.com>
2018-05-10Remove the historical memfd api segment bootstrapDave Barach2-88/+28
Clean up default and vpp_api_test custom private api segment allocator ring configurations. Change-Id: I145b6d64ba0a6315b5ccb07909c8256eeb772146 Signed-off-by: Dave Barach <dave@barachs.net>
2018-04-18typo fix: UNKOWN -> UNKNOWNAndrey "Zed" Zaikin1-1/+1
Change-Id: I008a4d7ad7160d1f07e7ceef712a5318a9368308 Signed-off-by: Andrey "Zed" Zaikin <zed.0xff@gmail.com>
2018-03-06API: Add service definitions for events and singleton messages (second attempt)Marek Gradzki1-0/+10
Based on https://gerrit.fd.io/r/#/c/10920/ Updates service definition in stats.api with correct reply message names. Change-Id: I3282bee5304e667e23bc1fab3f43d967a50d880d Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
2018-03-05Revert "API: Add service definitions for events and singleton messages."Ole Trøan1-10/+0
This reverts commit f7b7fa53b7eaec81d8c00c1023fb7d01f1f9761f. Change-Id: I87496342943248e94f01ada31459f387c0a3a610 Signed-off-by: Ole Troan <ot@cisco.com>
2018-03-05API: Add service definitions for events and singleton messages.Ole Troan1-0/+10
Change-Id: I7de987c30b263d43521e6280c5273f30b5f6e11c Signed-off-by: Ole Troan <ot@cisco.com>
2018-02-02vlmemory/svm: fix client detach from svm regionFlorin Coras4-8/+23
Clients cannot know at svm region detach time if the shm backing files have been recreated (e.g., if vpp restarts) and therefore should not try to unlink them. Otherwise, terminating clients attached to previous instantiations of a re-allocated region end up making the new instance un-mappable by removing its backing file. Change-Id: Idcd0cab776e63fd75b821bc9f0fac58217b9ccbe Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-01-25session: add support for memfd segmentsFlorin Coras11-86/+219
- update segment manager and session api to work with both flavors of ssvm segments - added generic ssvm slave/master init and del functions - cleanup/refactor tcp_echo - fixed uses of svm fifo pool as vector Change-Id: Ieee8b163faa407da6e77e657a2322de213a9d2a0 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-01-23VPPAPIGEN: vppapigen replacement in Python PLY.Ole Troan1-1/+1
This is a version of the VPP API generator in Python PLY. It supports the existing language, and has a plugin architecture for generators. Currently C and JSON are supported. Changes: - vl_api_version to option version = "major.minor.patch" - enum support - Added error checking and reporting - import support (removed the C pre-processor) - services (tying request/reply together) Version: option version = "1.0.0"; Enum: enum colours { RED, BLUE = 50, }; define foo { vl_api_colours_t colours; }; Services: service { rpc foo returns foo_reply; rpc foo_dump returns stream foo_details; rpc want_stats returns want_stats_reply events ip4_counters, ip6_counters; }; Future planned features: - unions - bool, text - array support (including length) - proto3 output plugin - Refactor C/C++ generator as a plugin - Refactor Java generator as a plugin Change-Id: Ifa289966c790e1b1a8e2938a91e69331e3a58bdf Signed-off-by: Ole Troan <ot@cisco.com>
2018-01-22svm: queue sub: Add conditional timed waitMohsin Kazmi2-3/+3
On reviece side svm queue only permits blocking and non-blocking calls. This patch adds timed wait blocking functionality which returns either on signal/event or on given time out. It also preserves the original behavior, so it will not hurt client applications which are using svm queue. Change-Id: Ic10632170330a80afb8bc781d4ccddfe4da2c69a Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-01-15svm: refactor memfd and remove ssvm_ethFlorin Coras5-12/+15
Change-Id: Icde296e956eb89ea3a17d547f04a833916ec6440 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-01-11api: fix handlers that explicitly depend on svm queueFlorin Coras3-0/+16
Fixes the remainig apis that explicitly check svm queue length. Change-Id: I6055c7c50050affee3098e162e15fb12c205e5db Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-01-11api: remove transport specific code from handlersFlorin Coras1-4/+4
This does not update api client code. In other words, if the client assumes the transport is shmem based, this patch does not change that. Furthermore, code that checks queue size, for tail dropping, is not updated. Done for the following apis: Plugins - acl - gtpu - memif - nat - pppoe VNET - bfd - bier - tapv2 - vhost user - dhcp - flow - geneve - ip - punt - ipsec/ipsec-gre - l2 - l2tp - lisp-cp/one-cp - lisp-gpe - map - mpls - policer - session - span - udp - tap - vxlan/vxlan-gpe - interface VPP - api/api.c OAM - oam_api.c Stats - stats.c Change-Id: I0e33ecefb2bdab0295698c0add948068a5a83345 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-01-10svm: calc base address on AArch64 based on autodetected VA space sizeDamjan Marion1-1/+1
Change-Id: I7487eb74b8deebff849d662b55a6708566ccd9ef Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-01-09api: refactor vlibmemoryFlorin Coras17-3718/+3400
- separate client/server code for both memory and socket apis - separate memory api code from generic vlib api code - move unix_shared_memory_fifo to svm and rename to svm_fifo_t - overall declutter Change-Id: I90cdd98ff74d0787d58825b914b0f1eafcfa4dc2 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-01-05sock api: add first msg id retrieval functionFlorin Coras2-17/+39
Change-Id: I2032b5fc8e1904005b8eb871b9be06d025ed9b71 Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-01-05sock api: add infra for bootstrapping shm clientsFlorin Coras6-151/+514
- add function to sock client that bootstraps shm api - allow sock clients to request custom shm ring configs Change-Id: Iabc1dd4f0dc8bbf8ba24de37f4966339fcf86107 Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-12-15VPP-1102: fix dangling references in RPC handlingDave Barach2-27/+40
Queue RPC calls and send them from the main dispatch loop. As things stood, if the vpp main input queue filled, worker threads could enter a barrier-sync spin-wait in the middle of processing a frame. If thread 0 decided to recreate worker thread data structures, the worker thread(s) could easily crash. Legislate the problem out of existence by enqueueing RPC messages only from the main dispatch loop. At that point, doing a barrier-sync wait is perfectly OK. Change-Id: I18da3e44bb1f29a63fe5f30cf11de732ecfd5bf7 Signed-off-by: Dave Barach <dave@barachs.net>
2017-12-01session: allocate cb messages from client ringFlorin Coras1-0/+2
Change-Id: Ib644a1840c5f24203b6968561f467fbe5e255055 Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-10-31Fix typo (double unlock)Dave Barach1-2/+1
Change-Id: If4a128186a732266eb27b6aa3caf6f1feff449bf Signed-off-by: Dave Barach <dave@barachs.net>
2017-10-25VCL-LDPRELOAD: statically link VPP objects into libvcl_ldpreload.soDave Wallace1-6/+0
Change-Id: If8fb5484b64a5b1c04e34573490fedcf63feabc9 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2017-10-18CSIT-844: fix binary api rx pthread heap push/popDave Barach2-6/+27
We need to push/pop the rx pthread's heap without affecting other thread(s). Search clib_per_cpu_mheaps, locate an unused slot. Duplicate the main thread heap pointer in that slot, and set __os_thread_index appropriately. Miscellaneous cleanups. Print exec_inband results as a vector, instead of as a format string. Don't bail out of vpp_api_test with results pending, e.g. at the end of a vpp_api_test script. Even though vpp will eventuallly garbage-collect them, We don't want to leave allocated reply messages lurking in the api message allocation rings... Change-Id: I0e8a25d1ff0d3700249dc330d079db16c2fcbc55 Signed-off-by: Dave Barach <dave@barachs.net>
2017-10-10API versioning: Fix coverity errors from strncpy()Ole Troan1-1/+1
Change-Id: Ife87f9b00f918ff1bb8c91c6f13ebe53a3555a12 Signed-off-by: Ole Troan <ot@cisco.com>
2017-10-09vppapigen: support per-file (major,minor,patch) version stampsDave Barach2-1/+60
Add one of these statements to foo.api: vl_api_version 1.2.3 to generate a version tuple stanza in foo.api.h: /****** Version tuple *****/ vl_api_version_tuple(foo, 1, 2, 3) Change-Id: Ic514439e4677999daa8463a94f948f76b132ff15 Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Ole Troan <ot@cisco.com>
2017-10-06Coverity fixes for API socketChris Luke1-3/+3
- Coverity whines about a zero-length field not being initialized. Change the struct setup to an initializer which will implicitly zero all unused fields, and add the coverity notation that should stop it whining. One or both of these should shut it up! - Fix some incorrect use of ntohl that was tainting values; in these cases htonl should have been used, and avoid a double-swap. Change-Id: I00493a77eb23a0b8feb647165ee349e1e9d5cfdb Signed-off-by: Chris Luke <chrisy@flirble.org>