summaryrefslogtreecommitdiffstats
path: root/vlib
AgeCommit message (Collapse)AuthorFilesLines
2016-08-12VPP-237: indent fixes in prep for checkstyleEd Warnicke10-99/+121
Ran indent *twice* Change-Id: If9c18b81983bb859cc8dc3b415c67cbf318fc618 Signed-off-by: Ed Warnicke <eaw@cisco.com>
2016-08-12VPP-223 Add doxygen tags to counter.hDave Barach1-58/+118
Change-Id: Ifddf37db04b2ecfa7b470cd52e8eaa2211823f3d Signed-off-by: Dave Barach <dave@barachs.net>
2016-08-11VPP-223 Document vlib cooperative multi-tasking threadsDave Barach2-2/+173
Change-Id: I283963b004ed6d91133e7e36811f75834280bbe7 Signed-off-by: Dave Barach <dave@barachs.net>
2016-08-10VPP-189 Fix coverity warningsDave Barach1-0/+1
Change-Id: Iea6d338e60a95f7f30c10c2e751d4827e816f700 Signed-off-by: Dave Barach <dave@barachs.net>
2016-08-09VPP-189 Fix Coverity warningsDave Barach2-5/+12
Remove a bunch of historical SMP code that we're not using; clean up coverity warnings as a side-effect. Change-Id: Ic80d2f87c7fd4e654078cac23ad5ec287a1d7ffe Signed-off-by: Dave Barach <dave@barachs.net>
2016-08-05vpp-189 Clean up more coverity warningsDave Barach1-1/+1
Time to make the donuts Change-Id: I528937800f7daefce19723dda0216e58d857942c Signed-off-by: Dave Barach <dave@barachs.net>
2016-08-03VPP-180 Clean up multi-socket / multi-chunk mempool discoveryDave Barach1-5/+73
Change the default DPDK version to 16.07, and rename the indicated patch directory. Use the native vhost-user driver. Change-Id: Ie3d17e90e363ce86f0233b58c152de683b5d9456 Signed-off-by: Dave Barach <dave@barachs.net>
2016-07-27VPP-189 coverity warning cleanupsDave Barach7-14/+35
Change-Id: Ia4fbf4352119504e022b89d10d44a5259d94f316 Signed-off-by: Dave Barach <dave@barachs.net>
2016-07-26VPP-223 General documentation updatesChris Luke1-17/+17
Per the TWS session... - Some simple treatment of the contents of pool.h - Changing some \brief commands to @brief. (will do a more complete pass at this later.) Change-Id: I050ee69c59c4b572ac295b5f86940b7f4c934cd9 Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-07-26Fix coverity warningsDave Barach1-2/+5
Change-Id: I37131f2d814a608fe9098daff83ff395f7ce99d7 Signed-off-by: Dave Barach <dave@barachs.net>
2016-07-22Add DPDK 16.07 support (rc3 based)Damjan Marion1-0/+5
DPDK vhost-user support is disabled due to significan changes in the DPDK vhost-user code which are not compatible with current VPP code. Change-Id: I3f0d28cb75f6370282ec7e33d57cbfb77e1a3ce1 Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-07-13VPP-189 Addtional fixes for last coverity fix in linux_pci.cJohn Lo1-8/+4
Fix VPP startup problem where it cannot attach to a combination of 3 Intel igb 1GE ports and 2 Intel ixgbe 10GE ports whose PCI addresses are specified in the DPDK section of VPP startup config file as follows: dpdk { dev 0000:02:00.1 dev 0000:02:00.2 dev 0000:02:00.3 dev 0000:05:00.0 dev 0000:05:00.1 } Change-Id: Ibb12f9e9a9184d00da51a49961772ac3a42a2d1d Signed-off-by: John Lo <loj@cisco.com>
2016-07-12Show cli for plugin path, name filter and loaded pluginsShwetha Bhandari1-0/+32
Change-Id: If6ab5f08bcdcf5e24bb8b31926894d2a56cb6c14 Signed-off-by: Shwetha Bhandari <shwethab@cisco.com>
2016-07-08fd-io-styleify passDave Barach64-7913/+9475
Change-Id: If2d57a213fc2fec996db26df332910c3d2105f97 Signed-off-by: Dave Barach <dave@barachs.net>
2016-07-08Remove unnecessary and obsolete configure.ac directivesDamjan Marion1-1/+0
Also enable silent rules where missing Change-Id: Ia521886815c862b013f01df4cc18fd8a298aaaa1 Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-07-08VPP-189 Some bugfixes for issues reported by CoverityChris Luke1-6/+29
CID 130914 Buffer not null terminated CID 130916 Unchecked return value CID 130938 Unchecked return value from library CID 130939 Unchecked return value from library CID 130940 Unchecked return value from library CID 131042 Argument cannot be negative CID 131222 Resource leak CID 131223 Resource leak CID 131334 Double close CID 131335 Read from pointer after free CID 131211 Resource leak CID 131212 Resource leak Change-Id: Idd80b91f621278e0be15911f2ed4354dbe4fc7f2 Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-07-07Remove #if DPDK == 0, to eliminate a data structure size mismatchDave Barach1-2/+2
Otherwise, e.g. the ip4/6_main_t's change size between PLATFORM=vpp and PLATFORM=vpp_lite. That, in turn, makes it far easier to build broken plugins. Change-Id: Ic962d75b170eee698de29c4e29849ce73d27caad Signed-off-by: Dave Barach <dave@barachs.net>
2016-07-07Remove duplicate code buffer_func.hDamjan Marion1-4/+0
Change-Id: I57e442b1f3486c5e8caac9d2e288869ee10f37b8 Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-07-07Add some doxygen tagsDave Barach2-1/+139
Also add an index of node names Change-Id: Id65c2e607976d8bad73deb738035a471be077196 Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-06-29Decouple worker thread code from dpdk, enable worker threads in vpp_liteDamjan Marion5-54/+584
Change-Id: I28616f1a89f2da95484438ec1a1db64845f15ef6 Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-06-18Move pkt replication counter to the opaque2 cache lineDave Barach3-14/+16
Change-Id: I5e6edfd03ab41949be2c768dfe68aa824bbc1f38 Signed-off-by: Dave Barach <dave@barachs.net>
2016-06-17Dynamically compute ip feature subgraph orderDave Barach1-7/+7
This change-set enables plugins to add themselves to the ip4/ip6 feature subgraphs without having to modify core vpp engine code at all. Add VNET_IP4/IP6_UNICAST/MULTICAST_FEATURE_INIT macros which express the required ordering constraints, and off you go. Along the way, added an implementation of Warshall's algorithm to vppinfra; to compute the positive transitive closure of a relation. In this case, the relation is "feature A runs before feature B." With that in hand, ip_feature_init_cast(...) computes a partial order across the set of configured feature subgraph nodes. In unit-testing, we discovered VPP-145 - ip4/6 inacl wiped out vnet_buffer(b)->ip>current_config_index, which exists in main. So, we fixed that by moving b->trace_index, adding b->current_config_index, and removing the ip opaque union current_config_index. Change-Id: Iff132116f66413dc6b31ac3377198c7a32d51f48 Signed-off-by: Dave Barach <dave@barachs.net>
2016-06-156rd: Move to pluginOle Troan1-3/+8
- Change toplevel plugins make target. Now builds all plugins under plugins/. (Apart from sample-plugin). - Move sixrd code to plugins directory and make necessary changes to make it a plugin - Remove 6rd hooks from IP lookup code Change-Id: I447e92e3bee240cd8de01d0abac2e1708e8c27d1 Signed-off-by: Ole Troan <ot@cisco.com>
2016-06-14Fix node siblingsOle Troan2-51/+44
Siblings did not work at all. Fixed by generating sibling relationships earlier in vlib_node_main_init(). Also adding a node dynamically before nodes were initialised failed for sibling nodes. Change-Id: I2fb73eb33a6f5ee216f566074e18ed495e20634d Signed-off-by: Ole Troan <ot@cisco.com>
2016-06-14Retire io threads and main-thread-io modeDamjan Marion2-6/+1
Change-Id: I64f5ec5e32f200834c63ec3b304f9f20cef332a7 Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-06-09VPP-133: increase size of cli process stacksDave Barach1-1/+1
Change-Id: Ic488b95b54438028940403b02a5916347c53bd05 Signed-off-by: Dave Barach <dave@barachs.net>
2016-06-09Add verbose flag for packet trace, show hexdump in verbose dpdk input traceDamjan Marion2-5/+15
Verbose trace can be enabled with: trace add dpdk-input 1 verbose Change-Id: If58cfc561143d5a44f7d11e61d54b6835692a0e3 Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-06-05Add per-device startup config supportDamjan Marion2-1/+3
This change adds support for providing per-interface parameters in the startup config. Sample configuration: dpdk { dev default { num-rx-queues 3 num-tx-queues 3 } dev 0000:02:00.0 { num-rx-queues 2 num-tx-queues 2 } dev 0000:02:00.1 } Change-Id: Ia7d9ae2ac9c4fd9baaa480d061a395f8a421a722 Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-06-01VPP-83 Allow non-privileged clients to use the vpp binary API.Dave Barach1-3/+6
Use the command line argument "api-segment { uid <nnn> gid <nnn> }" to configure shared memory segment file ownership. Defaults to uid = gid = 0. Shared-memory segments are explicitly set to 0770 mode, aka "rwxrwx---". Change-Id: Ic5d596b68139add61e7de6ace035c57dfd030111 Signed-off-by: Dave Barach <dave@barachs.net>
2016-05-23Native VPP driver for Intel Niantic family of NICsDamjan Marion6-0/+292
Available only in vpp_lite platform Change-Id: I09d112af5f7f4521ec25196ecdd8c02c20eedd5f Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-05-21Add per-thread, per-node runtime stats serializationDave Barach2-0/+4
Change-Id: Ic4009cdbac67b7cd53c88079439496b9d9dfaa35 Signed-off-by: Dave Barach <dave@barachs.net>
2016-05-19VPP-74 Fix signedness issue when terminal resizesChris Luke1-4/+9
When re-locating our current viewport into the pager buffer we need to verify that the new viewport is within the boundaries of the index. This condition is considered very rare, but nontheless the check is needed. Unfortunately I assumed the variable was signed; it is not, and the subtraction can in some cases cause the value to be negative. This is therefore a bonafide semantic error that may cause problems. This patch reworks the logic to avoid having to change it to be signed. Change-Id: I26f0747d38dcc43dd9c092d50f2489b122009e7b Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-05-19Remove unused PCI codeDamjan Marion1-7/+0
Change-Id: I1d91c9982823758059f9d6aa699982253930e7ba Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-05-19Add support for multiple microarchitectures in single binaryDamjan Marion1-0/+27
* compiler -march= parameter is changed from native to corei7 so code is always genereted with instructions which are available on the Nehalem microarchitecture (up to SSE4.2) * compiler -mtune= parameter is added so code is optimized for corei7-avx which equals to Sandy Bridge microarchitecture * set of macros is added which allows run-time detection of available cpu instructions (e.g. clib_cpu_supports_avx()) * set of macros is added which allows us to clone graph node funcitons where cloned function is optmized for different microarchitecture Those macros are using following attributes: __attribute__((flatten)) __attribute__((target("arch=core-avx2))) I.e. If applied to foo_node_fn() macro will generate cloned functions foo_node_fn_avx2() and foo_node_fn_avx512() (future) It will also generate function void * foo_node_fn_multiarch_select() which detects available instruction set and returns pointer to the best matching function clone. Change-Id: I2dce0ac92a5ede95fcb56f47f3d1f3c4c040bac0 Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-05-18Rework of the old PCI codeDamjan Marion10-335/+473
* adds support for VPP native PCI drivers using standard uio_pci_generic kernel driver * adds generic PCI interrupt callback * splits code to generic PCI handling and linux specific * adds new debug cli 'show pci [all]' Change-Id: I447c2285e319e9725d70688c1b70c9dedda51fdc Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-05-17dpdk/build - 32bits compilationChristophe Fontaine1-1/+1
In vnet/vnet/devices/dpdk/device.c, post 2 event data instead of merging them into 1 u64. Change-Id: I8b1d61b894279fb6eb57bb82a05affc14360e6b8 Signed-off-by: Christophe Fontaine <christophe.fontaine@qosmos.com>
2016-05-16VPP-23 Re-work pager line collationv16.09-rc0Chris Luke1-88/+364
To better handle lines longer than the terminal width, re-work how the pager collates lines. We still store each output line in a vector or lines; additionally we index the start and end of displayable lines. The index then becomes the data to work out what to display. If the terminal is resized this index is rebuilt and the current page redisplayed and an attempt made to keep the current top-of-screen line in place. Change-Id: Icc6f4f72dabad89682cd82be88adb03eadb7811d Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-05-16VPP-57 Add missing license headers in doc filesChris Luke3-0/+48
Change-Id: Icd1f8952f66d3cee027c59f3148c67f1839de306 Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-05-13VPP-57 Add Doxygen to VPPChris Luke4-51/+141
- Configures Doxygen. - Adds a source filter to do magic on our use of the preprocessor to do constructor stuff to make Doxygen grok it better. - Adds a convenience helper to the root Makefile. - Adds a README.md to the root directory (and which Doxygem uses as its "mainpage". - Add several other documentative files. - Currently using SVG for call graphs, though this may have a load-time performance impact in browsers. Change-Id: I25fc6fb5bf634319dcb36a7f0e32031921c125ac Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-05-10VPP-46 Fix cut-and-paste in the debug CLIChris Luke1-38/+46
Since the move to line-mode the debug CLI was eating everything in the input_vector but only processing upto the first newline. Cut-and-paste type operations generally send a large block of input with multiple newlines and thus all but the very first line were simply ignored. This patch fixes that and also cleans up the difference between input_vector and current_command which in turn removes a lot of cruft from the keystroke parser. Previously current_command was just the character accumulator inside the char-by-char keystroke parser; complete commands were copied back to input_vector (overwriting anything already in there). Now, in char-by-char mode: - input_vector is the stream of incoming bytes yet to be processed - current_command is the accumulated characters of the next command to be executed; once newline is found, it is the complete command to be executed. In line mode: - input_vector and current_command are the same thing. Change-Id: I72d21f0f3508b413879071ab186a71cef1124a2b Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-05-10Avoid clobbering output_function by concurrent CLI sessions doing ↵Andrew Yourtchenko4-17/+63
vlib_process_wait_for_event*. A problem is easily reproducible by taking the test harness code from the commit, and launching it in two terminals with some time overlap - the outputs will be sent to the wrong session. This commit moves the output_function and argument from a global structure into the process structure, thus the output_function is not clobbered anymore and each session gets only its own output. To ensure the callers can redirect the outputs to different destinations (e.g. the API calls via shared memory, etc.) the existing logic for vlib_cli_input() was retained. To avoid the magic numbers usage in the logic that does the page-alignment of the process stack, there are changes around the stack[] member of vlib_process_t. Also added a compile-time assert to ensure that the stack does indeed start on the page size multiple boundary. Change-Id: I128680ac480735e5f214f81a884e414268e5d652 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2016-04-29VPP-26 Iterate through empty command line in cli historyChris Luke1-10/+24
When cursoring through the command history in the CLI, when you reach the end of the history (ie, back at "where you started") most CLI's typically show a blank line. This is a visual cue that you are back where you started. Change-Id: I5733dbd0dcdc6deac6a0a856cfadbdb987456ec0 Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-04-29VPP-27 Extend telnet protocol buffer guardChris Luke1-1/+1
With Telnet protocol overhead, the string "xterm-256color", which is the norm when the terminal is iTerm on a Mac, is longer than the 16 byte lookahead overflow guard in the Telnet protocol processor. This extends it to 24 bytes. This guard is designed to encourage the protocol processor to quit waiting for bytes indefinitely if those already in the buffer do not form a complete message. Whilst this is unlikely, extending the guard length would mean more bytes need to be received before it gives up. Change-Id: Ibaa3d35b78bfd298fe0e4f4c6e508440f122e916 Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-04-29Clean up per-thread mheap setup.Dave Barach1-22/+22
The stats thread was sharing the main mheap when we started at least one worker or I/O thread, but ran on its own mheap when we started 0 worker + io threads. Net of this change; if a VLIB_REGISTER_THREAD instance specifies a per-thread mheap, a per-thread mheap will be provided. Otherwise, threads share the main heap. The stats thread now uses the main heap. Simpler is better. Change-Id: I1fff0dd66ae8f7dfe44923f702734e2832b55b09 Signed-off-by: Dave Barach <dbarach@cisco.com>
2016-04-28Track number of ethernet vlans in a frameChris Luke1-2/+1
Adds flags to the packet buffer to track the number of VLANs in the current Ethernet frame. We use two bits to signify 0, 1 or 2 VLANs. The value 3 signififies an unknown quantity of VLANs, which includes "three or more" which is not widely supported. We place the bits in the vlib_buffer section; that is not the opaque section, so that all subordinate nodes can use it. For background, see the discussion thread at https://lists.fd.io/pipermail/vpp-dev/2016-March/000354.html The helper macro ethernet_buffer_header_size(buffer) uses these bits stored in "buffer" to calculate the Ethernet header size. The macro ethernet_buffer_set_vlan_count(buffer, count) sets the appropriate bit values based on the number in "count". By current frame we are referring to the case where a packet that arrives from the wire is carrying an encapsulated Ethernet packet. Once decapsulated that inner packet becomes the current frame. There are two places where this value is set; For most Ethernet frames this will be in the "ethernet-input" node when that node parses the Ethernet header. The second place is whenever vnet_update_l2_len() is used to update the layer 2 opaque data. Typically this function is used by nodes just before they send a packet into l2-input. These bits are zeroed in vlib_buffer_init_for_free_list() meaning that wherever the buffer comes from they have a reasonable value (eg, if ip4/ip6 generates the packet.) Primarily this VLAN counter is used by nodes below "ethernet- input" and "l2-input" to determine where the start of the current Ethernet header is. There is opaque data set by "ethernet-input" storing the offset of the current Ethernet header but, since this is opaque, it's not usable by downstream nodes. Previously several nodes have made assumptions regarding the location of the Ethernet header, including that it is always at the start of the packet buffer (incorrect when we have encapsulated packets) or that it is exactly sizeof(ethernet_header_t) away (incorrect when we have VLAN tags.) One notable case where this functionality is required is in ip6_neighbor when it generates a response to a received neighbor soliciation request; it reuses the incoming Ethernet header in-situ and thus needs to reliably know where that header begins. Also, at the suggestion of Dave Barach, this patch removes definition of HGSHM bits in the buffer flags since they are unused and unlikely to ever be. Change-Id: I00e4b9ced5ef814a776020c395d1774aba6185b3 Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-04-27CLI output pagerChris Luke3-85/+744
Buffers output from CLI commands as it arrives and allows the terminal to view this buffer one page at a time. - View of the buffer is moved with space/enter/up/down/page-up/page-down/ home/end. - At the end of the CLI command if less than one page of output was generated then the pager is not engaged. - 'q' to quit the pager, or scroll off the bottom. - Pager prompt displays the current view aperture line numbers and total number of lines buffered. - Can be disabled at runtime with "no-cli-pager" in the unix configuration. - The number of lines that will be stored in the buffer is limited to prevent excessive memory use; this limit is configurable with "cli-pager-buffer-limit" in the unix configuration. - Both these options can also be set in the console with "set terminal pager [on|off] [limit <lines>]". Limitations: - Does not yet implement a search function. - Whilst the terminal size is detected and tracked, changing the terminal size when the pager is being used will not cause a redraw of the page. - Lines that wrap the right most column are not yet handled gracefully. Change-Id: I69548c1464eff79c53e122668f25758266daf1c2 Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-04-27Add "history" CLI commandChris Luke1-24/+48
- Remove the '?' mechanism that previously only worked on telnet connections in favor of a more shell-like "history" command. The '?' approach had strange side-effects, like executing what was already in the command buffer. Change-Id: I043086b7f400c66c332a32dbd06ef580ecb18ee8 Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-04-27Add a (small) banner to the Debug and Telnet CLIChris Luke3-2/+65
_______ _ _ _____ ___ __/ __/ _ \ (_)__ | | / / _ \/ _ \ _/ _// // / / / _ \ | |/ / ___/ ___/ /_/ /____(_)_/\___/ |___/_/ /_/ - For terminals that look like they support ANSI output the FD.io part is colored red. - This is only shown at the start of a debug CLI or a telnet CLI session. - This banner can be disabled with "cli-no-banner" in the "unix" section of the startup config file. Change-Id: I085b3780dcca3eae546859dbde6c1c34c8258b9f Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-04-27Debug/Telnet CLI enhancementsChris Luke2-222/+1063
A fairly comprehensive re-work of the built-in debug and telnet CLI to add various command line editing features and to add command history to the debug CLI. This may seem like a large change but a good amount of it is merely reworking the existing CLI code (which changed its indent level). The features this patch enables include: - Enable history in the debug CLI. - Put both stdin and telnet connections in char-by-char mode. - Echo from the server, not the client, for more control. - Add a mostly no-op but fairly complete Telnet protocol processor. - Perform control code parsing on the input byte stream to match strings of both control codes and ANSI/VT100 escape sequences. - Up/down keys scroll through the history (like ^P/^N). - Do CRLF output cooking (\n -> \r\n) for connections that need it. - Left/right cursor movements, insert/erase at cursor. - Home/end cursor jumps. - Jump left/right word at a time (Ctrl-left/right). - Negotiate the terminal type from Telnet clients. (well, the code doesn’t really negotiate, it demands it, but the client is led to believe it was a negotiation) - Read terminal type from TERM variable for the local debug CLI. - Delete from cursor to end of line (^K). Delete char-right (^D/Del). - Clear screen (^L) and repaint prompt/current command (on non-ANSI terminals it just newlines and repaints the line). Change-Id: Id274b56ccfd4cc8c19ddc0f478890f21f284262a Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-04-26Make automake silent rules defaultDamjan Marion1-1/+1
Change-Id: Ia504ccdac1deac20f20cf7fb76f78b2d8c505474 Signed-off-by: Damjan Marion <damarion@cisco.com>