Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update from parent. #1

Merged
merged 82 commits into from
Sep 15, 2017
Merged

Conversation

JereLeppanen
Copy link
Owner

No description provided.

JereLeppanen and others added 30 commits April 10, 2017 12:35
Since we set CFLAGS in this subdirectory, we need to explicitly
include AM_CFLAGS from top-level, otherwise they will be omitted.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
To avoid surprises caused by different versions of gcc defaulting to
different language standards, set it explicitly to C99. Many people
may still be using older gcc versions with incomplete C11 support, so
C99 is probably the most reasonable choice.

The _DEFAULT_SOURCE feature macro is needed to bring in various
features, which are used in many places in the code, and are *not* a
part of C99.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Since current implementation of ofp_connect() is non-blocking,
it should return -1 and set ofp_errno to OFP_EINPROGRESS.

Fixes: #92 the misleading return code of ofp_connect() function

Signed-off-by: vitikkan <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Fixes: #149 - ofp_create_ns_socket creates unnecessary children
processes

Fix the issue by creating only one child process to create netlink
sockets for all existing vrf

Signed-off-by: Dapeng Liu <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
…twrap

Signed-off-by: Bogdan Pricope <[email protected]>
Reviewed-by: Jere Leppänen <[email protected]>
Commit 33ec74b broke compilation with glibc versions earlier than
2.19, which introduced the _DEFAULT_SOURCE feature macro. Other
feature macros are needed for compilation with old glibc versions,
most notably in CentOS 7.

Fixes: 33ec74b Set the language standard to C99.
Fixes: #153 unknown type name 'fd_set'

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Brian Brooks <[email protected]>
These files make it possible to activate CI at https://travis-ci.org/

The script builds ofp with odp-linux and runs the cunit test cases.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Brian Brooks <[email protected]>
Signed-off-by: Bogdan Pricope <[email protected]>
Reviewed-by: Jere Leppänen <[email protected]>
…ation.

Applications should initialize ofp_init_global_t using the provided
initialization function instead of memset() to get correct default
values that may depend on OFP build and to isolate the applications
better from future changes that may add new fields in the init structure.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
 - fix links to few kernel.org documents
 - change Bugzilla to GitHub Issues

Signed-off-by: Andriy Berestovskyy <[email protected]>
Reviewed-by: Jere Leppänen <[email protected]>
This is part of the fix for issue 67. Malloc is used in several places when creating data that can be used from different cores. To avoid this, the allocation has been changed to use shared memory instead. The first step was to remove this from port configuration functions.

Signed-off-by: Iulia Florea <[email protected]>
Reviewed-by: Jere Leppänen <[email protected]>
Fixes: #152 Premature closure of TCP connection

Clear the FIN flag for packets that are being dropped during so_rcv buffer
full condition.

This patch fixes a problem introduced by commit
af101aa for bug #93 (Data corruption - tcp
packets dropped in the receive path).
If there is not enough room in the so_rcv sockbuf, the fix of bug #93
correctly drops the current packet to trigger a retransmit.
The problem occurs if that packet happens to be a FIN, in which case the
packet gets dropped but its FIN flag still gets processed, causing the
connection to close prematurely.
The patch below fixes the problem by clearing the FIN flag for such packets.

Signed-off-by: Janos Villanyi <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
OFP tcp layer should use tcp_ts_getticks for all the timestamp in
tcp packets. Replacing use of ofp_timer_ticks with tcp_ts_getticks
in case of syn messqage is recieved.

Signed-off-by: Nikhil Agarwal <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Create a netlink listener thread only if slow path is enabled and
enable_nl_thread is nonzero. This is the default.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Signed-off-by: Iulia Florea <[email protected]>
Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Corrected mismatch between loglevel_descript and ofp_loglevel
values. Set ofp_loglevel initial value according to OFP_DEBUG
macro.

Fixes: #60 "loglevel" is broken after commit 2073b2b
Fixes: #61 "Loglevel" description is missing

Signed-off-by: Viktor Tikkanen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Functions that manipulate AVL trees have locking and different operations
can't be done in parallel to avoid wrongly balancing the tree.
Locking was mising in the avl delete function.

Fixes: #123 Missing locking around the avl_tree used for VLANs

Signed-off-by: Iulia Florea <[email protected]>
Reviewed-by: Jere Leppänen <[email protected]>
Use odp_time_to_ns() instead of odp_time_to_u64() that is not present
in ODP v1.15.0.0.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Brian Brooks <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Make the default shared memory allocator reserve shared memory
using the ODP_SHM_SINGLE_VA flag if the flag has been defined.

