summaryrefslogtreecommitdiffstats
path: root/src/plugins/lb
AgeCommit message (Collapse)AuthorFilesLines
2019-09-30lb: remove api boilerplateOle Troan5-241/+50
Type: refactor Change-Id: I5555037386d6f6593ac3328385603a382be1fc2a Signed-off-by: Ole Troan <ot@cisco.com>
2019-09-26lb: add APIs for set interface nat4 and nat6Hongjun Ni2-0/+68
Type: feature Change-Id: I5656cd798b108dd780381b87f574554442ed7b23 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2019-09-26lb: vl_api_lb_conf_t_handler has to ntohlVratko Polak1-4/+4
As requested in review, this is a minimal edit. Refactor comes as a separate Change. Type: fix Change-Id: Ie3bdfc3cfde4bfee56848217133ca5f6bbccaeef Signed-off-by: Vratko Polak <vrpolak@cisco.com>
2019-09-19api: split vl_api_prefix into twoOle Troan2-6/+6
One type for address with prefix and one type for prefix. Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Icfec51d9b7d5cde1d69fbecdd97498688ab7b295 Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Klement Sekera <ksekera@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com>
2019-09-16api: autogenerate api trace print/endianOle Troan2-0/+6
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-29lb: fix memcpy error issueYulong Pei1-7/+3
vl_api_prefix_t size is 21 byte, ip46_address_t size is 16 byte, only copy 16 byte of vl_api_prefix_t to ip46_address_t is not correct. Type:fix Change-Id: I35ede7836a0c878d39388b29b15d91bb08f87a07 Signed-off-by: Yulong Pei <yulong.pei@intel.com>
2019-08-22tests: move plugin tests to src/plugins/*/testDave Wallace3-0/+662
- Relocate plugin tests for 'make test' into src/plugins/*/test so that plugin test cases are co-located with the plugin source code. Type: refactor Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: I503e6a43528e14981799b735fa65674155713f67 Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2019-08-20vppapigen: remove support for legacy typedefsPaul Vinciguerra1-1/+1
vppapigen has remapped legacy to typedefs behind the scenes for some time now. - update .api files to use new style typedefs. - issue error on 'typeonly define' in .api files - remove unneeded macros redefining vl_noop_handler Type: refactor Change-Id: I7a8c4a6dafacee6a131f95cd0e9b03a8c60dea8b Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-08-02lb: fix usage of lb_main in testFlorin Coras1-2/+18
Type: fix Change-Id: I9f8a8da31624637c060a9757256589c8f372f192 Signed-off-by: Florin Coras <fcoras@cisco.com>
2019-07-31lb: vip and as dump/detail api'sHongjun Ni7-75/+441
- lb_vip_dump/lb_vip_details - get all vip. - lb_as_dump/lb_as_details - get all as list per vip. - adds api unit test. - adds vpp_lb to test framework. Ticket: Type: feature Change-Id: I24be50d62c5234f3535cc840603ddd9df7eb3f07 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com> Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com> Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2019-07-31vppinfra: refactor test_and_set spinlocks to use clib_spinlock_tjaszha032-9/+12
Spinlock performance improved when implemented with compare_and_exchange instead of test_and_set. All instances of test_and_set locks were refactored to use clib_spinlock_t when possible. Some locks e.g. ssvm synchronize between processes rather than threads, so they cannot directly use clib_spinlock_t. Type: refactor Change-Id: Ia16b5d4cd49209b2b57b8df6c94615c28b11bb60 Signed-off-by: Jason Zhang <jason.zhang2@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Lijian Zhang <Lijian.Zhang@arm.com>
2019-07-18lb: update api.c to use scaffolding from latest skelPaul Vinciguerra4-43/+112
Type: refactor Change-Id: I01329385684f4a4f477cb046079b554ae3024ded Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-07-09vat: unload unused vat pluginsDave Barach1-21/+3
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-06-07build: add -Wall and -fno-common, fix reported issuesBenoît Ganne1-3/+4
Type: refactor Change-Id: I8489ccd54411c2aa9355439c5641dc31012c64a2 Signed-off-by: Benoît Ganne <bganne@cisco.com> Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-06-06lb: crashed with some specific commit under heavy trafficHongjun Ni3-5/+13
- When deleting VIP member with flush, VPP will crash. - When deleting VIP member without flush, vpp won't crash. - This crash is almost 100% reproductive. Ticket: VPP-1680 Type: fix Change-Id: Ia4e8f9e0f987176c7f6ec52c92e66563f313b0c3 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2019-05-03plugins: clean up plugin descriptionsDave Wallace1-1/+1
- Make plugin descriptions more consistent so the output of "show plugin" can be used in the wiki. Change-Id: I4c6feb11e7dcc5a4cf0848eed37f1d3b035c7dda Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2019-03-22tests: update test_lb.py to use api call lb_conf.Paul Vinciguerra3-7/+16
Change-Id: I96a1d4b2b3ae22cf164c0acd6db9b323cd70f51a Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-07Add VAT support for LBHongjun Ni2-60/+179
Change-Id: I61d8c35f48a059968909fc8523bd313fc4799389 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2019-01-21Fix LB lookup table failed issueHongjun Ni1-5/+11
Change-Id: Icd21f456089c72c91a8328f963bf47a8c7725195 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2019-01-02Fixes for buliding for 32bit targets:David Johnson1-1/+1
* u32/u64/uword mismatches * pointer-to-int fixes * printf formatting issues * issues with incorrect "ULL" and related suffixes * structure alignment and padding issues Change-Id: I70b989007758755fe8211c074f651150680f60b4 Signed-off-by: David Johnson <davijoh3@cisco.com>
2018-10-23c11 safe string handling supportDave Barach1-1/+1
Change-Id: Ied34720ca5a6e6e717eea4e86003e854031b6eab Signed-off-by: Dave Barach <dave@barachs.net>
2018-10-19vppinfra: add atomic macros for __sync builtinsSirshak Das1-2/+2
This is first part of addition of atomic macros with only macros for __sync builtins. - Based on earlier patch by Damjan (https://gerrit.fd.io/r/#/c/10729/) Additionally - clib_atomic_release macro added and used in the absence of any memory barrier. - clib_atomic_bool_cmp_and_swap added Change-Id: Ie4e48c1e184a652018d1d0d87c4be80ddd180a3b Original-patch-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Sirshak Das <sirshak.das@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com> Reviewed-by: Steve Capper <steve.capper@arm.com>
2018-10-02VPP-1440: clean up coverity warningsDave Barach1-2/+3
Change-Id: Ic6823fb617ecae547a5f0e28b1e037848e40f682 Signed-off-by: Dave Barach <dave@barachs.net>
2018-09-24LB: fix flush flow table issueHongjun Ni5-69/+90
Change-Id: Ib0a06ab71aed42eb5bb2ab2edf4844b2167e0610 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2018-09-12Fix LB memory leak and remove useless codePierre Pfister1-11/+1
Vector sort_arr was actually never freed. This change also removes some nearby code which happens to be totally useless. Change-Id: I2f265c1b4770cbcd75a2fb69ea54e46e1b54245a Signed-off-by: Pierre Pfister <ppfister@cisco.com>
2018-09-07Add flush flag on del as commandHongjun Ni5-16/+164
This patch depends on https://gerrit.fd.io/r/#/c/13260 Change-Id: If94968342935ebd24cf4ebed238e6a27d94959b7 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2018-09-04Fixed showing negative count in stats show CLINaoyuki Mori1-2/+2
Some counters (bytes, pkts) are formatted as signed instead of unsigned in "show hardware-interfaces" and "show lb". These stats counters are declared as u64. Change-Id: Id1b588188bff4e36402beb8d07f779e9a5193956 Signed-off-by: Naoyuki Mori <naoyuki.mori@intel.com>
2018-08-31Support lb on both vip and per-port-vip caseHongjun Ni7-201/+735
Previously, a service is specified by vip. This patch extend that a service is specified by both vip and per-port-vip cases. Change-Id: Icbfd1f972c6bafde7d85c6abb498576bd9ba250d Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2018-08-27cmake: Fix plugins .h includesMohsin Kazmi1-0/+5
Change-Id: I90600d000afb02e8969f3c01bcf9e4b5c10a7d39 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-08-25cmake: handle api_test_plugins in add_vpp_plugin macroDamjan Marion1-3/+1
Change-Id: I76a1711af0a920cce66e6dfb07d019ba505d55b7 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-08-25cmake: improve add_vpp_plugin macroDamjan Marion1-3/+6
Change-Id: Iffd5c45ab242a919592a1f686f7f880936b68a1a Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-08-17CMake as an alternative to autotools (experimental)Damjan Marion1-0/+27
Change-Id: Ibc59323e849810531dd0963e85493efad3b86857 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-07-18VPP crash when run "lb set interface nat4 in <intc>" VPP-1343Hongjun Ni1-1/+1
Change-Id: I23be9c29227e7dd1bb11b5b7fa910bb61c2be6c9 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com> (cherry picked from commit b4b2488202ff4282cc4a7bd779cc33934286c5cd)
2018-07-11avoid using thread local storage for thread indexDamjan Marion1-1/+1
It is cheaper to get thread index from vlib_main_t if available... Change-Id: I4582e160d06d9d7fccdc54271912f0635da79b50 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-06-26L3DSR fix ip checksum issue and add testHongjun Ni1-9/+12
Change-Id: Iedebbac71d3e694b915d6a126c80ecc3b5473a4a Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2018-06-13Fix clang compilation on aarch64: extraneous parenthesesSirshak Das1-6/+16
Fixes clang error: equality comparison with extraneous parentheses Changing all the #defines to inlines. Change-Id: I30a931679ac3325b23b249b1ae28c7c8cf54b012 Signed-off-by: Sirshak Das<sirshak.das@arm.com>
2018-06-08LB: reply message id and table length are wrong.Hongjun Ni1-2/+2
Change-Id: Iea2c661cb3e0728bb2d10b06791ed84fed00f6a7 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2018-06-05lb api: correct byte order of new_flows_table_length argumentAndrey "Zed" Zaikin1-1/+1
Change-Id: I3ac348a8cb1a515dfe1839eaa084c87719d282e1 Signed-off-by: Andrey "Zed" Zaikin <zed.0xff@gmail.com>
2018-05-28add missing lb_put_writer_lock() to lb_vip_add() invalid args casesAndrey "Zed" Zaikin1-2/+7
Change-Id: I9343672c5765a5a4cb56c99fa5de176ddcac62c7 Signed-off-by: Andrey "Zed" Zaikin <zed.0xff@gmail.com>
2018-05-25bond: performance harvestingSteven1-21/+1
- hash is great. But it is a bit too slow for the DP. Use direct array indexing to quickly retrieve the slave interface. - the algorithm used by flow hash is great. But it is a bit too slow for the DP. Use l2_hash_hash() extracted from lb_hash.h which ECMP is using. It makes use of intrinsic crc32 instruction set. - shortcut modulo arithmetic when the operand is 2**x (where x up to 4) to avoid division instruction. - special case for link count == 1 in bond_tx_fn() - use clib_mem_unaligned to access data for the packet to avoid alignment error - Fix some typos for packet tracing. Change-Id: I8eae3ad497061c5473aa675ba894ee0211120d25 Signed-off-by: Steven <sluong@cisco.com>
2018-05-18Rework kube-proxy into LB pluginHongjun Ni8-425/+1772
Add support of NAT66 Change-Id: Ie6aa79078a3835f989829b9a597c448dfd2f9ea3 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2018-04-12Fixes for 'make UNATTENDED=yes CC=clang CXX=clang verify'Neale Ranns2-3/+3
Change-Id: I994649761fe2e66e12ae0e49a84fb1d0a966ddfb Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-03-06LB plugin: Fix Layer-4 checksum error in L3DSR.Yusuke Tatsumi1-0/+5
Though dst-IP address would be change in LB plugin with L3DSR method, layer-4 checksum would not be recomputed after this change. Related changes: - L3DSR: https://gerrit.fd.io/r/#/c/10203/ Change-Id: I98de7b8d80186ac77608a68050208c08d90b7c3b Signed-off-by: Yusuke Tatsumi <ytatsumi@yahoo-corp.jp>
2018-02-02Add L3DSR feature in LB pluginHongjun Ni8-88/+246
L3DSR is used to overcome Layer 2 limitations of Direct Server Return Load Balancing. It maps VIP to DSCP bits, and reuse TOS bits to transfer it to server, and then server will get VIP from DSCP-to-VIP mapping. Please refer to https://www.nanog.org/meetings/nanog51/presentations/Monday/NANOG51.Talk45.nanog51-Schaumann.pdf Change-Id: I403ffeadfb04ed0265086eb2dc41f2e17f8f34cb Signed-off-by: Hongjun Ni <hongjun.ni@intel.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>
2017-12-16Use crc32 wrapper (VPP-1086)Gabriel Ganne1-6/+6
This allows arm platforms to also take advantage of crc32 hardware acceleration. * add a wrapper for crc32_u64. It's the only one really used. Using it instead of a call to clib_crc32c() eases building symmetrical hash functions. * replace #ifdef on SSE4 by a test on clib_crc32c_uses_intrinsics. Note: keep the test on i386 * fix typo in lb test log Change-Id: I03a0897b70f6c1717e6901d93cf0fe024d5facb5 Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>
2017-12-06Restructure some files in LB to src/vnet to reuseHongjun Ni3-109/+1
Change-Id: Ic8b193e93ce18ca82b294816aa7ee0ef31d64bc2 Signed-off-by: Pierre Pfister <ppfister@cisco.com> Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2017-10-31lb plugin tests - wipe flowtable after each unit testGabriel Ganne1-0/+38
Add new cli api: "test lb flowtable flush" which flushes everything. Call this new cli function after the end of each lb unit test. Change-Id: I71d04a7bfba398f7d4dd9cc3ed24bba786943663 Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>
2017-10-16lb plugin - fix format() type mismatchesGabriel Ganne1-2/+3
* (vip - lbm->vips) is u64; change format from [%u] to [%lu] * vip->plen is u8, but format looks for u32; add exlicit cast (this cast was done implicitely) On ARM platforms, these prevent a loop in the second call to format_white_space() which would get an invalid (huge) indent value; the result *looked like* an infinite loop. Change-Id: I675ef2f98e4ba3d9e8aef12022d38b1d22981da8 Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>
2017-10-09vppapigen: support per-file (major,minor,patch) version stampsDave Barach1-0/+2
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>