tests: Add $(check_DATA) to check-valgrind dependencies.

Otherwise if you run "check-valgrind" in a tree where you've never run
"check", you get some test failures because some data files don't get
generated before the tests run.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto: Remove member whose value is always -1 from struct ofoperation.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Add OFPUTIL_ACTION_INVALID to enum ofputil_action_code.

Possibly the ofputil_decode_action() interface should be rethought now
that ofputil_action_code has an invalid value.

Reviewed-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Introduce ofpacts, an abstraction of OpenFlow actions.

OpenFlow actions have always been somewhat awkward to handle.
Moreover, over time we've started creating actions that require more
complicated parsing.  When we maintain those actions internally in
their wire format, we end up parsing them multiple times, whenever
we have to look at the set of actions.

When we add support for OpenFlow 1.1 or later protocols, the situation
will get worse, because these newer protocols support many of the same
actions but with different representations.  It becomes unrealistic to
handle each protocol in its wire format.

This commit adopts a new strategy, by converting OpenFlow actions into
an internal form from the wire format when they are read, and converting
them back to the wire format when flows are dumped.  I believe that this
will be more maintainable over time.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Remove unused functions.

Signed-off-by: Ben Pfaff <blp@nicira.com>
openflow: Separate flow stats headers from their bodies.

For some time, Open vSwitch has combined both ofp_stats_msg and
the data that follows it into single structures, because we found
that this is usually easier to handle.than having them separated.
But OpenFlow 1.1+ has a different stats message header (it has 4
extra bytes of padding) whereas many of the bodies are the same
or similar and so this approach falls down there.  Therefore, this
commit switches back to separated header and body for stats
messages.

Signed-off-by: Ben Pfaff <blp@nicira.com>
openflow: Rename OpenFlow 1.0 statistics messages with "10" infix.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-actions: Support decoding OpenFlow 1.1 instructions and actions.

This builds and doesn't break any existing unit tests, but nothing
calls it yet (and it doesn't have any unit tests of its own) so it
can hardly be called useful.

Left to do:

    - Instructions other than Apply-Actions.

    - Actions other than the ones that have identical semantics to
      OpenFlow 1.0 actions.

    - Unit tests.

    - Encoding.
ofp-util: Refactor ofputil_decode_msg_type__() for extensibility.

There's an upcoming need to decode yet another variant of OpenFlow
messages: OpenFlow 1.1 statistics requests and replies.  The code for
decoding messages types is getting unmanageable.  This commit refactors it
to make it easier to maintain and extend.

Before this is committed it needs the following work:

    - One unit test fails because this commit removes a log message that
      was previously omitted.  That needs to be resolved somehow.

    - Figure out whether the nasty macros here are really the best way to
      construct the table.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: work on OF1.1 stats messages

This is a start at extending the stats message helpers to support OF1.1
stats messages too.  It isn't complete, doesn't compile, and I'm not fond
of the approach.

Signed-off-by: Ben Pfaff <blp@nicira.com>
openflow: Separate OF1.0, OF1.1 flow_mod constants and types.

Probably incomplete.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Work on decoding OF1.1 flow_mods.

A work in progress.  Doesn't build.

I'm not really sure I want separate OFPUTIL_ constants for OF1.0 and OF1.1
versions of each message.  It's something I'm trying out as I write the
code.

Incorporate a bug fix from Simon Horman <horms@verge.net.au>.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Local Fix: ofp-util: Work on decoding OF1.1 flow_mods.

This is a local change to fix some compile errors in
Ben Pfaff's "ofp-util: Work on decoding OF1.1 flow_mods." patch.

It should either be rolled into those changes or dropped.
Local Fix: ofpacts_pull_openflow11_instructions() return value

This is a local fix that proposes a change in the return value
of ofpacts_pull_openflow11_instructions(). It should either
be rolled into Ben Pfaff's patch that adds that function or dropped.

I this does not fix an observed problem, rather it is purely
the result of code review.
ofp-util: Add OFPUTIL_P_OF12 and NXFF_OPENFLOW12

Add OFPUTIL_P_OF12 and NXFF_OPENFLOW12 for Open Flow 1.2

OFPUTIL_P_OF12_TID and in turn OFPUTIL_P_OF12_ANY is not provided as
OFPUTIL_P_OF12 supports the use of table ids in modify flow messages.

Signed-off-by: Simon Horman <horms@verge.net.au>

---

v3
* Don't add NXPIF_OPENFLOW12, it doesn't seem to be needed

v2
* No change
openflow: Add Open Flow 1.2 to ofp_to_string__()

Signed-off-by: Simon Horman <horms@verge.net.au>

---

v3
* Add "openflow: " prefix to title

v2
* No change
openflow: Add ofp11_group

OFPG11_ANY may be used as the out_gropu for ofp11_flow_mod and
ofp11_flow_stats_request.

Signed-off-by: Simon Horman <horms@verge.net.au>

---

v3
* No change

v2
* No change
ofp-util: Add ofputil_put_match()

This wraps nx_put_match() to provide an extra header as necessary.

For Open Flow 1.0 + NXM extensions nx_put_match() is comprises
the entire match.

For Open Flow 1.2 a header is required before
the match supplied by x_put_match().

Signed-off-by: Simon Horman <horms@verge.net.au>

---

v3
* Add "ofp-util:" prefix to title
* Set omh pointer after calling nx_put_match() as msg->data may change.

v2
* Initial post
ofp-actions: Support encoding OpenFlow 1.1 instructions and actions.

I am unsure about what to do about some of the messages,
as noted with 'FIXME' in the code.

Signed-off-by: Simon Horman <horms@verge.net.au>

---

v3
* No change

v2
* Initial posting
ofp-print: Use the prevailing protocol to call ofputil_decode_flow_mod()

Pass a protocol based on the prevailing protocol to ofputil_decode_flow_mod()

Note that ofputil_protocol_from_ofp_version() needs to be made
Open Flow 1.1 aware.

Signed-off-by: Simon Horman <horms@verge.net.au>

---

v3
* No change

v2
* Actually pass calculated protocol to ofputil_decode_flow_mod()