[ovs-dev] [tests+nxm-ofctl 31/42] vconn: New function vconn_transact_multiple_noreply().
Justin Pettit
jpettit at nicira.com
Sun Dec 5 00:37:33 UTC 2010
Looks good.
--Justin
On Nov 23, 2010, at 2:44 PM, Ben Pfaff wrote:
> This will be useful for sending a bunch of flow_mod messages all at once.
> ---
> lib/vconn.c | 25 +++++++++++++++++++++++++
> lib/vconn.h | 3 +++
> 2 files changed, 28 insertions(+), 0 deletions(-)
>
> diff --git a/lib/vconn.c b/lib/vconn.c
> index c4afeeb..30ae8c9 100644
> --- a/lib/vconn.c
> +++ b/lib/vconn.c
> @@ -771,6 +771,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 79666be..8e321b2 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 *);
> --
> 1.7.1
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org
More information about the dev
mailing list