[ovs-dev] [PATCH 11/41] ofp-util: Allow encoding of Open Flow 1.2 Flow Removed messages

Simon Horman horms at verge.net.au
Tue Aug 7 21:49:46 UTC 2012


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

---

v10
* No change

v9
* No change

v8
* Manual Rebase

v7
* Omitted

v6
* No change

v5
* No change

v4
* Manual rebase

v3
* No change

v2
* Use ofputil_put_match()
---
 lib/ofp-msgs.h |  3 +++
 lib/ofp-util.c | 21 ++++++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h
index 62cdf66..05ef334 100644
--- a/lib/ofp-msgs.h
+++ b/lib/ofp-msgs.h
@@ -134,6 +134,8 @@ enum ofpraw {
 
     /* OFPT 1.0 (11): struct ofp_flow_removed. */
     OFPRAW_OFPT10_FLOW_REMOVED,
+    /* OFPT 1.1+ (11): struct ofp11_flow_removed, uint8_t[8][]. */
+    OFPRAW_OFPT11_FLOW_REMOVED,
     /* NXT 1.0+ (14): struct nx_flow_removed, uint8_t[8][]. */
     OFPRAW_NXT_FLOW_REMOVED,
 
@@ -332,6 +334,7 @@ enum ofptype {
                                   * OFPRAW_OFPT12_PACKET_IN.
                                   * OFPRAW_NXT_PACKET_IN. */
     OFPTYPE_FLOW_REMOVED,        /* OFPRAW_OFPT10_FLOW_REMOVED.
+                                  * OFPRAW_OFPT11_FLOW_REMOVED.
                                   * OFPRAW_NXT_FLOW_REMOVED. */
     OFPTYPE_PORT_STATUS,         /* OFPRAW_OFPT10_PORT_STATUS.
                                   * OFPRAW_OFPT11_PORT_STATUS. */
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 10b4555..462db2a 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1861,6 +1861,26 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
     struct ofpbuf *msg;
 
     switch (protocol) {
+    case OFPUTIL_P_OF12: {
+        struct ofp12_flow_removed *ofr;
+
+        msg = ofpraw_alloc_xid(OFPRAW_OFPT11_FLOW_REMOVED,
+                               ofputil_protocol_to_ofp_version(protocol),
+                               htonl(0), NXM_TYPICAL_LEN);
+        ofr = ofpbuf_put_zeros(msg, sizeof *ofr);
+        ofr->cookie = fr->cookie;
+        ofr->priority = htons(fr->rule.priority);
+        ofr->reason = fr->reason;
+        ofr->table_id = 0;
+        ofr->duration_sec = htonl(fr->duration_sec);
+        ofr->duration_nsec = htonl(fr->duration_nsec);
+        ofr->idle_timeout = htons(fr->idle_timeout);
+        ofr->packet_count = htonll(fr->packet_count);
+        ofr->byte_count = htonll(fr->byte_count);
+        oxm_put_match(msg, &fr->rule);
+        break;
+    }
+
     case OFPUTIL_P_OF10:
     case OFPUTIL_P_OF10_TID: {
         struct ofp_flow_removed *ofr;
@@ -1903,7 +1923,6 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
         break;
     }
 
-    case OFPUTIL_P_OF12:
     default:
         NOT_REACHED();
     }
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list