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

Simon Horman horms at verge.net.au
Thu Jun 14 10:43:24 UTC 2012


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

---

v2
* Use ofputil_put_match()
---
 lib/ofp-util.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 8047019..50c1d5e 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -2335,6 +2335,23 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
     struct ofpbuf *msg;
 
     switch (protocol) {
+    case OFPUTIL_P_OF12: {
+        struct ofp12_flow_removed *ofr;
+
+        ofr = make_openflow_xid(sizeof *ofr, OFPT_FLOW_REMOVED, 0, &msg);
+        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);
+        ofputil_put_match(msg, &fr->rule, 0, 0, protocol);
+        break;
+    }
+
     case OFPUTIL_P_OF10:
     case OFPUTIL_P_OF10_TID: {
         struct ofp_flow_removed *ofr;
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list