summaryrefslogtreecommitdiff
path: root/lib/ofp-flow.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2018-02-15 14:38:28 -0800
committerBen Pfaff <blp@ovn.org>2018-03-14 11:29:19 -0700
commit225c33ba64a4de1aa30b05f8549c0628fe7fe6e3 (patch)
tree1822c7bcd2e3421e5f819ecc25f5fd8e9a605fbf /lib/ofp-flow.c
parent62bba609351a8c71319f80a59731a3810c873d27 (diff)
downloadopenvswitch-225c33ba64a4de1aa30b05f8549c0628fe7fe6e3.tar.gz
ofp-protocol: Better abstract changing the protocol used for flow matches.
The previous interface here required the client to understand, to some extent, the low-level NXFF_* values and the encoding format for the NXT_SET_FLOW_FORMAT and NXT_SET_FLOW_MOD_TABLE_ID messages. This commit changes the interface so that the client only has to understand the ofputil_protocol type used elsewhere and none of the encoding otherwise. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
Diffstat (limited to 'lib/ofp-flow.c')
-rw-r--r--lib/ofp-flow.c72
1 files changed, 1 insertions, 71 deletions
diff --git a/lib/ofp-flow.c b/lib/ofp-flow.c
index c29f5b7cb..af6be7490 100644
--- a/lib/ofp-flow.c
+++ b/lib/ofp-flow.c
@@ -34,77 +34,7 @@
VLOG_DEFINE_THIS_MODULE(ofp_flow);
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
-
-/* Returns an NXT_SET_FLOW_FORMAT message that can be used to set the flow
- * format to 'nxff'. */
-struct ofpbuf *
-ofputil_encode_nx_set_flow_format(enum nx_flow_format nxff)
-{
- struct nx_set_flow_format *sff;
- struct ofpbuf *msg;
-
- ovs_assert(ofputil_nx_flow_format_is_valid(nxff));
-
- msg = ofpraw_alloc(OFPRAW_NXT_SET_FLOW_FORMAT, OFP10_VERSION, 0);
- sff = ofpbuf_put_zeros(msg, sizeof *sff);
- sff->format = htonl(nxff);
-
- return msg;
-}
-
-/* Returns the base protocol if 'flow_format' is a valid NXFF_* value, false
- * otherwise. */
-enum ofputil_protocol
-ofputil_nx_flow_format_to_protocol(enum nx_flow_format flow_format)
-{
- switch (flow_format) {
- case NXFF_OPENFLOW10:
- return OFPUTIL_P_OF10_STD;
-
- case NXFF_NXM:
- return OFPUTIL_P_OF10_NXM;
-
- default:
- return 0;
- }
-}
-
-/* Returns true if 'flow_format' is a valid NXFF_* value, false otherwise. */
-bool
-ofputil_nx_flow_format_is_valid(enum nx_flow_format flow_format)
-{
- return ofputil_nx_flow_format_to_protocol(flow_format) != 0;
-}
-
-/* Returns a string version of 'flow_format', which must be a valid NXFF_*
- * value. */
-const char *
-ofputil_nx_flow_format_to_string(enum nx_flow_format flow_format)
-{
- switch (flow_format) {
- case NXFF_OPENFLOW10:
- return "openflow10";
- case NXFF_NXM:
- return "nxm";
- default:
- OVS_NOT_REACHED();
- }
-}
-
-/* Returns an OpenFlow message that can be used to turn the flow_mod_table_id
- * extension on or off (according to 'flow_mod_table_id'). */
-struct ofpbuf *
-ofputil_make_flow_mod_table_id(bool flow_mod_table_id)
-{
- struct nx_flow_mod_table_id *nfmti;
- struct ofpbuf *msg;
-
- msg = ofpraw_alloc(OFPRAW_NXT_FLOW_MOD_TABLE_ID, OFP10_VERSION, 0);
- nfmti = ofpbuf_put_zeros(msg, sizeof *nfmti);
- nfmti->set = flow_mod_table_id;
- return msg;
-}
-
+
struct ofputil_flow_mod_flag {
uint16_t raw_flag;
enum ofp_version min_version, max_version;