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>
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>
netflow: Make thread safe.

In future patches upcall handler threads will need to update netflow.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto: New function netflow_exists().

Useful in future patches.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
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>
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>
ofproto: Retrieve ipfix, sflow and netflow in xlate_receive().

This seems cleaner than having separate accessors for them.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
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>
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>
ofproto: Replace reval_seq with a struct seq.

Future patches will need to poll_block() on it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto: Remove run_fast() functions.

They don't really make sense in a multithreaded architecture.  Once
flow miss batches are dispatched with, they will be extra useless.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-upcall: Add memory usage stats.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-upcall: New ovs-appctl upcall/show.

Shows debugging information related to upcall handling.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif: Remove avg_subfacet_life.

This is going to be hard to compute efficiently in the new
architecture introduced in future patches.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
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>
lib/ofp: Consolidate some struct field orders

Avoid "holes" in structs by moving "small" members together.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
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>
lib/mac-learning: Add missing semicolon

Does not matter as long as ovs_assert is a simple macro but if ovs_assert
is converted to a function this will fail.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
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>
compiler: Add OVS_CONSTRUCTOR to mark functions as init functions

Functions marked with OVS_CONSTRUCTOR are called unconditionally
before main.

Tested with GCC. Untested with MSVC.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>