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.
nx-match: Take into account leading header when calculating pad

In the case of Open Flow 1.2, which is currently the only
time that OXM is be used, there is a 4 byte header before
the match which needs to be taken into account when calculating
the pad length.

This is not entirely pretty, but it does seem to be correct.

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

---

v5
* Move nx_padded_match_len into nx-match.h as it will
  be used by code outside of nx-match.c added by subsequent patches.

v4
* Pad is needed even if match is zero length
  (what was I thinking?!)

v3
* Initial post
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>

---

v5
* No change

v4
* No change

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

v2
* No change
ofp-util: Allow decoder to use OFPT11_STATS_{REQUEST,REPLY} for OpenFlow 1.2

As the structures uses for encoding and decoding statistics request and
reply messages are largely the same between OpenFlow 1.1 and 1.2 it seems
to make sense to use OFPT11_STATS_{REQUEST,REPLY} for OpenFlow 1.2.

This patch prepares the decode path.

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

---

v5
* No change

v4
* Initial post
ofp-util: Make put_openflow_xid() aware of different OpenFlow versions.

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

---

v5
* No change

v4
* Initial post
ovs-controller: Make sure vconn is connected before making messages

This is a rather unpleasant hack but I am unsure of how to rework things
such that ovs-controller will work with a version of make_openflow() which
uses prevailing OpenFlow version in the header of OpenFlow messages.

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

---

v5
* No change

v4
* Initial post
ofp-util: Make make_openflow() aware of different OpenFlow versions.

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

---

v5
* No change

v4
* Initial post
ofp-util: Make make_openflow_xid() aware of different OpenFlow versions.

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

---

v5
* No change

v4
* Initial post
ofp-util: Make put_openflow() aware of different OpenFlow versions.

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

---

v5
* No change

v4
* Initial post
ofp-util: Make dump_transaction() aware of different OpenFlow versions.

This reworks dump_transaction() so that it takes a vconn
rather than opening one itself. This allows the caller
to use the negotiated Open Flow version of the connection
when creating messages to be sent.

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

---

v5
* No change

v5
* Rework to add vconn parameter to dump_transaction()

v4
* Initial post
ofp-util: Make put_stats*__() aware of different OpenFlow versions.

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

---

v5
* No change

v4
* Initial post
ofp-util: Make ofputil_make_stats_request() aware of different OpenFlow versions

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

---

v5
* Manual rebase

v4
* Initial post
ofp-util: Allow encoding of Open Flow 1.1 & 1.2 Barrier Request Messages

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

---

v5
* No change

v4
* Initial post
ofp-util: Make ofperr_encode_msg__() use correct Open Flow version

Make ofperr_encode_msg__() use correct Open Flow version in the header
of messages.

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

---

v5
* No change

v4
* Initial post
ofp-util: Make make_echo_request() aware of different OpenFlow versions.

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

---

v5
* No change

v4
* Initial post
openflow: Add Open Flow 1.2 to ofp_to_string__()

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

---

v5
* No change

v4
* No change

v3
* Add "openflow: " prefix to title

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>

---

v5
* No change

v4
* Manual rebase

v3
* Add "ofp-util:" prefix to title
* Set omh pointer after calling nx_put_match() as msg->data may change.
* Add default case to ensure that match_len can never be
  returned unless it was initialised.
* Correct calculation of omh for Open Flow 1.2

v2
* Initial post

Fix ofputil_put_match)
ofp-actions: Enhance ofpacts_to_openflow11 to encode instructions

This adds support for ofpacts_to_openflow11() to encode instructions
although at this point only the OFPIT11_APPLY_ACTIONS instruction
type is supported.

I am unsure if it would be better to use a new function that
wraps the existing ofpacts_to_openflow11(). But for now
I have simply modified ofpacts_to_openflow11().

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

---

v5
* No change

v4
* No change

v3
* Initial post
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>

---

v5
* No change

v3
* No change

v2
* Actually pass calculated protocol to ofputil_decode_flow_mod()
learning-switch: Call ofputil_encode_flow_mod() with correct protocol

Empirically it appears that process_packet_in() should call
ofputil_encode_flow_mod() with protocol as defived from rconn
rather than sw->protocol.

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

---

v5
* Actually retrieve protocol from rconn.
  This patch was dependent on a subsequent patch.

v4
* No change

v3
* Initial post