4377 Commits

Author SHA1 Message Date
Andrew Yourtchenko
22f9fb1286 acl-plugin: acl-as-a-service: VPP-1248: fix the error if exports.h included in more than one C file
Including the exports.h from multiple .c files belonging to a single plugin results in an error.

Rework the approach to require the table of function pointers to be filled in by
the initialization function.

Since the inline functions are compiled in the "caller" context,
there is no knowledge about the acl_main structure used by the ACL
plugin. To help with that, the signature of inline functions is slightly
different, taking the p_acl_main pointer as the first parameter.

That pointer is filled into the .p_acl_main field of the method
table during the initialization - since the calling of non-inline variants
would have required filling the method table, this should give
minimal headaches during the use and switch between the two methods.

Change-Id: Icb70695efa23579c46c716944838766cebc8573e
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2018-06-20 13:37:21 +00:00
Brant Lin
285434a858 Fix sw-if-index display error.
If the sw-if-index is set to -1, it will send out all interfaces' arp enties. In this case, the sw-if-index is always set to -1. It is not correct.

Change-Id: I21e9ee078c757ac7efa70a2a1f1a7a4eb73d66a1
Signed-off-by: Brant Lin <brant.lin@ericsson.com>
2018-06-20 05:25:21 +00:00
Dave Wallace
d239f8d163 VCL: Fix session peer and local addresses
VPP-1302: VCL does not provide local and peer addresses

Change-Id: I7ff12e57799796dfeb030b181b4c24da07dc12eb
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2018-06-19 22:15:57 +00:00
Dave Barach
7055e26952 Driver level time-based src mac filter
Change-Id: I062d7653e00d77e73a61d8841e01ab4a159b6404
Signed-off-by: Dave Barach <dbarach@cisco.com>
2018-06-19 22:09:46 +00:00
Florin Coras
8b20bf5ef7 tcp: optimize tcp output
Change-Id: Idf17a0633a1618b12c22b1119e40c2e9d3192df9
Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-06-19 22:08:34 +00:00
Florin Coras
0c8a3bc95d tcp: optimize tcp input
Change-Id: Ib98cfc93f6c574de5250f251925f7ed4e86f5f6f
Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-06-19 22:08:21 +00:00
John Lo
084606befb Check get packet template allocation failure (VPP-1321)
After calling vlib_packet_template_get_packet(), make sure
packet buffer is allocated before using it.

Change-Id: Idb5199f4e2c9596137b2101e502d611f474a6ffe
Signed-off-by: John Lo <loj@cisco.com>
2018-06-19 21:26:10 +00:00
Dave Wallace
7e607a7389 VCL: refactor async & spinlocks
- Consolidate async code.
- Add macros for spinlocks to improve readability.

Change-Id: I2e0fd2b82ea76987aaf298a183d816c7d2ee0867
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2018-06-19 19:35:44 +00:00
Dave Barach
c6215d902f ip checksum multiarch support, cleanup
When computing tcp/udp checksums across large amounts of data -
e.g. when NIC h/w checksum offload is not available - it's worth
providing arch-dependent code; if only to compile the code w/ -O3.

Fix calculation when data is fully unaligned / on an odd byte
boundary.

Add a buffer alignment test vector.

Change-Id: I7644e2276ac6cbc3f575bf61746a6ffedbbb6150
Signed-off-by: Dave Barach <dave@barachs.net>
2018-06-19 18:47:11 +00:00
Pablo Camarillo
3337bd2200 Fixed bugs in SRv6 API
Jira ticket VPP-1196
Jira ticket VPP-1081
Jira ticket VPP-1078
Jira ticket VPP-1217

Change-Id: Id7e85229cae1017acb0aa4ca63ced334e6dafb8d
Signed-off-by: pcamaril <pcamaril@cisco.com>
Signed-off-by: Pablo Camarillo <pcamaril@cisco.com>
Signed-off-by: pcamaril <pcamaril@cisco.com>
Signed-off-by: Michal Cmarada <michal.cmarada@pantheon.tech>
2018-06-19 16:32:11 +00:00
eyal bari
2b9838ac60 flow:free lookup entries after packets are handled
Change-Id: I737dad64bf6dd0743d36500d5cfa1cb1a6594b98
Signed-off-by: Eyal Bari <ebari@cisco.com>
2018-06-19 16:22:07 +00:00
Ole Trøan
61debaaaf2 Revert "Python API: Add enum and union support."
This reverts commit a5ee900fb75201bbfceaf13c8bc57a13ed094988.

