From: Ben Pfaff Date: Tue, 23 Nov 2010 21:19:50 +0000 (-0800) Subject: vconn: New function vconn_transact_multiple_noreply(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f009380f61edda538c4c4d6333a14014258ca8f;p=openvswitch vconn: New function vconn_transact_multiple_noreply(). This will be useful for sending a bunch of flow_mod messages all at once. --- diff --git a/lib/vconn.c b/lib/vconn.c index d6d2bf42..2df7a27a 100644 --- a/lib/vconn.c +++ b/lib/vconn.c @@ -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) { diff --git a/lib/vconn.h b/lib/vconn.h index 79666be3..8e321b28 100644 --- a/lib/vconn.h +++ b/lib/vconn.h @@ -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 *);