[ovs-dev] [PATCH 13/25] ofp-util: Allow encoding Open Flow 1.2 Flow Stats Request Messages

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


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

---

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

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 50c1d5e..be9a67a 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1974,6 +1974,24 @@ ofputil_encode_flow_stats_request(const struct ofputil_flow_stats_request *fsr,
     struct ofpbuf *msg;
 
     switch (protocol) {
+    case OFPUTIL_P_OF12: {
+        struct ofp11_flow_stats_request *ofsr;
+        int type;
+
+        type = fsr->aggregate ? OFPST_AGGREGATE : OFPST_FLOW;
+        ofsr = ofputil_make_stats_request(sizeof *ofsr, type, 0, &msg);
+        ofsr->table_id = fsr->table_id;
+        memset(ofsr->pad, 0, sizeof ofsr->pad);
+        ofsr->out_port = ofputil_port_to_ofp11(fsr->out_port);
+        ofsr->out_group = htonl(OFPG11_ANY);
+        memset(ofsr->pad2, 0, sizeof ofsr->pad2);
+        ofsr->cookie = fsr->cookie;
+        ofsr->cookie_mask = fsr->cookie_mask;
+        ofputil_put_match(msg, &fsr->match, fsr->cookie, fsr->cookie_mask,
+                          protocol);
+        break;
+    }
+
     case OFPUTIL_P_OF10:
     case OFPUTIL_P_OF10_TID: {
         struct ofp10_flow_stats_request *ofsr;
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list