Some of the unit tests breaks. Backing out until fixed.

Change-Id: I1846fb417db44a2a772f7b59cda8bcfe6d39f8c3
Signed-off-by: Ole Troan <ot@cisco.com>
2018-06-18 18:30:09 +00:00
Ole Troan
a5ee900fb7 Python API: Add enum and union support.
As well as a rewrite of the encoders/decoders to make it more readable and extensible.

Change-Id: I253369ac76303922bf9c11377622c8974fa92f19
Signed-off-by: Ole Troan <ot@cisco.com>
2018-06-17 15:21:00 +00:00
Matthew Smith
76440d9033 ixgbe patch for link status updates
An x550 with SFP+ interfaces attached to some switches can
have problems bringing the port up.

After configuring the link, there is a wait for 500 ms for
the link to come up. Some switches don't bring their ports up
that quickly. So the link is never observed to come up and is
reconfigured again the next time dpdk_update_link_state() is
called. Subsequent attempts time out also indefinitely.

Instead of waiting through 5 iterations of a 100 ms delay, wait
through 10 iterations. The i40e PMD does this when updating
link status.

This issue & patch will be reported to Intel so this or
some better solution can be applied upstream in the future.

Change-Id: I16d706a2790e51d695edc43c0ca17f1eff1dcf5e
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2018-06-17 12:32:54 +00:00
Andrew Yourtchenko
a0dfa8b158 acl-plugin: fix the high cpu usage caused by the connection cleaner
The commit 4bc1796b346efd10f3fb19b176ff089179263a24 had incorrect
calculation of the session lists minimal timeout, resulting
in returned value of 0 which resulted in existing sessions
constantly requeued, taking up the CPU. Fix this calculation.

Change-Id: I9a789739f96a1f01522c68f91b0a02db2417837f
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2018-06-17 12:07:11 +00:00
Andrew Yourtchenko
e0b6c8a96d acl-plugin: split (L3) and (L4/pkt) logic of creation of 5tuple structure, optimize stores in the (l4/pkt)
Having two pieces of code - one for now much simpler to recreate L3 info,
one for a more difficult do build L4/pkt metadata allows more
degrees of freedom for optimizations.

Also, construct the metadata in local variables first before
saving it into the memory structure, this fewer memory stores
and they are better aligned, allowing to coalesce with
subsequent reads if needed.

Change-Id: Icb35d933834b14294f875362c9b58db3feb38d99
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2018-06-17 12:05:55 +00:00
Matus Fabian
c1c5baa1a9 NAT44: fix coverity
Change-Id: Ib1e4563dbc027571c77497e5c190201713adc72b
Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-06-16 19:29:06 +00:00
Ole Troan
e906aacc10 STATS: Separate socket for fd exchange.
stats { interval <no> socket-name <name> | default }
Where the default socket is in /run/vpp/stats.sock

Change-Id: Idd501b328c662804d4ccd58034b0ea6b8aa1f89a
Signed-off-by: Ole Troan <ot@cisco.com>
2018-06-15 12:16:32 +00:00
Ole Troan
1ec0ea85c3 STATS: Add more hierarchy to counters.
Put error counters under node_index.
/err/<node-name>/<error-name>

E.g:
/err/ip4-lookup/Hash table collisions
/err/ip6-rewrite/Buffer allocation error

Error names are not globally unique, and this allows
for walking all errors for a particular node.

Put interface counters under the directory /if.
E.g. /if/rx

Put system counters under the directory /sys.
E.g. /sys/vector_rate

Change-Id: I5b794d16698f61bcb2063a8cd77a7c4ae36419b8
Signed-off-by: Ole Troan <ot@cisco.com>
2018-06-15 12:07:40 +00:00
Damjan Marion
c22f87b876 avf: tx node fixes
- missing RSV bit set in descriptor
- wrong buffer offset