Many (but no all) uses of ODP shared memory in OFP assume that the
SHM area has the same virtual address in all threads/processes.
Starting from ODP v1.13.0.0 this has to be requested using the
ODP_SHM_SINGLE_VA flag in odp_shm_reserve(). Older versions of
the ODP API do not have the flag and perhaps do not guarantee
the kind of address mapping assumed by OFP.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Brian Brooks <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
This is the second patch related to issue 67. In this case, malloc was used for shared data in the routes by vrf AVL trees and it was replaced by data in shared memory.

Signed-off-by: Iulia Florea <[email protected]>
Reviewed-by: Jere Leppänen <[email protected]>
- Name struct arp_s. At this point, no effect on anything or anyone
  apart from doxygen.

- Fix comment style.

- A couple of other very minor comment changes.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
In the examples, before starting the OFP, the global parameters were set to 0.
Instead of this, the newly added ofp_init_global_param function should be used
to set the structure to its default value. Every example that uses ofp_init_global
function to start the OFP process is changed to use this setting.

Signed-off-by: Iulia Florea <[email protected]>
Reviewed-by: Jere Leppänen <[email protected]>
The above function used to have 7 parameters and some of them were unused.
Instead of that list, now it uses the ofp_global_init structure that contains
all the necessary fields. There, if necessary, new fields can be added to easily
customize init parameters.

Signed-off-by: Iulia Florea <[email protected]>
Reviewed-by: Jere Leppänen <[email protected]>
Copy ofp_global_param_t to shared memory and allow access via a global
per-thread pointer. This makes it easy to access any of the global
parameters anywhere in the code without passing them through long call
chains.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Fixes: #158 ODP pool parameters not always fully initialized

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Put back an #ifdef SP directive that was removed in an earlier
commit. It's needed after all when compiling without slow path
support.

Fixes: f65efd2 Add new init parameter enable_nl_thread.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Iulia Florea and others added 29 commits July 16, 2017 21:33
Signed-off-by: Iulia Florea <[email protected]>
Reviewed-by: Janne Peltonen <[email protected]>
Signed-off-by: Iulia Florea <[email protected]>
Reviewed-by: Janne Peltonen <[email protected]>
Move outbound IP header checksum insertion before GRE and VxLAN
encapsulation so that locally originated tunneled packets get
a valid header checksum.

Fixes: #169 Incorrect IP header checksum in locally originated tunneled packets

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Add a recursion counter in packet user area. Update and check it
when calling ofp_ip_output() from tunneling code.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Inject packets to the stack through single point in fragmentation tests.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Add a thread safe global IP ID allocator that shares the same state
across different code fragments and across different threads that do
not have to share address space.

This change adds the allocator but does not modify packet processing
that continues to use the old IP ID allocation methods.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Switch to use the global IP ID allocator. Do IP ID assignment in common
IP output processing and remove broken IP ID code from elsewhere.

Fixes: #170 Duplicate values in IPv4 identification field

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Incremental checksum update after TTL decrement was already present but
the checksum was always recalculated in output path from scratch anyway.
Now skip the full checksum calculation for forwarded packets except
the ones we fragment.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Shared memory blocks can now be preallocated during early initialization
phase before the actual allocation and use. The allocator will combine
all preallocated memory blocks into one big shared memory area from which
the actual allocations are done. This can be used to drastically reduce
the number of ODP shared memory blocks needed.

Shared memory blocks that are not preallocated continue to be separately
allocated from ODP as before.

This patch does not add any preallocations but just the infrastructure.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Preallocate most shared memory blocks to have them combined into
single common area. This prevents OFP from bumping as easily into any
limits on the number of ODP shared memory blocks and also improves
memory access locality a bit.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Brian Brooks <[email protected]>
Inexplicably, ofp_sblock() has been calling odp_spinlock_is_locked()
in case of non-blocking operation. The purpose of the function is to
lock the lock, so clearly odp_spinlock_trylock() must be called
here. Libuinet code calls VNET_SX_TRY_XLOCK() in the same place.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Brian Brooks <[email protected]>
Signed-off-by: Iulia Florea <[email protected]>
Reviewed-by: Jere Leppänen <[email protected]>
It's probably best to follow the lead of Linux and FreeBSD and enable
TCP delayed ack by default.

