[ovs-dev] [PATCH 29/45] ofp-msgs: Split OFPRAW_OFPST_FLOW_{REQUEST, REPLY}

Simon Horman horms at verge.net.au
Mon Jul 30 02:03:27 UTC 2012


Split OFPRAW_OFPST_FLOW_{REQUEST,REPLY} into OpenFlow 1.0 and 1.1+
versions.

This is in preparation for adding encoding and decoding of
Open Flow 1.1 & 1.2 messages.

Signed-off-by: Simon Horman <horms at verge.net.au>

---

v8
* Initial post
---
 lib/ofp-msgs.h | 14 ++++++++++----
 lib/ofp-util.c | 10 +++++-----
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h
index 0683bc5..7e7b21b 100644
--- a/lib/ofp-msgs.h
+++ b/lib/ofp-msgs.h
@@ -180,12 +180,16 @@ enum ofpraw {
     OFPRAW_OFPST_DESC_REPLY,
 
     /* OFPST 1.0 (1): struct ofp10_flow_stats_request. */
-    OFPRAW_OFPST_FLOW_REQUEST,
+    OFPRAW_OFPST10_FLOW_REQUEST,
+    /* OFPST 1.1+ (1): struct ofp11_flow_stats_request, uint8_t[8][]. */
+    OFPRAW_OFPST11_FLOW_REQUEST,
     /* NXST 1.0 (0): struct nx_flow_stats_request, uint8_t[8][]. */
     OFPRAW_NXST_FLOW_REQUEST,
 
     /* OFPST 1.0 (1): uint8_t[]. */
-    OFPRAW_OFPST_FLOW_REPLY,
+    OFPRAW_OFPST10_FLOW_REPLY,
+    /* OFPST 1.1+ (1): uint8_t[]. */
+    OFPRAW_OFPST11_FLOW_REPLY,
     /* NXST 1.0 (0): uint8_t[]. */
     OFPRAW_NXST_FLOW_REPLY,
 
@@ -357,9 +361,11 @@ enum ofptype {
     /* Statistics. */
     OFPTYPE_DESC_STATS_REQUEST,      /* OFPRAW_OFPST_DESC_REQUEST. */
     OFPTYPE_DESC_STATS_REPLY,        /* OFPRAW_OFPST_DESC_REPLY. */
-    OFPTYPE_FLOW_STATS_REQUEST,      /* OFPRAW_OFPST_FLOW_REQUEST.
+    OFPTYPE_FLOW_STATS_REQUEST,      /* OFPRAW_OFPST10_FLOW_REQUEST.
+                                      * OFPRAW_OFPST11_FLOW_REQUEST.
                                       * OFPRAW_NXST_FLOW_REQUEST. */
-    OFPTYPE_FLOW_STATS_REPLY,        /* OFPRAW_OFPST_FLOW_REPLY.
+    OFPTYPE_FLOW_STATS_REPLY,        /* OFPRAW_OFPST10_FLOW_REPLY.
+                                      * OFPRAW_OFPST11_FLOW_REPLY.
                                       * OFPRAW_NXST_FLOW_REPLY. */
     OFPTYPE_AGGREGATE_STATS_REQUEST, /* OFPRAW_OFPST_AGGREGATE_REQUEST.
                                       * OFPRAW_NXST_AGGREGATE_REQUEST. */
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index fe68903..088bbc9 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1473,7 +1473,7 @@ ofputil_decode_flow_stats_request(struct ofputil_flow_stats_request *fsr,
     ofpbuf_use_const(&b, oh, ntohs(oh->length));
     raw = ofpraw_pull_assert(&b);
     switch ((int) raw) {
-    case OFPRAW_OFPST_FLOW_REQUEST:
+    case OFPRAW_OFPST10_FLOW_REQUEST:
         return ofputil_decode_ofpst_flow_request(fsr, b.data, false);
 
     case OFPRAW_OFPST_AGGREGATE_REQUEST:
@@ -1507,7 +1507,7 @@ ofputil_encode_flow_stats_request(const struct ofputil_flow_stats_request *fsr,
 
         raw = (fsr->aggregate
                ? OFPRAW_OFPST_AGGREGATE_REQUEST
-               : OFPRAW_OFPST_FLOW_REQUEST);
+               : OFPRAW_OFPST11_FLOW_REQUEST);
         msg = ofpraw_alloc(raw, OFP12_VERSION, 0);
         ofsr = ofpbuf_put_zeros(msg, sizeof *ofsr);
         ofsr->table_id = fsr->table_id;
@@ -1525,7 +1525,7 @@ ofputil_encode_flow_stats_request(const struct ofputil_flow_stats_request *fsr,
 
         raw = (fsr->aggregate
                ? OFPRAW_OFPST_AGGREGATE_REQUEST
-               : OFPRAW_OFPST_FLOW_REQUEST);
+               : OFPRAW_OFPST10_FLOW_REQUEST);
         msg = ofpraw_alloc(raw, OFP10_VERSION, 0);
         ofsr = ofpbuf_put_zeros(msg, sizeof *ofsr);
         ofputil_cls_rule_to_ofp10_match(&fsr->match, &ofsr->match);
@@ -1615,7 +1615,7 @@ ofputil_decode_flow_stats_reply(struct ofputil_flow_stats *fs,
 
     if (!msg->size) {
         return EOF;
-    } else if (raw == OFPRAW_OFPST_FLOW_REPLY) {
+    } else if (raw == OFPRAW_OFPST10_FLOW_REPLY) {
         const struct ofp10_flow_stats *ofs;
         size_t length;
 
@@ -1727,7 +1727,7 @@ ofputil_append_flow_stats_reply(const struct ofputil_flow_stats *fs,
     enum ofpraw raw;
 
     ofpraw_decode_partial(&raw, reply->data, reply->size);
-    if (raw == OFPRAW_OFPST_FLOW_REPLY) {
+    if (raw == OFPRAW_OFPST10_FLOW_REPLY) {
         struct ofp10_flow_stats *ofs;
 
         ofpbuf_put_uninit(reply, sizeof *ofs);
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list