Change-Id: I8b138266652a30a50e4541c6344e4fe3dec4d1ca
Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-06-15 09:48:36 +00:00
Juraj Sloboda
d9778c2b19 Update DHCPv6 DUID code and fix coverity warnings
- Generate client DUID only when DHCPv6 PD feature is enabled
- Change client DUID type from DUID-LLT to DUID-LL
- Fix coverity warnings

Change-Id: I20e518fc9a1c5f3f7ea9add7e7e03a487c99e978
Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
2018-06-15 09:34:44 +00:00
Matus Fabian
a6110b6ea5 NAT44: endpoint dependent mode (VPP-1273)
To enable NAT plugin endpoint dependent mode add following to statrup config:
nat { endpoint-dependent }

Enable endpoint dependent filtering and mapping for all sessions.
Move some existing functionality such as service load balancing, twice nat,
out2in-only static mappings and unknown protocol dynamic translations, which
use endpoint dependent lookup hash tables before. Basically split to vanilla
NAT44 and extra features NAT44.

Change-Id: I3925eb5ddcc8f1ec4cf6af4e2a618a7ec7aa9735
Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-06-15 06:53:24 +00:00
Ping Yu
e43832c7e7 TLS async support
Change-Id: I26194e00dfb85e5cd1c65ff4e6ffd665be2d719b
Signed-off-by: Ping Yu <ping.yu@intel.com>
2018-06-15 01:30:23 +00:00
Matthew Smith
d465631c3c Fix SEGV in generic event sub reaper
When a client subscribed to receive events disconnects
from the API, while deleting their subscription, a hash
lookup was being performed against a pointer that did
not refer to a hash, resulting in a SEGV.

Perform the hash lookup against the correct hash.

Change-Id: I011d7479e2c3b9ee50721cf7499385c3ff7f704a
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2018-06-14 18:56:16 +00:00
Dave Barach
1f806587d8 Use __attribute__((weak)) references where necessary
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-14 18:52:47 +00:00
Andrew Yourtchenko
abcddcbcab Add clib_bihash_search_inline_2_with_hash to bihash template
Use similar approach as in the clib_bihash_search_inline_with_hash to
be able to do the hash calculation and lookup separately.

Change-Id: Ief79aa0f9f1e42b0af88be4807ca01fac30a80d7
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2018-06-14 17:38:53 +00:00
John Lo
8637634d4d Use unicast DMAC for IP neighbor pool refresh probes
Change-Id: I12fbebd1d24c37dc77c147773ea522c8a4b7b99d
Signed-off-by: John Lo <loj@cisco.com>
2018-06-14 16:03:42 +00:00
Andrew Yourtchenko
c553ec20fe acl-plugin: VAT: add an option to load entire ACL from a ClassBench ruleset file for testing
Add a command "acl_add_replace_from_file" to VAT which can load a ruleset and
add an ACL with it. There are a few options which augment the ACL being created:

"permit+reflect" or "permit" alter the default action from deny on the ACEs
created.

"append-default-permit" adds an entry in the end with the "permit+reflect"
if the default action has been changed to permit+reflect, or with a simple
permit otherwise.

This command is IPv4-only because the available datasets were IPv4-only.

Change-Id: I26b9f33ecb6b59e051d1d9cbafedbc47e8203392
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2018-06-14 14:38:10 +00:00
Eyal Bari
93a6f25cee vxlan:use VLIB_NODE_FN for multiarch selection
Change-Id: Ic98945fa1ffcc73e0b239ff5cc11d45e7318613e
Signed-off-by: Eyal Bari <ebari@cisco.com>
2018-06-14 08:57:39 +03:00
Ole Troan
313f7e2fea MTU: IP fragmentation added to ip4-rewrite and ip6-rewrite
Change-Id: Ibae260273f25a319153be37470aed49ff73e957a
Signed-off-by: Ole Troan <ot@cisco.com>
2018-06-14 05:02:21 +00:00
Andrew Yourtchenko
aa2f59bbd3 acl-plugin: use 16_8 bihash for IPv4 sessions and 40_8 bihash for IPv6 sessions
Add a new kv_16_8 field into 5tuple union, rename
the existing kv into kv_40_8 for clarity, and
add the compile-time alignment constraints.

