datapath: Check for backported skb_orphan_frags().

This was causing build failures on debian wheezy. Check for the feature
rather than the version.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
timeval: Preserve quiescence across time_poll().

Otherwise ovsrcu_synchronize() busy-waits in its loop because its
poll_block() un-quiesces, causing the global_seqno to increase, which is
what it waits for.

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
ovs-thread: Quiesce in xpthread_barrier_wait().

Otherwise the udpif revalidator threads can postpone RCU callbacks
essentially forever, especially if there are many revalidator threads and
little network traffic.

Reported-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
ovs-thread: Make caller provide thread name when creating a thread.

Thread names are occasionally very useful for debugging, but from time to
time we've forgotten to set one.  This commit adds the new thread's name
as a parameter to the function to start a thread, to make that mistake
impossible.  This also simplifies code, since two function calls become
only one.

This makes a few other changes to the thread creation function:

    * Since it is no longer a direct wrapper around a pthread function,
      rename it to avoid giving that impression.

    * Remove 'pthread_attr_t *' param that every caller supplied as NULL.

    * Change 'pthread *' parameter into a return value, for convenience.

The system-stats code hadn't set a thread name, so this fixes that issue.

This patch is a prerequisite for making RCU report the name of a thread
that is blocking RCU synchronization, because the easiest way to do that is
for ovsrcu_quiesce_end() to record the current thread's name.
ovsrcu_quiesce_end() is called before the thread function is called, so it
won't get a name set within the thread function itself.  Setting the thread
name earlier, as in this patch, avoids the problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
ovs-rcu: Log a helpful warning when ovsrcu_synchronize() stalls.

This made it easier for me to find a thread that was causing stalls.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
Prepare for 2.2.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Prepare for post-2.2.0 (2.2.90).

Signed-off-by: Justin Pettit <jpettit@nicira.com>
lacp: Don't lock potentially uninitialized mutex in lacp_status().

If the 'lacp' parameter is nonnull, then we know that the file scope mutex
has been initialized, since that's done as a side effect of creating a
lacp object, but otherwise there's no guarantee.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-thread: Add checking for mutex and rwlock initialization.

With glibc, a mutex or rwlock filled with all-zero-bytes is properly
initialized for use, but this is not true for any other libc that OVS
supports.  However, OVS gets a lot more testing with glibc than any other
libc.  This means that developers keep introducing bugs that do not
manifest on the main development platform.

This commit should help avoid the problem, by reusing the existing 'where'
members to indicate whether a mutex or rwlock has been initialized.

Signed-off-by: Ben Pfaff <blp@nicira.com>
tests: Fix up "ofproto-dpif - ofproto-dpif-monitor 1".

Commit 1335a8d578b03e (tests: Fix race condition waiting for monitor
thread.) fixed a race condition in a test.  Commit 8ba0a5227f6 (ovs-thread:
Make caller provide thread name when creating a thread.) slightly changed
the output that the test checked, breaking the test.  However, I was used
to the test occasionally failing due to the race (not realizing that the
race had been fixed) so I applied the commit anyway.

This commit fixes the broken test.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>