Testing with nginx_ofp and tcpperf doesn't reveal any problems.
Throughput in most test cases improves by 0-5%. There's an improvement of
10% or so when tcpperf is receiving and iperf is sending 1K messages
with TCP_NODELAY.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Remove register storage specifier from parameters of
ofp_cksum_buffer(). These are the only occurrences in the API.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
It's probably best to forward to slow path all the ICMP types we don't
have any processing for.

Removed useless check for invalid type numbers - let the slow path
handle that as well. As a result, the test case for invalid type was
also removed.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
This is a fix for Git Issue 121: Race condition in MAC address lookup.
Writing and reading a ARP cache entry was not atomic.
By removing the key from the structure we can make writing
and reading of cache atomic. As each cache points to ARP entry so to
check whether its a hit or not we compare the key with key present
in the entry.

Signed-off-by: Sirshak Das <[email protected]>
Reviewed-by: Brian Brooks <[email protected]>
Reviewed-by: Honnappa Nagarahalli <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Do not return OFP_PKT_DROP from TX burst sending code since the code
consumes all the packets, dropping those packets that could not be
sent (including the packet that triggered the output).

Fixes: #178 OFP crashes during output link congestion.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Change a couple of internal burst sending related functions to return void
because after the last fix they have only one return value.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
README.md is updated to contain only brief project description and
basic build instruction with further links to project architecture,
example applications README and new OFP User guide.

Signed-off-by: Viktor Tikkanen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Before the fix, the IPv6 route is not added:
> ifconfig -A inet6 fp0 2001::1/64

> route
Destination        Gateway         Iface  Flags

IPv6 routes
2001:0000:0000:0000:0000:0000:0000:0001/128 0000:0000:0000:0000:0000:0000:0000:0000  fp0  local

After the fix:
> ifconfig -A inet6 fp0 2001::1/64

> route
Destination        Gateway         Iface  Flags

IPv6 routes
2001:0000:0000:0000:0000:0000:0000:0000/64 0000:0000:0000:0000:0000:0000:0000:0000  fp0  net
2001:0000:0000:0000:0000:0000:0000:0001/128 0000:0000:0000:0000:0000:0000:0000:0000  fp0  local

Signed-off-by: Iulia Florea <[email protected]>
Reviewed-by: Jere Leppänen <[email protected]>
Fix warnings that appear when compiling using GCC 7.1.1. None of the
warnings are of a real problem.

Signed-off-by: Janne Peltonen <[email protected]>
Reviewed-by: Brian Brooks <[email protected]>
Change ARP free entry list and ARP table from Single Linked List to
Single Linked list Tail Queue. This prevents a recently deleted node
from getting reused immediately, and thus prevents an erroneous lookup
in case a worker thread still has a reference to a recently deleted node.

Signed-off-by: Sirshak Das <[email protected]>
Reviewed-by: Brian Brooks <[email protected]>
Reviewed-by: Honnappa Nagarahalli <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
When adding a new ARP entry and sending the queued packets, don't
update IP IDs or checksums. These are ready in the queued packets and
there's no need to touch them.

Particularly, if the IDs of fragments are re-generated, the fragments
end up with different IDs, leaving the receiver unable to match them
and reassemble the packet. This problem appeared in commit a31e31d.

Fixes: a31e31d Fix the generation of IPv4 identification field.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
When sending ICMP using icmp_reflect(), the received packet is used as
a base. IP options are retained, but IP header length is nevertheless
reset to 20 bytes. This causes the following problem:

$ echo "hello" | socat - UDP-DATAGRAM:11.0.0.10:65000,ip-options=x88041111
12:02:45.498600 IP (tos 0x0, ttl 64, id 21713, offset 0, flags [DF], proto UDP (17), length 38, options (unknown 136))
    11.0.0.20.43508 > 11.0.0.10.65000: [udp sum ok] UDP, length 6
13:17:28.405560 IP (tos 0x0, ttl 64, id 8, offset 0, flags [DF], proto ICMP (1), length 64)
    11.0.0.10 > 11.0.0.20: ICMP type-#136, length 44

Type 136 = 0x88, which is actually the number of the first IP option
in the triggering packet.

Since we don't have any IP option processing, the fix is to remove all
IP options in icmp_reflect().

Fixes: #179 ICMP packet is malformed if triggering packet contains IP options.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
Print routing rule details before freeing the rule.
Do not convert address from BE to native before output.

Signed-off-by: Viktor Tikkanen <[email protected]>
Reviewed-by: Sorin Vultureanu <[email protected]>
@JereLeppanen JereLeppanen merged commit 7219e78 into JereLeppanen:master Sep 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants