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>

---

v13
* Merged the following patches
  - ofp-msgs: Split OFPRAW_OFPST_QUEUE_{REQUEST,REPLY}
  - ofp-print: Enable display of Open Flow 1.1 & 1.2 Queue Status Reply Messages
  - ofp-util: Allow encoding of Open Flow 1.1 & 1.2 Queue Stats Reply Messages
  - ofp-util: Allow decoding of Open Flow 1.1 & 1.2 Queue Stats Request Messages
  - ovs-print: Enable display of Open Flow 1.1 & 1.2 Queue Stats Request
* Move ofp_print_ofpst_queue_reply() decode code into a helper function
* Move put_queue_stats() encode code into helper functions
* Move ofp_print_ofpst_queue_request parse code to helper functions
* Merged revision history of above patches follows

v12
* No change

v11
* No change

v10
* Manual rebase
* Make use of enum ofp_version
* Change subject name from "ovs-print: Enable display of Open Flow 1.1 &
  1.2 Queue Stats Response" to "ovs-print: Enable display of Open Flow 1.1
  & 1.2 Queue Stats Request"
* Add ofp-print test
* Use ofputil_port_from_ofp11 to decode port number

v9
* Omitted

v8
* Omitted

v7
* Omitted

v6
* No change

v5
* Initial Post
ovs-ofpctl: Enable queue-stats for Open Flow 1.1 & 1.2

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

---

v13
* Move encoder into helper functions

v12
* No change

v11
* No change

v10
* Manual rebase
* Make use of enum ofp_version

v9
* Omitted

v8
* Omitted

v7
* Omitted

v6
* The queue_id variable in do_dump_aggregate() should be uint32_t not
  uint16_t.

v5
* Initial Post
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>

---

v12
* No change

v11
* Initial post
ofproto: Use OFPERR_OFPFMFC_TABLE_FULL for OpenFlow 1.1+

Use OFPERR_OFPFMFC_ALL_TABLES_FULL in place of
OFPERR_OFPFMFC_TABLE_FULL for OpenFlow 1.1+.

OFPERR_OFPFMFC_ALL_TABLES_FULL only exists in OpenFlow 1.0.
OFPERR_OFPFMFC_TABLE_FULL was added in OpenFlow 1.1.

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

---

v12
* No change

v11
* Initial post
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->cookie, internally 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>

---

v12
* No change

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

---

v14
* Fix logic error in modify_flows_add.
  - Zero should be returned if fm->cookie_mask is non-zero.

v13
* Fix endienness issues in modify_flows_add()

v12
* No change

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

---

v12
* No change

v11
* Initial post
Use enum ofperr in ofputil_decode_flow_removed()

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

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

---

v12
* No change

v11
* Initial post
ofp-util: Allow OF1.2 to be used as a dump protocol

Allow OF1.2 to be used as a dump protocol and limit
the underling OpenFlow version for which a dump
protocol may be used.

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

---

v12
* No change

v11
* Initial post
ofp-util: Set Packet In Format: Use prevailing OpenFlow version

Signed-off-by: Simon Horman <horms@verge.net.au>
vconn: Allow passing a maximum Open Flow version

Signed-off-by: Simon Horman <horms@verge.net.au>
ofp-util: Allow use of OF12 flow format

This enables the use of the OF12 format, the prerequisites of which were
added by "Add OFPUTIL_P_OF12 and NXFF_OPENFLOW12" and patches to fill out
other functions that use OFPUTIL_P_OF12 directly.

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

---

v12
* No change

v11
* No change

v10
* No change

v9
* No change

v8
* Initial post
connmgr: Use version of underlying rconn

Signed-off-by: Simon Horman <horms@verge.net.au>
connmgr: connmgr_destroy(): Paramatise Open Flow version

Signed-off-by: Simon Horman <horms@verge.net.au>
ofproto: ofproto_run(): Paramatise Open Flow version

Signed-off-by: Simon Horman <horms@verge.net.au>
rconn: Add minimum and maximum OpenFlow versions

Add minimum and maximum OpenFlow versions to struct rconn to allow
reconnect to use these parameters rather than hard-coded defaults.

Signed-off-by: Simon Horman <horms@verge.net.au>
ofproto, connmgr: Parameterise OpenFlow versions for adding controller

Allow minimum and maximum versions to be passed rather
than relying on hard-coded defaults.

Signed-off-by: Simon Horman <horms@verge.net.au>
ofp-util: Add ofputil_protocols_{from,to}_string()

This is preparation for adding minimum and maximum OpenFlow versions as
command-line options for vswitchd and various utilities.

Signed-off-by: Simon Horman <horms@verge.net.au>
util: ovs_print_version(): Show names of OpenFlow versions

For backwards-compatibility also show the OpenFlow versions in hex

Signed-off-by: Simon Horman <horms@verge.net.au>
lib: Add helpers for OpenFlow version command line options

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