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>
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>
coverage: Use OVS_CONSTRUCTOR to initialize the coverage counter array

Use a static array in coverage.c that gets initialized by constructor
functions per coverage definition.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Remove unused USE_LINKER_SECTIONS and OVS_LINK2_IFELSE

They are unused and can be removed.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
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>
ovs-ofctl: Replace TODO with XXX.

In accordance with the style guidelines.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
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>