aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
AgeCommit message (Collapse)AuthorFilesLines
2019-12-05classify: vpp packet tracer supportDave Barach3-1/+58
Configure n-tuple classifier filters which apply to the vpp packet tracer. Update the documentation to reflect the new feature. Add a test vector. Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Iefa911716c670fc12e4825b937b62044433fec36
2019-11-27vlib: add 'wait' cli commandPaul Vinciguerra1-0/+40
When running exec scripts, there can be a need to wait between statements. Type: feature Change-Id: I2a45b390697e09fc222358c9354f28e3368a06ba Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-11-27misc: add address sanitizer heap instrumentationBenoît Ganne2-4/+4
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-11-26misc: add gdb helpers for vlib buffersBenoît Ganne1-0/+7
Type: feature Change-Id: I7e619040857310fffd33c355f6c491a55f7a4a02 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-11-20vlib: improve code coverage, part deuxDave Barach2-29/+0
Type: test Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: If31f4b50da7a6e4a9704ceb3415c582143c08355
2019-11-20vlib: pci: fix non-NULL terminated C-stringBenoît Ganne1-2/+2
Type: fix Change-Id: I6f25d9295b973ab7133071b6dc325ecd86386898 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-11-18session: Increasing the Header lengthe sizeSrikanth Akula1-1/+0
Type: feature For some deployments(mobile traffic) we need few extra bytes of space Signed-off-by: Srikanth Akula <srakula@cisco.com> Change-Id: I3367561dc23dbb8b266dea583e23b9430fd7dcab
2019-11-11vlib: fix handoff queue sequencing bugDave Barach1-1/+2
Set vm->check_frame_queues after actually enqueuing a frame. Under obscure circumstances, the code managed to set check_frame_queues so far in advance that 100 dispatch cycles could elapse before the frame enqueue succeeded. That resulted in permanent lack of queue service. Type: fix Ticket: VPP-1734 Fixes: 18191 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: If2d398202b4ba2b96581d25e8142daef3f74c9e5
2019-11-04vlib: fix for vlib_node_add_next_with_slotChristian Hopps1-1/+10
- vlib_node_add_next_with_slot was not cleaning the old next node references to the given slot when replacing it with new next node. This mostly worked until one tried to set the slot to a previously (but not currently) used next node for that slot. Type: fix Signed-off-by: Christian Hopps <chopps@labn.net> Change-Id: I7ee607625da874e320158b80f12ddc16e377f8e9
2019-11-02vlib: enhance the "show cli" debug CLI commandDave Barach2-49/+209
Dump the entire CLI, mp-safe commands, non-mp-safe commands, commands which have been executed. Optionally, clear the hit counters. Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Ie38fc664b7deaabc35ca35be68db7e159272f551
2019-11-01vlib: Handle race in thread barrier processingAlexander Kabaev1-1/+1
When CLIB_DEBUG is enabled, vlib_foreach_main macro asserts that vlib_main it currently looks at is safely parked in barrier, by checkling that vlib_main->parked_at_barrier is not 0. Unfortunately, the check is racy - workers first increment the atomic counter to indicate that they have reached the barrier and _then_ set this_main->parked_at_barrier to 1. For the last worker to suspend this opens the race - main thread is free to execute and assert immediately after atomic counter has been incremented, before worker gets to write to own parked_at_barrier. Fix this by simply swapping the order of two operations. Type: fix Signed-off-by: Alexnader Kabaev <kan@FreeBSD.org> Change-Id: Iae47abd6ca0be1c5413f5ecaefabc64cd7eac2ed
2019-10-31vlib: only dump 1st buffer in chain by defaultBenoît Ganne3-4/+15
Several nodes include buffers in their traces, but only the 1st. When formatting the trace we must not try to iterate through all chained buffers. Default to display only the 1st buffer. Type: fix Change-Id: Ib3c668bbf4ab70ae68eba2ac402c7b7329825b70 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-10-30vlib: fix subclass name being truncated in outputPaul Vinciguerra1-1/+1
Type: fix Change-Id: I50816cca4eb88f58209138a348fc5954ab835f5b Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-10-30vlib: Trivial - fix typo in short helpPaul Vinciguerra1-1/+1
Type: fix Change-Id: Ifada594088984291ce2e79da0bbbbd1f500640c9 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-10-28vlib: don't use vector for keeping buffer indices in the poolDamjan Marion3-35/+57
Type: refactor Change-Id: I72221b97d7e0bf5c93e20bbda4473ca67bfcdeb4 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-10-28vlib: unix trivial- clean up typos in docsPaul Vinciguerra1-2/+2
seen while reading through the code. Type: style Change-Id: I7a2f021b9f06d0eebb2ea3d0cafb6955ccb14781 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-10-25mdata: buffer metadata change tracker pluginDave Barach1-8/+11
A handy tool in case you need to know which metadata will be changed when a packet visits a certain node. Reflect metadata changes into format functions used by the vpp-specific wireshark dissector. Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I96fe8a24db4082bb29fe2a33cc522e8616a3a1bb
2019-10-20vlib: linux: fix wrong iommu_group value issue when using dpdk-pluginYulong Pei1-22/+19
When VPP work with dpdk-plugin, linux_vfio_main_t->container_fd is always -1 since it never have chance to run open("/dev/vfio/vfio") to get the fd. But this lead to a potential issue of VPP, that is, when start VPP without uio-driver field setup in /etc/vpp/startup.conf, VPP will run to automatical select uio driver in vlib_pci_bind_to_uio() and the function depend on iommu_group value to decide to work on vfio or vfio-noiommu mode. Since in vlib_pci_get_device_info() have the condition container_fd != -1, so the iommu_group value will be always -1 at this scenario, this caused that VPP mistake to run with vfio-noiommu driver on intel_iommu=on state. Actually in order to get iommu_group and iommu_group/name value, no need to depend on linux_vfio_main_t->container_fd value, so the fix remove the condition lvm->container_fd != -1, then it can get the correct iommu_group value. Type: fix Change-Id: I3f162fc4971b9a2b8717205f8f3b52e30c5e5b69 Signed-off-by: Yulong Pei <yulong.pei@intel.com>
2019-10-18vlib: enable worker-thread dispatch pcap traceDave Barach1-3/+7
Needed a bit of foreach_vlib_main(...) action to turn on/off all instances of vm->dispatch_pcap_enable, and to pick up the pcap_main_t pointer from vlib_global_main. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I49b69b87934c7dc7a9835cd07aa2c5c4d3c79f18
2019-10-08vlib: fix cli process stack overflowChenmin Sun1-1/+1
Type: fix Some cli processes, including configuring an test flow on an i40e interface consume more than the currently available stack space. Signed-off-by: Chenmin Sun <chenmin.sun@intel.com> Change-Id: I3df53d251cd43286f94647384d6e50a463bad15c
2019-10-07vlib: move thread barrier around mod of global node next dataChristian E. Hopps1-6/+5
The old code modified the node next array prior to obtaining the thread barrier. Then it updated the runtime node data, and upon barrier release caused reforking of each worker thread. The reforking clones the main thread nodes and reconstructs the runtime node structure. This cloning is not 100% "deep" in the sense that the node next array is shared (i.e., only the pointer is copied). So prior to the barrier being obtained the node's next array is being changed while workers are actively using it (bad). Treating the node next array as read-only in the workers and sharing it is a decent optimization so instead of trying to fix that just move the barrier a little earlier in the process to protect the node next array as well. This was tripping an assert in next frame ownership change by way of the ip4-arp node. The assert verifies that the node's next array length is equal to the runtime next node count. The race above was lost and the node next array data was updated in the main thread while the arp code was still executing in a worker. This was being hit when many arp requests were being sent from both ends of a tunnel during which the add next node function was called, which often led to an assert b/c the next node array was out of sync with the runtime next node count. - PS#2 update - move barrier sync to just above code that modifies state. Ticket: VPP-1783 Type: fix Signed-off-by: Christian E. Hopps <chopps@chopps.org> Change-Id: I868784e28f994ee0922aaaae11c4894a3f4f1fe7 Signed-off-by: Christian E. Hopps <chopps@chopps.org>
2019-10-05misc: add "show run summary"Dave Barach1-11/+19
Prints the interior node vector rate, rx / tx / drop rates Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I57130db0f99e852a8498aa90d01e52f7ac33dcc9
2019-10-05vlib: pci: set pci driver name to none when no driver is loadedBenoît Ganne1-0/+2
If no Linux PCI driver module is loaded, then the driver_name in the PCI info struct is NULL. This can triggers crash when checking driver name eg. in vlib_pci_device_open(). Default to "<NONE>" as driver name, which should never match. Type: fix Change-Id: I9e69889a7566467bd8220b92bbbaa72ada957257 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-10-02vlib: improve summary vector-rate statisticsDave Barach4-78/+54
Type: refactor Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I4b77879b0a84fdec3c1518a972cf003d5135222d Signed-off-by: Ole Troan <ot@cisco.com>
2019-09-30vlib: fix old nodes vector overflow in reforkBenoît Ganne1-5/+2
Type: fix Change-Id: I81c4cf0ce87288bb2d3c7b9f31e9419290d588b4 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-09-24vlib: add flag to explicitelly mark nodes which can init per-node packet traceDamjan Marion3-0/+14
Type: feature Change-Id: I913f08383ee1c24d610c3d2aac07cef402570e2c Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-09-23misc: unify pcap rx / tx / drop traceDave Barach1-2/+9
Use a single vnet_pcap_t in vlib_global_main, specifically to support unified tracing Update sphinx docs, doxygen tags Type: refactor Ticket: VPP-1776 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Id15d41a596712968c0714cef1bd2cd5bc9cbdd55
2019-09-23interface: use the correct condition for checking if the pcap fd is openAndrew Yourtchenko1-1/+1
The 9af7e2e87e used a comparison that fd is >= 0 to check that the pcap needs closing. While the pcap_close() function does reset the file descriptor to -1, the freshly initialized structure has it equal to 0. This causes the VPP to close stdin if the packets are being seen on pg interface without the capture file being opened. This triggers the vpp attempting to read from STDIN (another bug), which results in running out of memory. Change-Id: I11d61422701500a9b3e0dd52d59383f297d57f54 Type: fix Fixes: 9af7e2e87e Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2019-09-20misc: classifier-based packet trace filterDave Barach1-0/+1
See .../src/vnet/classify/trace_classify.h for the business end of the scheme. It would be best to hash pkts, prefetch buckets, and do the primary table lookups two at a time. The inline as given works, but perf tuning will be required. "At least it works..." Add "classify filter" debug cli, for example: classify filter mask l3 ip4 src dst \ match l3 ip4 dst 192.168.2.10 src 192.168.1.10 Add "pcap rx | tx trace ... filter" to use the current classify filter chain Patch includes sphinx documentation and doxygen tags. Next step: device-driver integration Type: feature Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I05b1358a769f61e6d32470e0c87058f640486b26
2019-09-17vlib: fix cli process stack overflowAloys Augustin1-1/+1
Some cli processes, including bringing up an i40e interface with dpdk, consume more than the currently available stack space. Type: fix Fixes: VPP-1774 Signed-off-by: Aloys Augustin <aloaugus@cisco.com> Change-Id: I86ceb9e6e07523d5e0f760b5922467f09a8d4006
2019-09-16vlib: cli support ctrl-w to erase left wordHiroki Shirokura1-0/+47
Type: fix Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com> Change-Id: I3ae7dc3858d0353764d629d6a9eff2bdab5f8768
2019-09-10misc: clean up "pcap [rx|tx] trace" debug CLIDave Barach1-1/+1
Separate debug CLI arg parsing from the underlying action function. Fixes a number of subtle ordering dependencies, and will allow us to add a binary API to control the feature at some point in the future. Type: refactor Ticket: VPP-1770 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: Id0dbeda06dad20e756c941c691e2088ce3c50ec7
2019-09-07vlib: clean up the "pcap dispatch trace" debug CLIDave Barach2-138/+183
Separate debug CLI arg parsing from the underlying action function. Fixes a number of subtle ordering dependencies, and will allow us to add a binary API to control the feature at some point in the future. Type: refactor Ticket: VPP-1762 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I1240fe3f61a0acf5ee9faed60d6ad3386e72e569
2019-09-07ip: fix udp/tcp checksum corner casesDave Barach1-0/+17
When checksumming chained buffers with odd lengths: insert a NULL byte, or the calculation fails. Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Signed-off-by: John Lo <loj@cisco.com> Change-Id: I380f7c42897bdb28c8c29aa1c4cdaaa849cc9ecc
2019-09-03tap: fix tap interface not working on Arm issueLijian.Zhang2-1/+7
The VPP code tries to set all userspace memory in the table via IOCTL to VHOST_SET_MEM_TABLE. But on aarch64, the userspace address range is larger (48 bits) than that on x86 (47 bits). Below is an segment from /proc/[vpp]/maps. fffb41200000-fffb43a00000 rw-s 00000000 00:0e 532232 /anon_hugepage (deleted) Instead of setting all userspace memory space to vhost-net, will only set the address space reserved by pmalloc module during initialization. Type: fix Change-Id: I91cb35e990869b42094cf2cd0512593733d33677 Signed-off-by: Lijian Zhang <Lijian.Zhang@arm.com> Reviewed-by: Steve Capper <Steve.Capper@arm.com>
2019-09-02ipsec ip tcp l2: multiarch nodes cannot be declared as staticDamjan Marion1-0/+1
Credits to ray.kinsella@intel.com who spotted the issue and identified root cause. Type: fix Change-Id: I4afe74c47769484309f6aebca2de56ad32c8041f Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-08-22vlib: fix null pointer crash on strncmpSteven Luong1-2/+2
Program received signal SIGSEGV, Segmentation fault. 0x00007ffff4b71de0 in __strncmp_sse42 () from /lib64/libc.so.6 (gdb) up up vm=0x7ffff6664d40 <vlib_global_main>, addr=0x7fffb4bec6d0, ids=0x7fffb31675f0 <avf_pci_device_ids>, handle=0x7fffb4bec594) at /usr/src/debug/vpp-20.01/src/vlib/linux/pci.c:1250 1250 if (strncmp ("vfio-pci", (char *) di->driver_name, 8) == 0) (gdb) p di p di $1 = (vlib_pci_device_info_t *) 0x7fffb6446164 (gdb) p di->driver_name p di->driver_name $2 = (u8 *) 0x0 (gdb) driver_name may be null. strncmp is not forgiving. Change to use C11 safeC version. Type: fix Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: I1777a5966ceee7409d7bde86c30b14dc75534a5a
2019-08-20vlib: create unix runtime directoryOle Troan1-0/+5
Ensure the runtime directory is created at startup. Default /run/vpp Type: fix Fixes: I53d70939c8125d04a365ac51a6cbf8926dc52adf Change-Id: I6d70364ea756b86768c4dd1f6a9383238ed275c8 Signed-off-by: Ole Troan <ot@cisco.com>
2019-08-20fix pcap_write functionJack Xu1-0/+2
when use pcap cli to capture pcakets into two files rx01.pcap && rx02.pcap, the first time: 1)pcap rx trace on max 100 intfc any file rx01.pcap 2)......the process of capture data to buffer...... 3)pcap rx trace off the second time: 4)pcap rx trace on max 100 intfc any file rx02.pcap 5)......the process of capture data to buffer...... 6)pcap rx trace off the pcap_write function bug in this two lines pm->n_packets_captured = 0; if (pm->n_packets_captured >= pm->n_packets_to_capture) referring to calling pcap_close() will result in that the twice pcap cli both writes the packets into rx01.pcap, but nothing into rx02.pcap. Beside, the rx02.pcap file will not be created. solution: separate the pcap_close() out of pcap_write() Change-Id: Iedeb46f9cf0a4cb12449fd75a4014f95f3bb3fa8 Signed-off-by: Jack Xu <jack.c.xu@ericsson.com>
2019-08-19vlib: fix vlib_buffer_main_init_numa_node memory leak.Guanghua Zhang1-3/+8
Type: fix Signed-off-by: Guanghua Zhang <ghzhang@fiberhome.com> Change-Id: I8252ed2555f5af6db2f12dc7c30e41cc1ec7dde0
2019-08-15vlib: copy trace_handle in vlib_buffer_copy/clone() functionsJohn Lo2-4/+2
Since vlib_buffer_copy() and vlib_buffer_clone() both preserve VLIB_BUFFER_IS_TRACED bit in flags field, it should also copy trace_handle which would add minimal overhead. Thus, callers of these functions do not have to call vlib_buffer_copy_trace_flags() to copy trace_handle. Type: refactor Signed-off-by: John Lo <loj@cisco.com> Change-Id: Iff6a3f81660dd62b36a2966033eb380305340310
2019-08-09vlib: fix vlib_buffer_copy to preserve buffer flags bitJohn Lo1-3/+8
Make vlib_buffer_copy() preserve buffer flags bit the same way as that of vlib_buffer_clone() so both are consistent. Type: fix Signed-off-by: John Lo <loj@cisco.com> Change-Id: I6c32aa1e88724b482ce2439d82019e690311b664
2019-08-09stats: create /run/vpp before stat socket bind()YohanPipereau1-1/+1
When VPP tries to bind to stats.sock it will complain about non-existing /run/vpp directory. /run/vpp is created before cli socket operations are performed. The same should be done for stat socket. Ticket: VPP-1708 Type: fix Change-Id: I53d70939c8125d04a365ac51a6cbf8926dc52adf Signed-off-by: YohanPipereau <ypiperea@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com>
2019-08-02vlib: fix out of memory issueFilip Tehlar1-0/+3
'show node foo' causes infinite loop resulting in out of memory. This patch fixes the issue by breaking the loop on invalid input. Ticket: VPP-1538 Type: fix Fixes: 98afc711c5 Change-Id: Icf2be92e277a7f820d4e08bea9ef22ffbbb116f6 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2019-08-01interface: fix pcap tx/rx trace cli handlingJohn Lo1-6/+0
Provide default packet_to_capture value. Display interface name correctly for "pcap tx/rx trace status". Type: fix Signed-off-by: John Lo <loj@cisco.com> Change-Id: I7064d0dbea236a9aff68bba7fbaf2c4a73b16c6f Signed-off-by: John Lo <loj@cisco.com>
2019-07-31vlib: fix format_error_traceDave Barach1-1/+2
Error index calculation is error_code + error_node->error_heap_index. Type: fix Fixes: gerrit 20802 Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I66cf05a29b3cfd9ef9c5468e399290e862b784af
2019-07-30vlib: Fix packet tracingNeale Ranns1-1/+1
Type: fix Fixes: 99536f4 Change-Id: Ica230ec9fa7f6fd36e2754e8b0b9db555460ca55 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-07-26dhcp: send unicast and broadcast packets via the IP adjacencyNeale Ranns1-1/+1
Type: feature this means DHCP packets are subject to the IP features configured on the interface - the unicast packets already were sent throught the adj - added UT for DHCP client sending a unicast renewal Change-Id: Id50db0b71822f44bf7cb639a524195cdc9873526 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-07-23vlib: address vlib_error_t scaling issueDave Barach6-38/+36
Encoding the vpp node index into the vlib_error_t as a 10-bit quantity limits us to 1K graph nodes. Unfortunately, a few nodes need 6 bit per-node error codes. Only a very few nodes have so many counters. It turns out that there are about 2K total error counters in the system, which is (approximately) the maximum error heap index. The current (index,code) encoding limits the number of interfaces to around 250, since each interface has two associated graph nodes and we have about 500 "normal, interior" graph node This patch adds an error-index to node-index map, so we can store error heap indices directly in the vlib_buffer_t. Type: refactor Change-Id: I28101cad3d8750819e27b8785fc0cf71ff54f79a Signed-off-by: Dave Barach <dave@barachs.net>
2019-07-22stats: fix use-after-free hash key stringBenoît Ganne1-3/+6
Hash keys are not copied by the hash infrastructure, instead the pointer is used directly. stat_segment_register_gauge() does not allocate a private object for the key, causing issues when it is freed or reused. Allocate a private object on insertion into the hashtable instead. Type: fix Fixes: 92e3082199d10add866894e86a9762d79a3536c4 Change-Id: Ifb6addfcaec81bdb7ea3512050ce55f06ef09a4c Signed-off-by: Benoît Ganne <bganne@cisco.com>