]> git.proxmox.com Git - mirror_ovs.git/commitdiff
vconn: New function vconn_transact_multiple_noreply().
authorBen Pfaff <blp@nicira.com>
Tue, 23 Nov 2010 21:19:50 +0000 (13:19 -0800)
committerBen Pfaff <blp@nicira.com>
Mon, 6 Dec 2010 18:03:32 +0000 (10:03 -0800)
This will be useful for sending a bunch of flow_mod messages all at once.

lib/vconn.c
lib/vconn.h

index d6d2bf42e5291420445da00b8c7115f8d331c516..2df7a27ac121c9ff5279f94f086b1493c9aaff45 100644 (file)
@@ -775,6 +775,31 @@ vconn_transact_noreply(struct vconn *vconn, struct ofpbuf *request,
     }
 }
 
+/* vconn_transact_noreply() for a list of "struct ofpbuf"s, sent one by one.
+ * All of the requests on 'requests' are always destroyed, regardless of the
+ * return value. */
+int
+vconn_transact_multiple_noreply(struct vconn *vconn, struct list *requests,
+                                struct ofpbuf **replyp)
+{
+    struct ofpbuf *request, *next;
+
+    LIST_FOR_EACH_SAFE (request, next, list_node, requests) {
+        int error;
+
+        list_remove(&request->list_node);
+
+        error = vconn_transact_noreply(vconn, request, replyp);
+        if (error || *replyp) {
+            ofpbuf_list_delete(requests);
+            return error;
+        }
+    }
+
+    *replyp = NULL;
+    return 0;
+}
+
 void
 vconn_wait(struct vconn *vconn, enum vconn_wait_type wait)
 {
index 79666be3d6ff2644871ed3f468feb338a76a30ae..8e321b282adffe17fb0b947a3ca51632ea2d7f4a 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "flow.h"
 
+struct list;
 struct ofpbuf;
 struct ofp_action_header;
 struct ofp_header;
@@ -49,6 +50,8 @@ int vconn_send(struct vconn *, struct ofpbuf *);
 int vconn_recv_xid(struct vconn *, uint32_t xid, struct ofpbuf **);
 int vconn_transact(struct vconn *, struct ofpbuf *, struct ofpbuf **);
 int vconn_transact_noreply(struct vconn *, struct ofpbuf *, struct ofpbuf **);
+int vconn_transact_multiple_noreply(struct vconn *, struct list *requests,
+                                    struct ofpbuf **replyp);
 
 void vconn_run(struct vconn *);
 void vconn_run_wait(struct vconn *);