aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibapi
AgeCommit message (Collapse)AuthorFilesLines
2020-10-06feature: Add packet trace APIJon Loeliger1-0/+29
Also spiffed up the vpp_api_test plugin loader so it executes VLIB_INIT_FUNCTIONs and VLIB_API_INIT_FUNCTIONs. Type: feature Change-Id: Id9a4f455d73738c41bcfea220df2112bb9679681 Signed-off-by: Jon Loeliger <jdl@netgate.com> Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
2020-08-25api: register endian handlers for reply messagesOle Troan1-1/+20
Endian handlers was not registered for reply messages. Causing endian-neutral handlers to crash. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Id14173300ee1ab2601e92d58c70d2fa260814b69
2020-07-16misc: add callback hooks and refactor pmcTom Seidenberg2-1/+21
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-06-17docs: add more FEATURE.yaml documentationDave Barach1-0/+14
For src/tools/g2, src/vlibapi, and src/vlibmemory Type: docs Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I800c3e3a1ecb011d5e692d78a015e78342706786
2020-06-15api: check id is valid for bounce checkingBenoît Ganne1-1/+1
If the id is invalid we cannot check whether we must free the message or not, free it anyway. Type: fix Change-Id: Ie4426f601390d1e5e14c739f670e8c1e6e3aaf1e Signed-off-by: Benoît Ganne <bganne@cisco.com>
2020-05-27api: make vpp api handlers endian independentOle Troan3-1/+43
Add a new boolean to signal that the API infrastructure should performan any required endian conversions for the API handler. am->is_autoendian[mm->msg_id_base + VL_API_MAP_ADD_DOMAIN] = 1; Similarly add new REPLY_ macros that perform endian conversion. These changes do not change the on-the-wire encoding of the API messages, and therefore the API CRC is not changed. Type: feature Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I7588f8ccb38b2d1e8d85ea17be99bac43f756267 Signed-off-by: Ole Troan <ot@cisco.com>
2020-05-25api: add new stream message conventionOle Troan1-0/+37
Instead of having to wrap dump/detail calls in control ping, send details messages in between a normal reply / request pair. As expressed in the below service statement. Example: service { rpc map_domains_gets returns map_domains_get_reply stream map_domain_details; }; define map_domains_get { u32 client_index; u32 context; u32 cursor; }; define map_domains_get_reply { u32 context; i32 retval; u32 cursor; }; To avoid blocking the main thread for too long, the replies are now sent in client message queue size chunks. The reply message returns VNET_API_ERROR_EAGAIN when there is more to read. The API handler must also include a "cursor" that is used to the next call to the get function. API handler example: REPLY_AND_DETAILS_MACRO (VL_API_MAP_DOMAINS_GET_REPLY, mm->domains, ({ send_domain_details (cursor, rp, mp->context); })); The macro starts from cursor and iterates through the pool until vl_api_process_may_suspend() returns true or the iteration reaches the end of the list. Client Example: cursor = 0 d = [] while True: rv, details = map_domains_get(cursor=cursor) d += details if rv.retval == 0 or rv.retval != -165: break cursor = rv.cursor or the convenience iterator: for x in vpp.details_iter(vpp.api.map_domains_get): pass or list(details_iter(map_domains_get)) Change-Id: Iad9f6b41b0ef886adb584c97708dd91cf552749e Type: feature Signed-off-by: Ole Troan <ot@cisco.com>
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-05-04misc: binary api fuzz test fixesDave Barach3-2/+28
Add a hook to src/vlibapi/api_shared.c to fuzz (screw up) binary API messages, e.g. by xoring random data into them before processing. We specifically exempt client connection messages, and inband debug CLI messages. We step over msg_id, client index, client context, and sw_if_index. Otherwise, "make test" vectors fail too rapidly to learn anything. The goal is to reduce the number of crashes caused to zero. We're fairly close with this patch. Add vl_msg_api_max_length(void *mp), which returns the maximum plausible length for a binary API message. Use it to hardern vl_api_from_api_to_new_vec(...) which takes an additional argument - message pointer - so it can verify that astr->length is sane. If it's not sane, return a u8 *vector of the form "insane astr->length nnnn\0". Verify array lengths in vl_api_dhcp6_send_client_message_t_handler(...) and vl_api_dhcp6_pd_send_client_message_t_handler(...). Add a fairly effective binary API fuzz hook to the unittest plugin, and modify the "make test" framework.py to pass "api-fuzz { on|off }" to enable API fuzzing: "make API_FUZZ=on TEST=xxx test-debug" or similar Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I0157267652a163c01553d5267620f719cc6c3bde
2020-04-14vat: fix socket connectionDave Barach1-15/+15
vat_socket_connect(...) needs to set the api main client index. The M2 helper macro needed to allocate a buffer of size sizeof(*mp) + n, not sizeof(*mp). Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I7abf35d2ba045d82765bd27f88899287fd351602
2020-02-26api: add macro that zeros out api reply bufferPaul Vinciguerra1-0/+32
Add macros REPLY_MACRO2_ZERO, REPLY_MACRO3_ZERO that zeros the buffer before the values are set. This way if say, a u8[64] field is only filled with 10 octets, the previous buffers trailing contents are not sent. Type: feature Change-Id: Ia69cc9aa477f463336483f7556de32476a6f2d51 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-02-26api: improve api string safetyJakub Grajciar2-13/+34
- Remove vl_api_from_api_string to prevent use of not nul-terminated strings. - Rename vl_api_from_api_to_vec -> vl_api_from_api_to_new_vec to imply a new vector is created. NOT nul terminated. - Add vl_api_from_api_to_new_c_string. Returns nul terminated string in a new vector. - Add vl_api_c_string_to_api_string. Convert nul terminated string to vl_api_string_t - Add vl_api_vec_to_api_string. Convert NON nul terminated vector to vl_api_string_t Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: Iadd59b612c0d960a34ad0dd07a9d17f56435c6ea Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-12-17ip: Protocol Independent IP NeighborsNeale Ranns1-13/+4
Type: feature - ip-neighbour: generic neighbour handling; APIs, DBs, event handling, aging - arp: ARP protocol implementation - ip6-nd; IPv6 neighbor discovery implementation; separate ND, MLD, RA - ip6-link; manage link-local addresses - l2-arp-term; events separated from IP neighbours, since they are not the same. vnet retains just enough education to perform ND/ARP packet construction. arp and ip6-nd to be moved to plugins soon. Change-Id: I88dedd0006b299344f4c7024a0aa5baa6b9a8bbe Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-12-11api: Use vl_msg_push/pop_heapNathan Skrzypczak2-4/+18
Type: refactor Change-Id: I0eb46676fc22ce6825b2d879498df344b5a855e8 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2019-12-10api: pass api and client main to rx threadFlorin Coras1-0/+6
Type: fix Change-Id: Ib8313e87a89c80045edd897924917a88b98d1937 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-12-10api: multiple connections per processDave Barach3-24/+41
Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I2272521d6e69edcd385ef684af6dd4eea5eaa953
2019-12-06api: avoid swapping vlib_rp before barrier syncFlorin Coras2-4/+19
Type: fix Change-Id: I9868d13e827c6f5aa5535a38f629efb62ff12dbc Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com> Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-11-27misc: add address sanitizer heap instrumentationBenoît Ganne1-0/+20
Introduce AddressSanitizer support: https://github.com/google/sanitizers/ This starts with heap instrumentation. vlib_buffer, bihash and stack instrumentation should follow. Type: feature Change-Id: I7f20e235b2f79db72efd0e756f22c75f717a9884 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-10-08api: add bapi thread handle to api main structure.IJsbrand Wijnands1-0/+3
Adding the thread handle to the api main structure allows the client process of the bin api to manage the thread, like setting the thread name for example. Type: feature Change-Id: I38b58ddc83d5958c4bda76eadd371eee1545724b Signed-off-by: IJsbrand Wijnands <ice@cisco.com>
2019-09-25api: split api generated filesOle Troan1-0/+15
Split generation of API message enum and the typedefs into separate files, so that the type file can be included from elsewhere. Generate a C file for VPP that contains the API registration, this was previously done via X macros by the C pre- processor. This allows deleting lots of skeleton/copy paste code for each feature. plugins/flowprobe plugins/map examples/sample-plugin vnet/ipip used as Guinea pigs. Generate a C Test file for VAT, that does the same for VAT plugins. Also add support for a per-message CLI option, that is currently limited to VAT help text. option vat_help = "<help text>"; Type: refactor Change-Id: I245e3104bb76f7e1fb69a59ab20cc7c8dfcdd460 Signed-off-by: Ole Troan <ot@cisco.com>
2019-09-16api: autogenerate api trace print/endianOle Troan2-3/+12
In addition to the external vppapitrace tool, VPP itself supports dumping of API trace files. In two formats, "custom-dump" and "dump". "dump" gives a human friendly list, and "custom-dump" is meant to give a list of commands that can be fed to VAT. This patch only deals with "dump". Prior to this fix, auto-generation was only done for the basic types. This fix adds support for any type, including lists, and supports pretty-printing of enums, strings, IP addresses, MAC addresses and so on. Usage: api trace dump <api-trace-file> For example Change-Id: I4e485680e6dcfce7489299ae6cf31d835071ac40 ---------- trace 48 ----------- vl_api_sw_interface_set_flags_t: _vl_msg_id: 75 client_index: 0 context: 10 sw_if_index: 1 flags: IF_STATUS_API_FLAG_ADMIN_UP ---------- trace 49 ----------- vl_api_sw_interface_add_del_address_t: _vl_msg_id: 88 client_index: 0 context: 11 sw_if_index: 1 is_add: 1 del_all: 0 prefix: 172.16.1.1/24 ---------- trace 51 ----------- vl_api_cli_inband_t: _vl_msg_id: 819 client_index: 0 context: 13 cmd: packet-generator capture pg0 pcap /tmp/vpp-unittest-TestMAP-YhcmDX/pg0_out.pcap disable ---------- trace 58 ----------- vl_api_ip_neighbor_add_del_t: _vl_msg_id: 199 client_index: 0 context: 20 is_add: 1 neighbor: sw_if_index: 2 flags: IP_API_NEIGHBOR_FLAG_NONE mac_address: 0202.0000.ff02 ip_address: fd01:2::2 Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I5556d06008de2762e7c2d35a8b0963ae670b3db1 Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com>
2019-08-20api: Cleanup APIs interface.apiJakub Grajciar1-0/+2
Use of consistent API types for interface.api Type: fix Change-Id: I88206d7d0907cffd564031f73c9a996df2e5e21a Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-08-08api: vppapitrace JSON/API trace converterOle Troan2-4/+36
usage: vppapitrace.py [-h] [--debug] [--apidir APIDIR] {convert,replay} ... optional arguments: -h, --help show this help message and exit --debug enable debug mode --apidir APIDIR Location of JSON API definitions subcommands: valid subcommands {convert,replay} additional help convert Convert API trace to JSON or Python and back replay Replay messages to running VPP instance To convert an API trace file to JSON: vppapitrace convert /tmp/api.trace trace.json To convert an (edited) JSON file back to API trace for replay: vppapitrace convert trace.json api-edited.trace To generate a Python file that can be replayed: vppapitrace convert /tmp/api.trace trace.py vppapitrace convert trace.json trace.py Replay it to a running VPP instance: vppapitrace replay --socket /tmp/api.trace In VPP that file can be replayed with: vpp# api trace replay api-edited.trace This patch also modifies the API binary trace format, to include the message id to message name table. Change-Id: Ie6441efb53c1c93c9f778f6ae9c1758bccc8dd87 Type: refactor Signed-off-by: Ole Troan <ot@cisco.com>
2019-07-19api: fix coverity warningDave Barach1-3/+8
Type: fix Ticket: VPP-1649 Change-Id: Ia159d0f67d33719d05fa2dbd82f9c8c9b5d8f2a9 Signed-off-by: Dave Barach <dave@barachs.net>
2019-07-16api: enable binary API event logging in vatDave Barach2-28/+86
Cleaned up a few instances of side-bet elog_string hash table usage. Elog_string handles that problem itself. Add cli commands to vat to initialize, enable/disable, and save an event log. Event logging at the same time in both vpp and vat yields a pair of event logs which can be merged by the "test_elog" tool. Type: refactor Change-Id: I8d6a72206f2309c967ea1630077fba31aef47f93 Signed-off-by: Dave Barach <dave@barachs.net>
2019-07-09vat: unload unused vat pluginsDave Barach1-0/+21
If the corresponding vpp plugin is absent, return a non-zero clib_error_t * from vat_plugin_register ("xxx plugin not loaded"). The vat plugin calls dlclose on the vat plugin, and it disappears. Depending on the plugin configuration, this can reduce the vpp virtual size by several gigabytes. Added a VAT_PLUGIN(<plugin-name>) macro to vat_helper_macros, clean up boilerplate vat_plugin_register() implementations. Fixed a number of non-standard vat_plugin_register methods. Type: refactor Change-Id: Iac908e5af7d5497c78d6aa9c3c51cdae08374045 Signed-off-by: Dave Barach <dave@barachs.net>
2019-07-02api: fix coverity warningsDave Barach1-7/+7
New coverity toolset, new set of squawks to fix Ticket: VPP-1649 Type: fix Change-Id: I2a7e4c42b101c6c79c01b150b2523ce3d5d62354 Signed-off-by: Dave Barach <dave@barachs.net>
2019-06-26api: Remove the inlines file and replace with library functionsNeale Ranns3-59/+55
using inlines exposes the users to the internal data types used by VPP, namely vec.h. This file does not compile with a C++ compiler. Type: feature Change-Id: I1544fdd9eae998309f865df61df78571bdb96903 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-06-18api: string type to convert to vectorOle Troan2-27/+59
Previous use of strndup() required user to remember to call free(). Now return a vector pointing directly to the API message string. Of course user must remember to copy the string out if lifetime is longer than API message lifetime. Change-Id: Ib5e2b3d52d258e1a42ea9ea9a9e04abbe360e2bf Type: fix Signed-off-by: Ole Troan <ot@cisco.com>
2019-06-14api: add mp-safe/barrier-sync indication to elogsDave Barach1-6/+17
Costs nothing, and leaves nothing to the imagination. Type: fix Change-Id: I7c9f9fb9325475c268eca062da7bbbf014438cfc Signed-off-by: Dave Barach <dave@barachs.net>
2019-06-12infra: fix minor memory leak in "api trace..."Dave Barach1-1/+3
Build api trace message print fns into the built-in copy of api_format.c Optimize memory allocator behavior when the api trace wraps. Type: Fix Change-Id: If799d8784a459f981fc9ee3a3ca03d3f63b2bcd0 Signed-off-by: Dave Barach <dave@barachs.net>
2019-03-25add api trace printezkexma1-1/+16
/vpp/src/vlibapi/api_shared.c after "set api-trace debug on",api trace will be print ontime when clients send msg to vpp. Change-Id: Ib2e504afb9e674c5cdfa6dc5c522c7af0396d687 Signed-off-by: ezkexma <maqi.z.ke@ericsson.com>
2019-03-15Revert "API: Cleanup APIs interface.api"Ole Trøan1-3/+1
This reverts commit e63325e3ca03c847963863446345e6c80a2c0cfd. Allow time for CSIT to accommodate. Change-Id: I59435e4ab5e05e36a2796c3bf44889b5d4823cc2 Signed-off-by: ot@cisco.com
2019-03-15API: Cleanup APIs interface.apiJakub Grajciar1-1/+3
Use of consistent API types for interface.api Change-Id: Ieb54cebb4ac96b432a3f0b41596718aa2f34885b Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2019-01-24perfmon plugin: 2-way parallel stat collectionDave Barach1-9/+2
As a FUD reduction measure, this patch implements 2-way parallel counter collection. Synthetic stat component counter pairs run at the same time. Running two counters (of any kind) at the same time naturally reduces the aggregate time required by an approximate factor-of-2, depending on whether an even or odd number of stats have been requested. I don't completely buy the argument that computing synthetic stats such as instructions-per-clock will be inaccurate if component counter values are collected sequentially. Given uniform traffic pattern, it must make no difference. As the collection interval increases, the difference between serial and parallel component counter collection will approach zero, see also the Central Limit theorem. Change-Id: I36ebdcf125e8882cca8a1929ec58f17fba1ad8f1 Signed-off-by: Dave Barach <dave@barachs.net>
2019-01-14api_helper_macro mp->pid is network endianOle Troan1-1/+1
Change-Id: I7d2385b9e9bf5a62f3e9382ca2627a74a4e30785 Signed-off-by: Ole Troan <ot@cisco.com>
2018-12-18VAPI/VOM: Removing legacy stats tests, add string type.Ole Troan1-4/+6
Fix misc VAPI/VOM generation and test cases. Change-Id: I1abf9ecdb6f8a2129f11e0a9ed1c0fe04cdf5c47 Signed-off-by: Ole Troan <ot@cisco.com>
2018-12-17String type: Not include \0 in show_versionOle Troan1-0/+6
The string type does not include the \0 in strings. Change-Id: I869f438b84880df40a018e43b4510194d84ce0fe Signed-off-by: Ole Troan <ot@cisco.com>
2018-12-14String type: Fix off by one errorOle Troan1-3/+2
String is not sent nul terminated across API. The hardest two problems in computer science is cache invalidation naming and off by one errors. Change-Id: I36f1952ca955cb2d9dfb4c8120ec48c50ba17991 Signed-off-by: Ole Troan <ot@cisco.com>
2018-12-13API: Use string type instead of u8.Ole Troan3-0/+56
The new string type is modelled after string in proto3. It is always variable length. Change-Id: I64884067e28a80072c8dac31b7c7c82d6e306051 Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Michal Cmarada <mcmarada@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com>
2018-11-14Remove c-11 memcpy checks from perf-critical codeDave Barach1-1/+1
Change-Id: Id4f37f5d4a03160572954a416efa1ef9b3d79ad1 Signed-off-by: Dave Barach <dave@barachs.net>
2018-10-23c11 safe string handling supportDave Barach3-7/+7
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
2018-10-22X86_64 perf counter pluginDave Barach1-2/+9
Change-Id: Ie5a00c15ee9536cc61afab57f6cadc1aa1972f3c Signed-off-by: Dave Barach <dave@barachs.net>
2018-10-02PAPI: Use UNIX domain sockets instead of shared memoryOle Troan1-1/+1
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-10-01API / CLI event-log tracingDave Barach1-45/+38
Add an "elog trace [api][cli][barrier]" debug CLI command. Removed the barrier elog test command. Remove unused reliable multicast code. Change-Id: Ib3ecde901b7c49fe92b313d0087cd7e776adcdce Signed-off-by: Dave Barach <dave@barachs.net>
2018-09-07cmake: set packaging component for different filesDamjan Marion1-0/+2
Change-Id: I033a1f5cdb24f77462cb5ec90a62226d93f52925 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-08-26cmake: add add_vpp_library and add_vpp_executable macrosDamjan Marion1-1/+5
Change-Id: I1382021a6f616571b4b3243ba8c8999239d10815 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-08-25cmake: add more headers to the install listDamjan Marion1-0/+19
Change-Id: I3a0f48381232fcac1727034aa6d2504a8d1edb04 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-08-03svm: add support for eventfd signaling to queueFlorin Coras1-3/+0
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-09IGMP improvementsNeale Ranns1-2/+2
- Enable/Disable an interface for IGMP - improve logging - refactor common code - no orphaned timers - IGMP state changes in main thread only - Large groups split over multiple state-change reports - SSM range configuration API. - more tests Change-Id: If5674f1044e7e97274a711f47807c9ba689d7b9a Signed-off-by: Neale Ranns <nranns@cisco.com>