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.

Signed-off-by: Ben Pfaff <blp@nicira.com>
fedora-build: Remove %{build_number} from the configure line

Fixes the OVS builds on Fedora, which are currently broken upstream.

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
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>
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>
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>