Re: [ovs-dev] [PATCH v2 21/26] ofproto: Support group mods in bundles.

2016-07-29 Thread Ben Pfaff
On Thu, Jul 28, 2016 at 05:56:13PM -0700, Jarno Rajahalme wrote:
> 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 

Very nice!

Acked-by: Ben Pfaff 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH v2 21/26] ofproto: Support group mods in bundles.

2016-07-28 Thread Jarno Rajahalme
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 
---
 NEWS|   7 +-
 include/openvswitch/ofp-parse.h |  10 +-
 include/openvswitch/ofp-util.h  |  16 +-
 lib/ofp-parse.c | 152 ++-
 lib/ofp-util.c  |  33 +++-
 ofproto/bundles.h   |   8 +-
 ofproto/ofproto.c   | 149 ++
 tests/ofproto-macros.at |   2 +
 tests/ofproto.at| 418 +++-
 utilities/ovs-ofctl.8.in|  56 --
 utilities/ovs-ofctl.c   |  95 -
 11 files changed, 871 insertions(+), 75 deletions(-)

diff --git a/NEWS b/NEWS
index 6f6b9a3..8221505 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ Post-v2.5.0
  * New "monitor_cond" "monitor_cond_update" and "update2" extensions to
RFC 7047.
- OpenFlow:
+ * OpenFlow 1.3+ bundles are now supported for group mods as well as
+   flow mods and port mods.  Both 'atomic' and 'ordered' bundle
+   flags are supported for group mods as well as flow mods.
  * OpenFlow 1.1+ OFPT_QUEUE_GET_CONFIG_REQUEST now supports OFPP_ANY.
  * OpenFlow 1.4+ OFPMP_QUEUE_DESC is now supported.
  * OpenFlow 1.4+ OFPT_TABLE_STATUS is now supported.
@@ -27,7 +30,9 @@ Post-v2.5.0
properly translated to OpenFlow 1.0.
- ovs-ofctl:
  * queue-get-config command now allows a queue ID to be specified.
- * '--bundle' option can now be used with OpenFlow 1.3.
+ * '--bundle' option can now be used with OpenFlow 1.3 and with group mods.
+ * New "bundle" command allows executing a mixture of flow and group mods
+   as a single atomic transaction.
  * New option "--color" to produce colorized output for some commands.
  * New option '--may-create' to use OFPGC_ADD_OR_MOD in mod-group command.
- IPFIX:
diff --git a/include/openvswitch/ofp-parse.h b/include/openvswitch/ofp-parse.h
index a460d8a..df60b18 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 fecdb43..c2dfe9d 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