Thomas Graf [Tue, 17 Dec 2013 01:03:45 +0000 (17:03 -0800)]
datapath: Compute checksum in skb_gso_segment() if needed
The copy & csum optimization is no longer present with zerocopy
enabled. Compute the checksum in skb_gso_segment() directly by
dropping the HW CSUM capability from the features passed in.
Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Jesse Gross <jesse@nicira.com>
Thomas Graf [Tue, 17 Dec 2013 00:56:03 +0000 (16:56 -0800)]
datapath: Use skb_zerocopy() for upcall
Use of skb_zerocopy() can avoid the expensive call to memcpy()
when copying the packet data into the Netlink skb. Completes
checksum through skb_checksum_help() if not already done in
GSO segmentation.
Zerocopy is only performed if user space supported unaligned
Netlink messages. memory mapped netlink i/o is preferred over
zerocopy if it is set up.
Jesse Gross [Wed, 4 Dec 2013 04:41:15 +0000 (20:41 -0800)]
datapath: Backport skb_zerocopy() functions.
These functions will be factored out and exported upstream. On
kernels 3.5 and newer the backport will provide zero copy support
but older kernels will work as before (due to lack of skb->head_frag).
Francesco Fusco [Mon, 16 Dec 2013 09:22:43 +0000 (01:22 -0800)]
datapath: use CRC32 accelerated flow hash if available
Currently OVS uses jhash2() for calculating flow hashes in its
internal flow_hash() function. The performance of the flow_hash()
function is critical, as the input data can be hundreds of bytes
long.
OVS is largely deployed in x86_64 based datacenters. Therefore,
we argue that the performance critical fast path of OVS should
exploit underlying CPU features in order to reduce the per packet
processing costs. We replace jhash2 with the hash implementation
provided by the kernel hash lib, which exploits the crc32l
instruction to achieve high performance
Our patch greatly reduces the hash footprint from ~200 cycles of
jhash2() to around ~90 cycles in case of ovs_flow_hash_crc()
(measured with rdtsc over maximum length flow keys on an i7 Intel
CPU).
Additionally, we wrote a microbenchmark to stress the flow table
performance. The benchmark inserts random flows into the flow
hash and then performs lookups. Our hash deployed on a CRC32
capable CPU reduces the lookup for 1000 flows, 100 masks from
~10,100us to ~6,700us, for example.
Thus, simply use the newly introduced arch_fast_hash2() as a
drop-in replacement.
Signed-off-by: Francesco Fusco <ffusco@redhat.com> Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Thomas Graf <tgraf@redhat.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
Ben Pfaff [Mon, 16 Dec 2013 18:58:29 +0000 (10:58 -0800)]
connmgr: Fix attempt to take mutex recursively when exiting fail-open.
If one configured a controller which does not exist, waited for the switch
to enter fail-open mode, and then deleted the controller, then
ofproto_set_controllers() would take ofproto_mutex and call
update_fail_open(), which would call fail_open_destroy(), which would call
fail_open_recover(), which would call ofproto_delete_flow(), which requires
ofproto_mutex not to be held since it eventually try to take it. This
caused OVS to abort.
This fixes the problem by releasing ofproto_mutex earlier, since nothing
seems to require it being held so long (a comment in
connmgr_set_controllers() says that this is likely to be the case).
Better annotations would have found this problem at compile time. A later
patch adds them.
Reported-by: ZhengLingyun <konghuarukhr@163.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Ben Pfaff [Mon, 16 Dec 2013 17:20:12 +0000 (09:20 -0800)]
bridge: Remove superfluous "inline" from ofp12_controller_role_to_str().
Putting "static inline" on a function definition in a .c file does not help
the compiler and does suppress warnings for unused functions that one would
want, should the function ever become unused.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Joe Stringer <joestringer@nicira.com>
Jarno Rajahalme [Mon, 16 Dec 2013 16:14:52 +0000 (08:14 -0800)]
dpif: Allow execute to modify the packet.
Allowing the packet to be modified by execution allows less data
copying for userspace action execution. Some users of the
dpif_execute already expect that the packet may be modified. This
patch makes this behavior uniform and makes the userspace datapath and
the execution helpers modify the packet as it is being executed.
Userspace action now steals the packet if given permission, as the
packet is normally not needed after it. The only exception is the
sample action, and this is accounted for my keeping track of any
actions that could be following the userspace action.
The packet in dpif_upcall is changed from a pointer to a struct,
allowing the packet to be honest about it's headroom. After this
change the packet can safely be pushed on over the precarious 4 byte
limit earlier allowed by the netlink data preceding the packet.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Joe Stringer [Sat, 14 Dec 2013 01:24:10 +0000 (17:24 -0800)]
monitor: Replace monitor_seq with periodic wakeup
Currently, every time a monitoring port is added or reconfigured, the
main thread notifies the monitoring thread to wake up immediately using
monitor_seq. When adding a large number of ports at once, this causes
contention as the threads fight over access to the monitor heap---one
thread adding new ports, the other popping and processing the new ports.
This patch removes this mechanism in favour of a simple periodic wakeup
in the monitor thread. When configuring batches of 500 tunnels at once,
up to a total of 5000 tunnels, this reduces configuration time by up to
35%. New port monitor port configuration may not take effect for as long
as ~100ms, although it may be less if the timer has not recently timed
out, or if a monitoring port is due to send a packet.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Ben Pfaff [Fri, 13 Dec 2013 22:31:27 +0000 (14:31 -0800)]
ovs-thread: Fix crash by making count_cpu_count() return type a signed int.
ofproto_set_threads() uses the calculation MAX(count_cpu_cores() - 2, 1)
to decide on the default thread count. However, count_cpu_cores() returns
0 if it can't count the number of cores, or 1 if there's only one core,
and that causes the calculation to come out as UINT_MAX-2 or UINT_MAX-1,
respectively, which causes a memory allocation failure later.
There are other ways to fix this problem, too, of course.
Ben Pfaff [Thu, 2 May 2013 00:13:14 +0000 (17:13 -0700)]
dpif-linux: Fix fd leak for vports that disappear from the datapath.
When ovs-vswitchd deletes a port with dpif_linux_port_del(), that function
uses del_channel() to delete the corresponding channel, including closing
its Netlink socket fd. However, if the vport gets removed by some other
process (e.g. "ip link delete" for veths) then this function never gets
called and thus the channel never gets deleted.
This commit fixes the problem by resynchronizing channels with the
datapath whenever a vport gets deleted.
Bug #16784. Reported-by: Paul Ingram <paul@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ben Pfaff [Wed, 4 Dec 2013 21:37:31 +0000 (13:37 -0800)]
dpif-linux: Generalize dpif_linux_recv_set() to synchronize channels.
Until now, the code in dpif_linux_recv_set() has assumed it is starting
from a clean slate with no channels at all. This commit generalizes it to
compare the existing set of channels against the ones that should exist
given the vports that the kernel has, adding any new ones that are missing
and removing any that should not exist. A followup commit will make good
use of this functionality.
Alex Wang [Sat, 26 Oct 2013 00:18:02 +0000 (17:18 -0700)]
cfm: Refine the cfm_extended manual.
Commit 348f01e3e3 (cfm: Eight byte MPIDs in extended mode.) allows
eight byte MPIDs when running in extended mode. This commit explains
this change in the vswitch.conf.db.
Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-thread: Break recursion for coverage counters.
For systems that do not have either HAVE_THREAD_LOCAL or
HAVE___THREAD (ex: windows using MSVC), a COVERAGE_INC() calls xmalloc
which inturn calls COVERAGE_INC() creating a recursion that causes a
stack overflow.
This commit breaks the recursion by calling malloc() instead of
xmalloc().
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Joe Stringer [Sat, 14 Dec 2013 02:18:13 +0000 (02:18 +0000)]
cfm: Notify connectivity_seq on cfm_set_fault
Commit f23d157c ("ofproto-dpif: Don't poll ports when nothing changes"
changed how cfm information is propagated to ovsdb, but did not ensure
that this happened when users made "appctl cfm/set_fault" calls. This
patch fixes this case.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Ethan Jackson [Fri, 8 Nov 2013 21:47:49 +0000 (13:47 -0800)]
ofproto: Simplify thread creation API.
There's no particular reason for the function controlling the number
of threads to be bound up with dpif_recv_set(). This patch breaks
them up, but as a side effect means threads will run doing nothing
when datapath upcall receiving is disabled. By doing this, the udpif
thread creation API becomes a bit easier to reason about once there
are multiple types of thread introduced in future patches.
Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Sat, 7 Dec 2013 02:53:12 +0000 (18:53 -0800)]
flow: New function flow_unwildcard_tp_ports().
This patch adds a new function flow_unildcard_tp_ports() which doesn't
unwildcard the upper half of tp_src and tp_dst with ICMP packets.
Unfortunately, this matters in future patches when we compare masks
carefully to determine if flows should be evicted from the datapath.
Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Helmut Schaa [Fri, 13 Dec 2013 13:05:01 +0000 (14:05 +0100)]
vlog: Use OVS_CONSTRUCTOR for vlog initialization
This allows to get rid of some special segment handling to allow
distributed registering of vlog modules.
Instead use a global list and vlog module constructor functions to
build up the list. That means vlog modules reside within the
compilation unit they are defined in and can be iterated upon
by using the global list vlog_modules.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Helmut Schaa [Fri, 13 Dec 2013 13:17:17 +0000 (14:17 +0100)]
lib/util: Make some functions in util.c inline
str_to_uint, str_to_ulong and str_to_ullong are just wrappers
around the corresponding signed functions. Move these to util.h
and make them inline saving some library exports and letting
the compiler do some more magic.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Helmut Schaa [Fri, 13 Dec 2013 13:17:14 +0000 (14:17 +0100)]
lib/random: Make some functions in random.c inline
random_range, random_uint8 and random_uint16 are basically just wrappers
around random_uint32. Hence, don't export these functions so the compiler
can be smarter when it comes to optimizations.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Sat, 7 Dec 2013 23:04:09 +0000 (15:04 -0800)]
ofproto-dpif: Remove ovs-appctl dpif/del-flows.
It's not entirely clear why someone would want to delete the flows
associated with only one bridge and not be fine with simply using
ovs-dpctl del-flows to get all of them. Additionally, this will be
hard to implement cleanly in the future, so this patch removes it.
Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Thu, 5 Dec 2013 21:09:27 +0000 (13:09 -0800)]
ofproto-dpif-xlate: Add a mechanism to skip wildcard calculation.
As time goes on and the classifier becomes more complicated, calculate
the wildcard mask will get more and more expensive. This patch adds a
mechanism to xlate_actions() allowing callers to disable wildcard
calculation when it isn't really necessary. Used in future patches.
Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Wed, 13 Nov 2013 02:18:01 +0000 (18:18 -0800)]
ofproto: Move all statistics accounting into xlate_actions().
This patch moves statistics accounting for netflow, bonding, netdev,
and mirroring inside xlate_actions(). Moving all statistics into one
place makes it very difficult to mess up.
Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Simon Horman [Wed, 11 Dec 2013 01:23:36 +0000 (10:23 +0900)]
ovs-ofctl: Update push_mpls documentation
* The ethertype of the packet is always set to
the ethertype of the push_mpls action
* Drop references to unicast and multicast MPLS ethertypes,
in RFC5332 0x8847 and 0x8848 do not always have
those meanings.
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Wed, 30 Oct 2013 23:29:58 +0000 (16:29 -0700)]
ofproto: Handle netflow similarly to ipfix and sflow in xlate.
This patch changes how ofproto-dpif-xlate handles netflow so that it's
more similar to how ipfix and sflow are handled. This not only
simplifies the code, but it will allow xlate to call netflow in future
if necessary.
Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Ethan Jackson [Wed, 23 Oct 2013 06:07:55 +0000 (23:07 -0700)]
ofproto: Modularize netflow.
The netflow code has its tentacles all over the ofproto-dpif module.
This is fine today, but in future facets, which correspond roughly to
netflow_flows, will be retired. In preparation, this patch hides as
much implementation detail as possible inside the netflow module.
Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Joe Stringer [Fri, 13 Dec 2013 03:33:48 +0000 (03:33 +0000)]
ofproto-dpif: Only run bundles when lacp or bonds are enabled
When dealing with a large number of ports, bundle_run() and
bundle_wait() add significant unnecessary processing to the main run
loop, even when there are no bonds and lacp is not configured. This
patch skips such execution if it is unneeded, reducing average CPU usage
of the main thread from about 25% to about 20% in a test environment of
5000 internal ports and 50 tunnel ports running bfd.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Ethan Jackson [Fri, 15 Nov 2013 23:55:19 +0000 (15:55 -0800)]
ovs-dev.py: Build with both GCC and Clang.
Many deployments prefer to use gcc in production and it supports
sparse, while clang supports thread safety analysis and has
more/better warnings and error messages. This patch changes
ovs-dev.py to build with both so that developers are unlikely to miss
something that one or the other could catch.
Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Joe Stringer <joestringer@nicira.com>
Joe Stringer [Fri, 13 Dec 2013 03:33:49 +0000 (03:33 +0000)]
bridge: Only store instant_stats on device changes
Previously, we iterated through all interfaces in instant_stats_run(),
grabbing up-to-date information about device and port status. After
assembling all of this information for all interfaces, we would
determine whether anything changed and only send an update to
ovsdb-server if something changed.
This patch uses the new global connectivity_seq to determine whether
there have been any changes before polling all interfaces, which reduces
unnecessary processing in the average case. In a test environment of
5000 internal ports and 50 tunnel ports with bfd, this reduces average
CPU usage of the main thread from about 15% to about 5%. When ports
change status more often than every 100ms, CPU usage is expected to
increase to previous rates.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Joe Stringer [Fri, 13 Dec 2013 03:33:47 +0000 (03:33 +0000)]
ofproto-dpif: Don't poll ports when nothing changes
Previously, as part of ofproto-dpif run() processing, we would loop
through all ports and poll for changes to carrier, bfd, cfm and lacp
status. This information is used to determine whether bundles may be
enabled, and to perform revalidation when needed.
This patch makes the bfd, cfm, lacp and stp modules aware of the new
global connectivity_seq, notifying on changes in port status. We can
then use connectivity_seq to check if anything has changed before
looping through all ports in ofproto-dpif. In a test environment of 5000
internal ports and 50 tunnel ports with bfd, this reduces average CPU
usage of the main thread from about 35% to about 25%.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Joe Stringer [Fri, 13 Dec 2013 03:33:46 +0000 (03:33 +0000)]
netdev: Globally track port status changes
Previously, we tracked status changes for ofports on a per-device basis.
Each time in the main thread's loop, we would inspect every ofport
to determine whether the status had changed for corresponding devices.
This patch replaces the per-netdev change_seq with a global 'struct seq'
which tracks status change for all ports. In the average case where
ports are not constantly going up or down, this allows us to check the
sequence once per main loop and not poll any ports. In the worst case,
execution is expected to be similar to how it is currently.
In a test environment of 5000 internal ports and 50 tunnel ports with
bfd, this reduces average CPU usage of the main thread from about 40% to
about 35%.
Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Jarno Rajahalme [Thu, 12 Dec 2013 16:27:41 +0000 (08:27 -0800)]
lib/util: More portable use of builtin popcnt.
- Use the GCC predefined macro __POPCNT__ to detect the availability
of fast __builtin_popcnt function.
- Use portable preprocessor macros to detect 64-bit build.
- Only define the 32-bit parts when needed and declare the
count_1bits_8 at file scope to silence a warning.
This time I have tested all code paths to make sure no warnigns are
generated.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Reviewed-by: Simon Horman <horms@verge.net.au>
Ben Pfaff [Thu, 12 Dec 2013 01:55:26 +0000 (17:55 -0800)]
bridge: Reconfigure in single pass.
This greatly simplifies the reconfiguration code, making it much easier
to understand and modify. The old multi-pass configuration had the
property that it didn't delay block packet processing as much, but that's
not much of a worry anymore now that latency critical activities have
been moved outside the main thread.
Joe Stringer [Thu, 12 Dec 2013 05:46:22 +0000 (05:46 +0000)]
ovs-thread: Reduce logging level for cpuinfo parsing
This was causing test failures on non-Linux platforms.
Reported-by: Ed Maste <emaste@freebsd.org> Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Andy Zhou [Wed, 11 Dec 2013 07:32:51 +0000 (23:32 -0800)]
ofproto-dpif: Ignore non-packet field masks during flow revalidation
Commit bcd2633a5be(ofproto-dpif: Store relevant fields for wildcarding
in facet) implements flow revalidation by comparing the newly looked
up flow mask with that of the existing facet.
The non-packet fields, such as register masks, are always cleared
by xlate_actions in the masks stored within facets, but they are not
cleared in the newly looked up flow masks, causing otherwise valid
flows to be declared as invalid flows and be removed from the datapath.
This patch provides a fix. I was able to verify the fix on a system set
up by Ying Chen where the bug can be reproduced.
Ben Pfaff [Wed, 11 Dec 2013 06:42:07 +0000 (22:42 -0800)]
lacp: Make lacp negotiation test hard-code aggregation keys.
The lacp implementation takes the aggregation key from the key or portid
of the first slave to be added to the lacp object. When multiple slaves
are added initially to a lacp object (the most common case), which is the
"first" is arbitrary. Until now, it seems that the "first" was actually
predictable enough for the tests to (unknowingly) rely on it, but an
upcoming commit will break that. This commit fixes the test by forcing
a particular aggregation key for each lacp object.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Ben Pfaff [Mon, 9 Dec 2013 23:38:25 +0000 (15:38 -0800)]
ofproto: Make ofproto_enumerate_types() match its comment.
The comment says that it clears the passed-in sset, but it didn't. The bug
didn't actually affect any of the existing callers, which all passed in an
empty sset.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Jarno Rajahalme [Wed, 11 Dec 2013 19:07:01 +0000 (11:07 -0800)]
Classifier: Track address prefixes.
Add a prefix tree (trie) structure for tracking the used address
space, enabling skipping classifier tables containing longer masks
than necessary for an address field value in a packet header being
classified. This enables less unwildcarding for datapath flows in
parts of the address space without host routes.
Trie lookup is interwoven to the staged lookup, so that a trie is
searched only when the configured trie field becomes relevant
for the lookup. The trie lookup results are retained so that each
trie is checked at most once for each classifier lookup.
This implementation tracks the number of rules at each address prefix
for the whole classifier. More aggressive table skipping would be
possible by maintaining lists of tables that have prefixes at the
lengths encountered on tree traversal, or by maintaining separate
tries for subsets of rules separated by metadata fields.
Prefix tracking is configured via OVSDB. A new column "prefixes" is
added to the database table "Flow_Table". "prefixes" is a set of
string values listing the field names for which prefix lookup should
be used.
As of now, the fields for which prefix lookup can be enabled are:
- tun_id, tun_src, tun_dst
- nw_src, nw_dst (or aliases ip_src and ip_dst)
- ipv6_src, ipv6_dst
There is a maximum number of fields that can be enabled for any one
flow table. Currently this limit is 3.
Jarno Rajahalme [Wed, 11 Dec 2013 19:07:01 +0000 (11:07 -0800)]
dpif-netdev: Properly create exact match masks.
Normally OVS userspace supplies a mask along with a flow key for each
new data path flow that should be created. OVS also provides an
option to disable the kernel wildcarding, in which case the flows are
created without a mask. When kernel wildcarding is disabled, the
datapath should use exact match, i.e. not wildcard any bits in the
flow key. Currently, what happens with the userspace datapath instead
is that a datapath flow with mostly empty mask is created (i.e., most
fields are wildcarded), as the current code does not examine the given
mask key length to find out that the mask key is actually empty. This
results in the same datapath flow matching on packets of multiple
different flows, wrong actions being processed, and stats being
incorrect.
This patch refactors userspace datapath code to explicitly initialize
a suitable exact match mask when a flow put without a mask is
executed.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Joe Stringer [Tue, 26 Nov 2013 05:44:18 +0000 (05:44 +0000)]
bridge: Refresh STP statistics separately from status
Currently, we refresh STP status (id, state, role) alongside
statistics (rx, tx, errors), all within instant_stats_run(). This
patch splits statistics out, and refreshes them with the 5 second
stats instead. This paves the way to reducing execution of
instant_stats_run().
Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Joe Stringer [Fri, 6 Dec 2013 07:42:21 +0000 (07:42 +0000)]
lib: Determine cpu core count with /proc/cpuinfo.
On systems that provide /proc/cpuinfo similar to Linux on x86, this
should allow us to choose a better default value for the number of
upcall handler threads -- in particular, it avoids counting
hyper-thread cores. If /proc/cpuinfo cannot be parsed for any reason,
fall back to using sysconf().
Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Alex Wang [Tue, 10 Dec 2013 01:34:53 +0000 (17:34 -0800)]
bfd: Change the update of forwarding flag.
Currently, we update the forwarding flag in bfd_set_state() and in
bfd_forwarding_if_rx_update() if bfd_forwarding_if_rx is enabled.
However, these are not the exact places where the forwarding flag
needs to be updated. The exact places are in the bfd_process_packet()
where bfd status are changed based on received control packet, and in
the flow_push_stats() and compose_output_action__() where the
rx_packet counter is updated.
This commit changes the update of forwarding flag to the places
mentioned above.
Signed-off-by: Alex Wang <alexw@nicira.com> Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
Jarno Rajahalme [Wed, 27 Nov 2013 20:58:46 +0000 (12:58 -0800)]
util: Better count_1bits().
Inline, use another well-known algorithm for 64-bit builds, and use
builtins when they are known to be fast at compile time. A 32-bit
version of the alternate algorithm is slower than the existing
implementation, so the old one is used for 32-bit builds. Inline
assembler would be a bit faster on 32-bit i7 build, but we use the GCC
builtin for portability.
It should be stressed builds for specific CPUs do not work on others
CPUs, and that OVS build system or runtime does not currently support
CPU detection.
Pravin B Shelar [Fri, 6 Dec 2013 18:43:12 +0000 (10:43 -0800)]
datapath: compat: Fix Compiler error for kernel 3.3 to 3.8
Kernel 3.3 to 3.8 has defined `struct flow_keys` but does not
contains flow_keys.thoff field. Therefore we need to use
compat definition for flow_keys struct.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
Pravin B Shelar [Thu, 5 Dec 2013 23:50:27 +0000 (15:50 -0800)]
datapath: Use percpu allocator for flow-stats.
Use percpu allocator for stats due to objection to stats array.
But percpu allocator is not designed for high churn allocation/
deallcation. so we need to avoid allocating percpu flow for
short lived flows. One cheaper way to detect flow is by checking
if 5-tuple used in RSS are masked or not. if any one of them is
masked, flow is likely shared across CPU where percpu stat
should be more scalable. And that flow should be relatively
long lived flow.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
Pravin B Shelar [Tue, 3 Dec 2013 16:33:36 +0000 (08:33 -0800)]
datapath: Improve compat rxhash functionality.
Following patch improves rxhash calculation, It is taken from
upstream Linux kernel code.
From kernel 3.8, skb_get_rxhash() can handle hardware generated
l4-rxhash. Therefore compat skb_get_rxhash() is not used on
kernel 3.8 or new.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Reviewed-by: Thomas Graf <tgraf@redhat.com> Acked-by: Jesse Gross <jesse@nicira.com>
James Page [Thu, 5 Dec 2013 17:29:05 +0000 (17:29 +0000)]
Add check for -latomic
Later versions of gcc on some architectures push atomic functions
out into a separate atomic library; add a check to see when this
is required and add it to LIBS if need be.
Specifically the problem was observed on GCC 4.8.2 on powerpc
architecture for Ubuntu 14.04: