[ovs-dev] [PATCH] ofp-util: Add comment to ofputil_postappend_stats_reply().

Ben Pfaff blp at nicira.com
Thu Jul 5 18:12:08 UTC 2012


It seemed like it could use one.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/ofp-util.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index d9a77f1..99f92a8 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -3392,6 +3392,16 @@ ofputil_append_stats_reply(size_t len, struct list *replies)
     return ofpbuf_put_uninit(ofputil_reserve_stats_reply(len, replies), len);
 }
 
+/* Sometimes, when composing stats replies, it's difficult to predict how long
+ * an individual reply chunk will be before actually encoding it into the reply
+ * buffer.  This function allows easy handling of this case: just encode the
+ * reply, then use this function to break the message into two pieces if it
+ * exceeds the OpenFlow message limit.
+ *
+ * In detail, if the final stats message in 'replies' is too long for OpenFlow,
+ * this function breaks it into two separate stats replies, the first one with
+ * the first 'start_ofs' bytes, the second one containing the bytes from that
+ * offset onward. */
 void
 ofputil_postappend_stats_reply(size_t start_ofs, struct list *replies)
 {
-- 
1.7.2.5




More information about the dev mailing list