aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
AgeCommit message (Collapse)AuthorFilesLines
2019-02-19reassembly: fix buffer usage counterKlement Sekera1-5/+7
Change-Id: I713904f8eb2f724cb08dba494c160c14cc8b24a1 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2019-02-19tap gso: experimental supportAndrew Yourtchenko2-17/+81
This commit adds a "gso" parameter to existing "create tap..." CLI, and a "no-gso" parameter for the compatibility with the future, when/if defaults change. It makes use of the lowest bit of the "tap_flags" field in the API call in order to allow creation of GSO interfaces via API as well. It does the necessary syscalls to enable the GSO and checksum offload support on the kernel side and sets two flags on the interface: virtio-specific virtio_if_t.gso_enabled, and vnet_hw_interface_t.flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO. The first one, if enabled, triggers the marking of the GSO-encapsulated packets on ingress with VNET_BUFFER_F_GSO flag, and setting vnet_buffer2(b)->gso_size to the desired L4 payload size. VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO determines the egress packet processing in interface-output for such packets: When the flag is set, they are sent out almost as usual (just taking care to set the vnet header for virtio). When the flag is not enabled (the case for most interfaces), the egress path performs the re-segmentation such that the L4 payload of the transmitted packets equals gso_size. The operations in the datapath are enabled only when there is at least one GSO-compatible interface in the system - this is done by tracking the count in interface_main.gso_interface_count. This way the impact of conditional checks for the setups that do not use GSO is minimized. "show tap" CLI shows the state of the GSO flag on the interface, and the total count of GSO-enabled interfaces (which is used to enable the GSO-related processing in the packet path). This commit lacks IPv6 extension header traversal support of any kind - the L4 payload is assumed to follow the IPv6 header. Also it performs the offloads only for TCP (TSO - TCP segmentation offload). The UDP fragmentation offload (UFO) is not part of it. For debug purposes it also adds the debug CLI: "set tap gso {<interface> | sw_if_index <sw_idx>} <enable|disable>" Change-Id: Ifd562db89adcc2208094b3d1032cee8c307aaef9 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2019-02-19VPP-1573 fix crash in ip6 reassemblyKlement Sekera1-1/+1
Change-Id: I3a3076c7d87446b5ec2a02e70d3b6d05f1875875 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2019-02-19ip6-local: fix uninitialized variable errorDamjan Marion1-1/+1
Change-Id: I245a8cc8f237242efadcf10d47b76222a6497e89 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-02-18Explicit dual-loop in ip6-localBenoît Ganne1-72/+134
Makes ip6-local node dual-loop explicit. This is only a style change. Change-Id: Ic8e7cecb3f51e98b8a069b501f5c338156934a6d Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-02-15Optimize ip6-localBenoît Ganne1-246/+187
Optimize IPv6 ip6-local node by rewriting the dual/single loop with prefetch and simpler unrolling. My local, unrepresentative tests for GRE4 termination over IPv6 show a performance improvement of ~40% for ip6-local node alone and ~5% globally. Change-Id: I11e1e86d3838dd3c081aa6be5e25dae16ed6e2d8 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-02-14Add -fno-common compile optionBenoît Ganne2-1/+5
-fno-common makes sure we do not have multiple declarations of the same global symbol across compilation units. It helps debug nasty linkage bugs by guaranteeing that all reference to a global symbol use the same underlying object. It also helps avoiding benign mistakes such as declaring enum as global objects instead of types in headers (hence the minor fixes scattered across the source). Change-Id: I55c16406dc54ff8a6860238b90ca990fa6b179f1 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2019-02-13ip6: convert code to new multiarchDamjan Marion2-96/+82
Change-Id: Idd09b5d0597336e4f2028113cae76c94fd1c5427 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-02-09buffers: fix typoDamjan Marion3-5/+5
Change-Id: I4e836244409c98739a13092ee252542a2c5fe259 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-02-06buffers: make buffer data size configurable from startup configDamjan Marion3-4/+6
Example: buffers { default data-size 1536 } Change-Id: I5b4436850ca18025c9fdcfc7ed648c2c2732d660 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-02-02Deprecate old mutliarch code, phase 1Damjan Marion1-22/+1
It is causing compilation sloness with gcc-7 so removing it before it was originally planned. So far macros are left in the tree so we can know which nodes to convert to new multiarch code. Change-Id: Idb14622ca61fdce1eba59723b20d98715b7971e6 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-01-30Use IP and MAC API types for neighborsNeale Ranns13-366/+418
use address_t and mac_address_t for IPv6 and ARP entries and all other API calls in ip.api aprat from the route ones, that will follow in a separate commit Change-Id: I67161737c2184d3f8fc1e79ebd2b55121c5b0191 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-01-25IP6 FIB: walk table for dump (VPP-1553)Neale Ranns1-12/+7
Change-Id: Iaa57ace6df96bfacd1235c80ec7bb08e5f335530 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-01-23IP route local and connectedNeale Ranns1-2/+9
allow routes that are local and connected to be added via the API. this emulates the addition of a second address in the same subnet added to an interface. Change-Id: Ib18a08c26956be9a07b3360664210c8cf6734c84 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-01-20buffers: don't init metadata, as it is already initializedDamjan Marion3-9/+0
Change-Id: Ia083050389853c25b069f0f8286d50d3f4aef527 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-01-19buffers: remove free-list information from buffer metadataDamjan Marion1-2/+1
Change-Id: I6048c6a51efa826ac333f7d15919cb87dd766d74 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-01-18buffers: remove freelist argument from vlib_buffer_add_dataDamjan Marion1-13/+7
Change-Id: Idb224b807373128b78dc46f177b2d2e0ed288349 Signed-off-by: Damjan Marion <damarion@cisco.com>
2019-01-10ARP/ND: copy opaque2 persistent fields to new packetNeale Ranns2-2/+8
Change-Id: Ic65f686aaccaf8450732d88d7471b587faccaa9d Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-01-07VOM: mroutesNeale Ranns2-6/+14
- fixes in ip.api for dumping mroute path flags Change-Id: I13b0cfb15d374250ed71bd4e13dda9b798c18204 Signed-off-by: Neale Ranns <nranns@cisco.com>
2019-01-07Handle buffer alloc failure in vlib_buffer_add_dataDave Barach2-23/+47
It's not OK to crash due to a transient buffer allocation failure. Return 1 if the requested operation failed, otherwise 0. Buffer index parameter change to a value-result, so the caller can differentiate between partial and complete allocation failure: callers which request an initial allocation (inbound bi = ~0) need to check the (out) value to decide whether or not to call vlib_buffer_free(...). Change-Id: I03029d7f2714c17dca4630dfd95a1eb578b68384 Signed-off-by: Dave Barach <dave@barachs.net>
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>
2019-01-01buffers: remove unused codeDamjan Marion1-6/+2
Change-Id: If2bbfbc52994f5de0879763e0b7a7864498debb6 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-12-20FIB: encode the label stack in the FIB path during table dumpNeale Ranns1-0/+2
Change-Id: I28e8a99b980ad343a4209e673201791b91ceab4e Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-12-20reassembly: replace asserts with error countersKlement Sekera4-128/+272
Change-Id: Iaa39aea990bc04147f6a049215e990a567d30106 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-12-18MFIB: recurse resolution through an MFIB entryNeale Ranns1-20/+20
Change-Id: I8dc261e40b8398c5c8ab6bb69ecebbd0176055d9 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-12-16VPP-1523: harden reassemblyKlement Sekera1-5/+3
Change-Id: I00d7b38bd99e81e3921ce08cce50d613f11de36e Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-12-16IP6-MFIB: replace the radix tree with bihash (VPP-1526)Neale Ranns3-11/+31
Change-Id: I7a48890c075826fbd8c75436dfdc5ffff230a693 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-12-14VPP-1510: add support for punt deletePavel Kotucek1-1/+12
Change-Id: Ibd7b1b13da0861f67e5e9e73bf6539199b3c82ea Signed-off-by: Pavel Kotucek <pavel.kotucek@pantheon.tech>
2018-12-13reassembly: fix internal buffer count accountingKlement Sekera1-0/+3
Change-Id: I6af2c8552aeafe0abc8b8c3e5af1a05640e95919 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-12-13VPP-1522: harden reassembly codeKlement Sekera2-24/+40
Change-Id: Ib5a20bff7d8a340ecf50bcd4a023d6bf36382ba3 Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-12-13make build failure.Paul Vinciguerra1-2/+2
[84/597] Building C object vnet/CMakeFiles/vnet.dir/ip/ip_types_api.c.o FAILED: ccache /usr/lib/ccache/cc -DWITH_LIBSSL=1 -Dvnet_EXPORTS -I/vpp/src -I. -Iinclude -march=corei7 -mtune=corei7-avx -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror -fPIC -Wno-address-of-packed-member -Wall -MMD -MT vnet/CMakeFiles/vnet.dir/ip/ip_types_api.c.o -MF vnet/CMakeFiles/vnet.dir/ip/ip_types_api.c.o.d -o vnet/CMakeFiles/vnet.dir/ip/ip_types_api.c.o -c /vpp/src/vnet/ip/ip_types_api.c /vpp/src/vnet/ip/ip_types_api.c: In function 'ip_address_union_encode': /vpp/src/vnet/ip/ip_types_api.c:70:13: error: incompatible type for argument 1 of 'memcpy' memcpy (out->ip6, &in->ip6, sizeof (out->ip6)); ^ In file included from /usr/include/string.h:635:0, from /vpp/src/vppinfra/string.h:55, from /vpp/src/vppinfra/mem.h:55, from /vpp/src/vppinfra/vec.h:42, from /vpp/src/vppinfra/error.h:53, from /vpp/src/vppinfra/hash.h:41, from /vpp/src/vnet/ip/ip.h:43, from /vpp/src/vnet/ip/ip_types_api.h:23, from /vpp/src/vnet/ip/ip_types_api.c:16: /usr/include/x86_64-linux-gnu/bits/string3.h:50:42: note: expected 'void * restrict' but argument is of type 'vl_api_ip6_address_t {aka struct _vl_api_ip6_address}' __NTH (memcpy (void *__restrict __dest, const void *__restrict __src, ^ /vpp/src/vnet/ip/ip_types_api.c:72:13: error: incompatible type for argument 1 of 'memcpy' memcpy (out->ip4, &in->ip4, sizeof (out->ip4)); ^ In file included from /usr/include/string.h:635:0, from /vpp/src/vppinfra/string.h:55, from /vpp/src/vppinfra/mem.h:55, from /vpp/src/vppinfra/vec.h:42, from /vpp/src/vppinfra/error.h:53, from /vpp/src/vppinfra/hash.h:41, from /vpp/src/vnet/ip/ip.h:43, from /vpp/src/vnet/ip/ip_types_api.h:23, from /vpp/src/vnet/ip/ip_types_api.c:16: /usr/include/x86_64-linux-gnu/bits/string3.h:50:42: note: expected 'void * restrict' but argument is of type 'vl_api_ip4_address_t {aka struct _vl_api_ip4_address}' __NTH (memcpy (void *__restrict __dest, const void *__restrict __src, ^ /vpp/src/vnet/ip/ip_types_api.c: At top level: cc1: error: unrecognized command line option '-Wno-address-of-packed-member' [-Werror] cc1: all warnings being treated as errors [84/597] Building C object vnet/CMakeFiles/vnet.dir/ip/ip4_forward.c.o ninja: build stopped: subcommand failed. Makefile:691: recipe for target 'vpp-build' failed make[1]: *** [vpp-build] Error 1 make[1]: Leaving directory '/vpp/build-root' Makefile:394: recipe for target 'test' failed make: *** [test] Error 2 DBGvpp# show cpu Model name: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz Microarchitecture: Haswell (Crystalwell) Flags: sse3 ssse3 sse41 sse42 avx avx2 aes invariant_tsc Base frequency: 2.49 GHz DBGvpp# show version verbose Version: v19.01-rc0~447-g3be662f Compiled by: vagrant Compile host: vpp Compile date: Mon Dec 10 14:55:24 PST 2018 Compile location: /vpp Compiler: GCC 5.4.0 20160609 Current PID: 14104 Change-Id: I6ff03bc5ad1c3517256e244b6986e9a1507a3349 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-12-13ip4_rewrite_inline: fix variable errorZhiyong Yang1-2/+2
Change-Id: I0470b4b13095583fe018f565f100342fab45715e Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
2018-12-12Change ipsec feature node namesPierre Pfister2-8/+8
ipsec4-output and ipsec6-output were conflicting with ipsec interface names ("ipsec<id>") and vnet/interface.c autogenerated output node ("<ifname>-output"). Changing feature names seems to be the less invasive option. This patch also changes "input" feature names for consistency. Change-Id: I4ba10d07e9ba09df20aa2500104252b06b55f8f7 Signed-off-by: Pierre Pfister <ppfister@cisco.com>
2018-12-10IP-local: any IP can appear as the source (VPP-1522)Neale Ranns1-3/+15
Change-Id: Ib0d9b533d72c899b77c9a7bd1daa9b4a55b7221c Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-12-07VPP-1506: dump local punts and registered punt socketsPavel Kotucek4-66/+389
Change-Id: If7835e9b80ec9402404bfc8d271eb11a10ef992b Signed-off-by: Pavel Kotucek <pavel.kotucek@pantheon.tech>
2018-12-06API: Change ip4_address and ip6_address to use type alias.Ole Troan2-9/+4
Change-Id: Id8669bbadd1d6b2054865a310a654e9b38d1667d Signed-off-by: Ole Troan <ot@cisco.com>
2018-12-06MFIB; CLI improvementsNeale Ranns1-6/+32
Change-Id: I7cf3ae8c10dd584e8bc234a3253bea3c5a2d105a Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-12-03Copying QoS Bits when fragmented, so that marking can happen properly also ↵Vijayabhaskar Katamreddy1-0/+7
cleaning up some unused code Change-Id: I1558eec79af173e5cdcc769d7c3909039403eed8 Signed-off-by: Vijayabhaskar Katamreddy <vkatamre@cisco.com>
2018-12-01ip_reassembly_enable_disable reply handler name is changed.Chore1-1/+1
Change-Id: I89be597376690bb75c4347bcfc1c6c3d27c4034c Signed-off-by: Chore <s3m2e1.6star@gmail.com>
2018-11-30Metadata / opaque formatting belongs in vppDave Barach1-0/+1
VPP graph dispatch trace record description: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Major Version | Minor Version | NStrings | ProtoHint | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Buffer index (big endian) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + VPP graph node name ... ... | NULL octet | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Buffer Metadata ... ... | NULL octet | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Buffer Opaque ... ... | NULL octet | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Buffer Opaque 2 ... ... | NULL octet | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VPP ASCII packet trace (if NStrings > 4) | NULL octet | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Packet data (up to 16K) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Graph dispatch records comprise a version stamp, an indication of how many NULL-terminated strings will follow the record header, and a protocol hint. The buffer index allows downstream consumers of these data to easily filter/track single packets as they traverse the forwarding graph. FWIW, the 32-bit buffer index is stored in big endian format. As of this writing, major version = 1, minor version = 0. Nstrings will be either 4 or 5. Here is the current set of protocol hints: typedef enum { VLIB_NODE_PROTO_HINT_NONE = 0, VLIB_NODE_PROTO_HINT_ETHERNET, VLIB_NODE_PROTO_HINT_IP4, VLIB_NODE_PROTO_HINT_IP6, VLIB_NODE_PROTO_HINT_TCP, VLIB_NODE_PROTO_HINT_UDP, VLIB_NODE_N_PROTO_HINTS, } vlib_node_proto_hint_t; Example: VLIB_NODE_PROTO_HINT_IP6 means that the first octet of packet data SHOULD be 0x60, and should begin an ipv6 packet header. Change-Id: Idf310bad80cc0e4207394c80f18db5f77c378741 Signed-off-by: Dave Barach <dave@barachs.net>
2018-11-29api: ip_source_check_interface_add_del api is added.Chore2-0/+48
Change-Id: I4799a9d469c797e54669ff4b50851a9acc849427 Signed-off-by: Chore <s3m2e1.6star@gmail.com>
2018-11-29VPP-1507: Added binary api to dump configured ip_punt_redirectPavel Kotucek5-29/+214
Change-Id: I790f7785e183cc9aaffd5b593617c4e12a32e20d Signed-off-by: Pavel Kotucek <pavel.kotucek@pantheon.tech>
2018-11-28Remove useless prefetch in ip4-rewrite nodeSimon Zhang1-1/+1
Prefetching first 2 packets' header is useless cause of the prefetching action is not done before using the packets. There's no performance drop in Xeon platform and slightly performance gain in Atom platform after rmoving the prefetch. Change-Id: Ib4b074af20d7cd5053aecc7147b162141aec31f5 Signed-off-by: Simon Zhang <yuwei1.zhang@intel.com>
2018-11-26Add a feature arc consistency checkDave Barach2-0/+7
Verify that last node in the computed feature order matches reality. This check doesn't make sense in all cases, so we skip it if the newly-added vnet_feature_arc_registration_t ".last_in_arc" datum is a NULL pointer. Change-Id: Ia99c3e2b2da2e4780a7d5bc71670c5742a66fef2 Signed-off-by: Dave Barach <dave@barachs.net>
2018-11-26flow-hash: Add symmetric flag for flow hashingMohsin Kazmi4-4/+40
When 'Symmetric' flag is enabled, it will sort the addresses and hence, same flow hash will be calculated on both directions. Change-Id: I5d846f8d0b94ca1121e03d15b02bb56edb5887b1 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
2018-11-22MAP: Use explicit address/prefix types in APIOle Troan1-0/+10
Change-Id: Ic751fecc4a060eedcdb9eaf5d02e1416c838fd63 Signed-off-by: Ole Troan <ot@cisco.com>
2018-11-18add vlib_prefetch_buffer_data(...) macroDamjan Marion1-8/+4
Change-Id: Iba750a41262cc028ad0363fff78cc219e4a33538 Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-11-17IP-punt: add documentation to the API and fix IP address initNeale Ranns2-1/+3
Change-Id: I0bdff4dbfd81d67e82211ce9fdc97209a1b23c66 Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-11-15ip4-input: fix prefetch data issue for tunnel decap casesZhiyong Yang1-4/+8
There are two reasons to modify the existing code ip4_input_inline. 1. For many tunnel decap cases, inner ip header or its part is possible in the second cacheline, not first cacheline only after the field "data", and this will cause data cache miss once the second cacheline is needed to access. e.g vxlan-gpe. 2. For most of cases, "data" is the starting address of ethernet header, not IP header. The existing code causes misunderstanding from code readability perspective. Change-Id: I43e119b899dbde95803bccbac54259729fd2cddf Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com> Signed-off-by: Yuwei Zhang <yuwei1.zhang@intel.com>
2018-11-14Remove c-11 memcpy checks from perf-critical codeDave Barach13-50/+52
Change-Id: Id4f37f5d4a03160572954a416efa1ef9b3d79ad1 Signed-off-by: Dave Barach <dave@barachs.net>