summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJarno Rajahalme <jarno@ovn.org>2016-07-29 16:52:04 -0700
committerJarno Rajahalme <jarno@ovn.org>2016-07-29 16:52:04 -0700
commit25070e045e06b00b95ec71d846944feacd121555 (patch)
tree9def6b8d4f84640135ef75370c903f0247899b93 /include
parente8dba71979750edafcb0c73e53ef65d83db8d2bb (diff)
downloadopenvswitch-25070e045e06b00b95ec71d846944feacd121555.tar.gz
ofproto: Support group mods in bundles.
Allow adding group mods in OpenFlow bundles. Group mods are executed atomically with any flow mods in the same bundle. Mods are executed in order, so that groups appearing in flow actions need to be inserted in to the bundle before the dependent flow mods. ovs-ofctl is enhanced to allow the '--bundle' option with group mod commands. add-groups file format is enhanced to allow each line to be preceded by one of the keywords "add", "modify", "delete", "add_or_mod", "insert_bucket", or "remove_bucket". ovs-ofctl also has a new "bundle" command that reads a file in which each line contains one flow mod or group mod, and then executes them all as a single atomic bundle transaction. Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'include')
-rw-r--r--include/openvswitch/ofp-parse.h10
-rw-r--r--include/openvswitch/ofp-util.h16
2 files changed, 22 insertions, 4 deletions
diff --git a/include/openvswitch/ofp-parse.h b/include/openvswitch/ofp-parse.h
index a460d8a3e..df60b188e 100644
--- a/include/openvswitch/ofp-parse.h
+++ b/include/openvswitch/ofp-parse.h
@@ -33,6 +33,7 @@ struct ofputil_flow_stats_request;
struct ofputil_group_mod;
struct ofputil_meter_mod;
struct ofputil_table_mod;
+struct ofputil_bundle_msg;
struct ofputil_tlv_table_mod;
struct simap;
enum ofputil_protocol;
@@ -74,16 +75,21 @@ char *parse_flow_monitor_request(struct ofputil_flow_monitor_request *,
enum ofputil_protocol *usable_protocols)
OVS_WARN_UNUSED_RESULT;
-char *parse_ofp_group_mod_file(const char *file_name, uint16_t command,
+char *parse_ofp_group_mod_file(const char *file_name, int command,
struct ofputil_group_mod **gms, size_t *n_gms,
enum ofputil_protocol *usable_protocols)
OVS_WARN_UNUSED_RESULT;
-char *parse_ofp_group_mod_str(struct ofputil_group_mod *, uint16_t command,
+char *parse_ofp_group_mod_str(struct ofputil_group_mod *, int command,
const char *string,
enum ofputil_protocol *usable_protocols)
OVS_WARN_UNUSED_RESULT;
+char *parse_ofp_bundle_file(const char *file_name,
+ struct ofputil_bundle_msg **, size_t *n_bms,
+ enum ofputil_protocol *)
+ OVS_WARN_UNUSED_RESULT;
+
char *parse_ofp_tlv_table_mod_str(struct ofputil_tlv_table_mod *,
uint16_t command, const char *string,
enum ofputil_protocol *usable_protocols)
diff --git a/include/openvswitch/ofp-util.h b/include/openvswitch/ofp-util.h
index fecdb4348..c2dfe9da5 100644
--- a/include/openvswitch/ofp-util.h
+++ b/include/openvswitch/ofp-util.h
@@ -27,6 +27,7 @@
#include "openvswitch/netdev.h"
#include "openflow/netronome-ext.h"
#include "openflow/nicira-ext.h"
+#include "openvswitch/ofp-msgs.h"
#include "openvswitch/ofpbuf.h"
#include "openvswitch/types.h"
#include "openvswitch/type-props.h"
@@ -1327,8 +1328,6 @@ struct ofputil_bundle_add_msg {
const struct ofp_header *msg;
};
-enum ofptype;
-
enum ofperr ofputil_decode_bundle_ctrl(const struct ofp_header *,
struct ofputil_bundle_ctrl_msg *);
@@ -1344,6 +1343,19 @@ enum ofperr ofputil_decode_bundle_add(const struct ofp_header *,
struct ofputil_bundle_add_msg *,
enum ofptype *type);
+struct ofputil_bundle_msg {
+ enum ofptype type;
+ union {
+ struct ofputil_flow_mod fm;
+ struct ofputil_group_mod gm;
+ };
+};
+
+/* Destroys 'bms'. */
+void ofputil_encode_bundle_msgs(struct ofputil_bundle_msg *bms, size_t n_bms,
+ struct ovs_list *requests,
+ enum ofputil_protocol);
+
struct ofputil_tlv_map {
struct ovs_list list_node;