[ovs-dev] [async-msgs 10/13] ofp-util: New function ofputil_encode_barrier_request().

Ben Pfaff blp at nicira.com
Thu Jan 26 23:53:48 UTC 2012


This new function will acquire a new user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/ofp-util.c |    9 +++++++++
 lib/ofp-util.h |    2 ++
 lib/vconn.c    |    4 ++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 8bfaddf..fc57b3f 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -2201,6 +2201,15 @@ make_echo_reply(const struct ofp_header *rq)
     return out;
 }
 
+struct ofpbuf *
+ofputil_encode_barrier_request(void)
+{
+    struct ofpbuf *msg;
+
+    make_openflow(sizeof(struct ofp_header), OFPT_BARRIER_REQUEST, &msg);
+    return msg;
+}
+
 const char *
 ofputil_frag_handling_to_string(enum ofp_config_flags flags)
 {
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index 427a749..05ae009 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -309,6 +309,8 @@ struct ofpbuf *make_packet_in(uint32_t buffer_id, uint16_t in_port,
 struct ofpbuf *make_echo_request(void);
 struct ofpbuf *make_echo_reply(const struct ofp_header *rq);
 
+struct ofpbuf *ofputil_encode_barrier_request(void);
+
 const char *ofputil_frag_handling_to_string(enum ofp_config_flags);
 bool ofputil_frag_handling_from_string(const char *, enum ofp_config_flags *);
 
diff --git a/lib/vconn.c b/lib/vconn.c
index 8e6374e..5da5026 100644
--- a/lib/vconn.c
+++ b/lib/vconn.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -730,7 +730,7 @@ vconn_transact_noreply(struct vconn *vconn, struct ofpbuf *request,
     }
 
     /* Send barrier. */
-    make_openflow(sizeof(struct ofp_header), OFPT_BARRIER_REQUEST, &barrier);
+    barrier = ofputil_encode_barrier_request();
     barrier_xid = ((struct ofp_header *) barrier->data)->xid;
     error = vconn_send_block(vconn, barrier);
     if (error) {
-- 
1.7.2.5




More information about the dev mailing list