timeval: Don't require signals for time_alarm().

Before this patch, time_alarm() used the SIGALRM handler to notify
the poll loop that it should exit the program.  Instead, this patch
simply implements time_alarm() directly in the pool loop.  This
significantly simplifies the code, while removing a call to
timer_create() which is not currently supported on ESX.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
timeval: Recover from failed timer_create() calls.

The timer_create() system call is not supported in ESX and returns
an error when called.  Aborting when this system call fails seems a
bit extreme. So instead, this patch simply falls back to disabling
the cached time optimization.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
datapath: 64-bit GRE support

Extend GRE to have a 64-bit key. Use GRE sequence number to
store upper 32-bits of the key, but this is not standard way of
using GRE sequence number.

Bug #13186
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
config: Add explicit support for building on ESX.

The ESX userspace looks quite a bit like linux, but has some key
differences which need to be specially handled in the build.  To
distinguish between ESX and systems which use the linux datapath
module, this patch adds two new macros "ESX" and "LINUX_DATAPATH".
It uses these macros to disable building code on ESX which only
applies to a true Linux environment.  In addition, it adds a new
route-table-stub implementation which is required for the build to
complete successfully on ESX.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
datapath: Fix GRE tunnel without any key.

Commit 2de795adb96 (datapath: 64-bit GRE support) introduced a bug
for tunnels with no key. Following patch fixes it by setting tunnel
type to GRE type.

Bugs: 13511
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
datapath: Allow GRE64 tunnels without any key.

Now GRE64 deals with tunnel with no key and tunnel with zero key
as a same. This behaviour is different than standard GRE.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
build: Add support for building RPMs for Fedora Linux

Add RPM specfiles for building OVS for Fedora Linux. This
allows users of the upstream project the ability to
generate RPMs for their Open vSwitch needs.

Signed-off-by: Ralf Spenneberg <ralf@spenneberg.net>
[kmestery@cisco.com made substantial changes including
 writing documentation]
Signed-off-by: Kyle Mestery <kmestery@cisco.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Makefile.am: Distribute INSTALL.Fedora.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-msgs: Open Flow 1.1 and 1.2 Port Status Messages

This allows for encoding and decoding Open Flow 1.1 and 1.2 Port Stats
Request and Reply message

Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com added ofputil_count_port_stas(), simplified
 interface of ofputil_decode_port_stats(), style changes]
Signed-off-by: Ben Pfaff <blp@nicira.com>
nicira-ext: Correct and improve nx_flow_update_abbrev comment.

Notifications always precede a barrier that follows a given flow_mod,
not a barrier that precedes a flow_mod as the text here previously claimed.

Also, the text about abbreviated notifications is equally applicable
to normal, unabbreviated notifications, so say that explicitly.

Reported-by: Jean Tourrilhes <jt@hpl.hp.com>
Acked-by: Jean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib: Move addition of program_name to proctitle_set

Signed-off-by: Ed Maste <emaste@adaranet.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib: Use FreeBSD libc function for proctitle

FreeBSD libc's setproctitle provides the same interface as proctitle_set so
use it directly.

Signed-off-by: Ed Maste <emaste@adaranet.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Use enum ofperr in ofputil_decode_flow_removed()

The return type of both ofputil_decode_flow_removed() and nx_pull_match()
is enum ofperr so it makes sense for error be of that type too.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-msgs: Update for OpenFlow 1.1 & 1.2 Port Desc Stats

* Split OFPRAW_OFPST_PORT_DESC_REPLY into OpenFlow 1.0
  and OpenFlow 1.1+ versions.
* Allow OFPRAW_OFPST_PORT_DESC_REQUEST to be used for
  OpenFlow 1.0+ instead of only OpenFlow 1.0.

This appears to be necessary and sufficient to allow encoding of Port Desc
Stats reply messages and decoding of Port Desc Stats request messages. Or
in other words both the client and server side of ovs-ofctl dump-ports-desc

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Correct comment above ofputil_append_port_stat()

This function changed a few times before it was merged,
unfortunately at some point the comment wasn't kept in sync
with the changes.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-msgs: Open Flow 1.1 and 1.2 Queue Status Messages

This allows for encoding and decoding Open Flow 1.1 and 1.2 Queue Stats
Request and Reply messages.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Correct setting of Flow Mod cookie on encode

When the command of a Flow Mod messages is ADD the cookie should be set as
fm->new_cookie, this is the new cookie value to be set. Otherwise it
should be set as fm->cookie, internally this is the cookie value to match.

Also remove 'XXX' marker from the matching code in the decoder.
I am now comfortable with the implementation.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-print: Do not display flow mod cookie if it is UINT64_MAX

Internally UINT64_MAX is used to denote that the cookie
should not be changed, so it seems appropriate
to omit this value when pretty printing flow mods.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto: Do not add flow on flow mod if new_cookie is UINT64_MAX

Internally a new_cookie value UINT64_MAX is used for
an OpenFlow 1.2 flow mod whose command is not Add.
Open Flow 1.2 does not permit adding flows for such commands.
Also, UINT64_MAX is a prohibited cookie value, and the
existing code created a flow with that value as for the cookie.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto: Fix typo in macro name.

I like the sound of "evicton" but it isn't a real word.

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