Change-Id: I9bfca91f34850a5c89cba590fbfe9b865e63ef94
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2018-06-14 04:46:41 +00:00
Dave Barach
3eec2d2759 Disable bihash bucket-level caching
It'll be interesting to see what the perf trend job
says about this change.

Change-Id: I66307a19a865011ac9660108098874fa1481c895
Signed-off-by: Dave Barach <dave@barachs.net>
2018-06-13 20:48:40 -04:00
Dave Barach
1ddbc0138b Stat segment / client: show run" works now
Seems to have minimal-to-zero performance consequences. Data appears
accurate: result match the debug CLI output. Checked at low rates, 27
MPPS sprayed across two worker threads.

Change-Id: I09ede5150b88a91547feeee448a2854997613004
Signed-off-by: Dave Barach <dave@barachs.net>
2018-06-13 09:26:41 -04:00
Andrew Yourtchenko
c7d50970d4 acl-plugin: change the src/dst L3 info in 5tuple struct to be always contiguous with L4 data
Using ip46_address_t was convenient from operational point of view but created
some difficulties dealing with IPv4 addresses - the extra 3x of u32 padding
are costly, and the "holes" mean we can not use the smaller key-value
data structures for the lookup.

This commit changes the 5tuple layout for the IPv4 case, such that
the src/dst addresses directly precede the L4 information.
That will allow to treat the same data within 40x8 key-value
structure as a 16x8 key-value structure starting with 24 byte offset.

Change-Id: Ifea8d266ca0b9c931d44440bf6dc62446c1a83ec
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2018-06-13 12:13:11 +00:00
lollita liu
eaba9340da add end of string for format name in unix_physmem_region_alloc
Change-Id: I8cb4d5d90fb321de6e5037a3d0440507db79ec75
Signed-off-by: lollita liu <lollita.liu@ericsson.com>
2018-06-13 11:03:01 +00:00
Chris Luke
6edd36070c cli: 'restart' should close open files (VPP-1068)
- On 'restart' close all registered files (except stdio) so that the
  new process has a clean start; in particular, CLI sockets, API
  sockets, tun/af_packet etc descriptors all need to close so they're
  not left open but unused by the new VPP process. To do this we iterate
  all the files registered for the polling mechanism and close() them.[1]
- While we're here, retain the original environment on 'restart';
  several things make use of it.

[1] An alternative mechanism would be to mark all files with CLOEXEC
  on opening; I think that is a little fragile for this fairly esoteric
  use case.

Change-Id: I81b4e261c4d3c4e2948981231be899824dd4e69f
Signed-off-by: Chris Luke <chrisy@flirble.org>
2018-06-13 08:01:33 +00:00
Sirshak Das
8a4a8c455a Fix clang compilation on aarch64: extraneous parentheses
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-13 08:00:59 +00:00
eyal bari
af86a48733 vxlan:offload RX flow
ip4 vxlan cli/api (using flow infra) to create flows and enable them on
different hardware (currently tested with i40e)

to offload a vxlan tunnel onto hw:
set flow-offload vxlan hw TwentyFiveGigabitEthernet3/0/0 rx vxlan_tunnel1

to remove offload:
set flow-offload vxlan hw TwentyFiveGigabitEthernet3/0/0 rx vxlan_tunnel1 del

TODO:ipv6 handling

