ofp-actions: helper functions for of12 set-field action

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ovs-ofputil: Make str_to_port_no() aware of invalid ports

Open Flow 1.1 and 1.2 make use of 32 bit ports, however Open vSwtich maps
them to 16 bits. Make ovs-ofputl aware of this.

Also, only accept ports that fit into 16 bits for Open Flow 1.0.

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

---

v13

* str_to_port_no(): Move ovs_fatal() in to be inside if() clause
  as that is the only case where it may be executed
* Add missing space to ovs_fatal() message.

v12
* No change

v11
* No change

v10
* No change

v9
* Manual Rebase

v8
* Omitted

v7
* Omitted

v6
* No change

v5
* Initial post
ofp-util: Pass vconn to fetch_port_by_features()

Pass vconn to fetch_port_by_features() and callers.
In some cases this will reduce the number of connections
that ovs-ofputil sets up.

It should not alter the behaviour of ovs-ofputil.

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

---

v13
* "struct vconn* vconn" -> "struct vconn *vconn"

v12
* No change

v11
* No change

v10
* No change

v9
* Manual rebase

v8
* Omitted

v7
* Omitted

v6
* No change

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

---

v13
* Merge the following patches
  - ofp-msgs: Split OFPRAW_OFPST_PORT_{REQUEST,REPLY}
  - ovs-ofctl: Teach dump-ports about Open Flow 1.1 & 1.2
  - ofp-util: Allow encoding of Open Flow 1.1 & 1.2 Port Statistics Reply Messages
  - ofp-print: Allow printing of Open Flow 1.1 & 1.2 Port Reply Messages
  - ofp-util: Allow decoding of Open Flow 1.1 & 1.2 Port Status Request Messages
  - ofp-print: Allow printing of Open Flow 1.1 & 1.2 Port Status Request Messages
* Move encoding and decoding into a helper functions

v12
* No change

v11
* No change

v10
* No change

v9
* Update description - this only prepares for both encoding and decoding
* Add ofp-print test
* Make use of enum ofp_version
* Correct printing of port number for Open Flow 1.0
* Replace UINT64_MAX with htonll(UINT64_MAX) in ofp_print_port_stat()
  to correct byte-order problem detected by sparse

v8
* Manual rebase
* Make use of enum ofp_version
* Add ofp-print test

v7
* Omitted

v6
* No change

v5
* No change

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