Change-Id: I70e61f792ef8e3f007d03d7df70e97ea4725b101
Signed-off-by: Eyal Bari <ebari@cisco.com>
2018-06-13 02:52:10 +00:00
Jakub Grajciar
02ff5f7ce0 avf: fix crash if device is busy
Change-Id: I170d78c8e5f7e16a264c9f226a09693109aece5e
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
2018-06-12 19:06:41 +00:00
Florin Coras
00dfe54eec tcp: add close-wait state flags
Change-Id: I35508d5251633396393f52842d1b58bc1c1463f6
Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-06-12 18:27:22 +00:00
Ole Troan
e2552039df MTU assigning to itself (Coverity)
Change-Id: Iee8de25ab3c68ae3698c79852195dc336050914c
Signed-off-by: Ole Troan <ot@cisco.com>
2018-06-12 11:40:18 +02:00
Mohsin Kazmi
0af529c4c5 vom: Add support for af-packet dump
Change-Id: I0a1fc36ac29f6da70334ea3b5a5cf0e841faef76
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-06-11 23:34:18 +00:00
Florin Coras
25579b4acd tcp: cleanup connection/session fixes
- Cleanup session state after last ack and avoid using a cleanup timer.
- Change session cleanup to free the session as opposed to waiting for
delete notify.
- When in close-wait, postpone sending the fin on close until all
outstanding data has been sent.
- Don't flush rx fifo unless in closed state

Change-Id: Ic2a4f0d5568b65c83f4b55b6c469a7b24b947f39
Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-06-11 17:32:40 +00:00
Florin Coras
40903ac34f udp: fix for multiple workers and add test
Since the main thread is not used for session polling anymore, when vpp
is started with multiple wokers, allocate connections on the first. Also
add a simple udp make test.

Change-Id: Id869f5d89e0fced51048f0384fa86a5022258b7c
Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-06-11 14:08:20 +00:00
Ole Troan
d723161e03 MTU: Software interface / Per-protocol MTU support
This patch separates setting of hardware interfaec and software
interface MTU. Software MTU is L2 payload MTU (i.e. not including L2
header). Per-protocol MTU for IPv4, IPv6 and MPLS can also be set.
Currently only IP4, IP6 are enabled in adjacency / rewrite code.

Documentation in src/vnet/MTU.md

Change-Id: Iee2fd6f0bbc8210748dd8e073ab9fab87d323690
Signed-off-by: Ole Troan <ot@cisco.com>
2018-06-11 10:25:59 +00:00
Alexander Chernavin
f4fd0d4217 Fix multiple NAT translation with interface address as external
Change-Id: Idd65c6d0489bf83984a2c34d22d3f94000fc7018
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2018-06-11 05:45:50 +00:00
Neale Ranns
43add7ff90 IGMP: use simple u32 bit hash key
some IGMP hashse use only a u32 key, which is not stored in the object, so don't use memory based hash

Change-Id: Iaa4eddf568ea0164bc2a812da4cc502f1811b93c
Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-06-10 18:01:49 -07:00
Chris Luke
01dc6b968a cli: Disable XON/XOFF in the tty
- CLI history forward-search is bound to ^S which is common, but
  that is also the tty's default control byte to pause output.
  So we disable XON/XOFF in the tty so that we can use ^S.

Change-Id: I61717c77a11733d64eed7f8119677e7cd2e20029
Signed-off-by: Chris Luke <chrisy@flirble.org>
2018-06-10 19:54:26 +00:00
Chris Luke
fc379d28ab cli: Fix reverse-line-wrap in terminals (VPP-1295)
- Terminals do not reverse-line-wrap when the cursor is at the left
  edge and \b tries to make it go left.
- Instead, we have to track the cursor position if we need to emit \b's
  and if we are at the left edge emit an ANSI sequence to relocate
  the cursor. Previously we usually simply calculated the new cursor
  position after a bunch of output had completed.
- Further trickiness is required since most xterm-like terminals also
  defer moving the cursor to the next line when at the right edge[1], and
  then if they receive a \b move the cursor back one character too many.
- This requires intricate reworking of everywhere that \b is emitted
  by the CLI code during command line editing.

[1] Bash counters this issue by tracking the cursor position as output
  is generated and forcing the cursor to the next line (by emitting
  a space followed by \r) if it gets to this phantom cursor position);
  here we effectively do that but only if the user tries to go left
  when in this state.

Change-Id: I7c1d7c0e24c53111a5810cebb504ccfdac743086
Signed-off-by: Chris Luke <chrisy@flirble.org>
2018-06-10 19:54:08 +00:00
Florin Coras
887b7ba8ad tcp: fix timer based recovery exit condition
Change-Id: I3f36e5760fd2935cc29d22601d4c0a1d2a22ba84
Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-06-10 18:27:37 +00:00