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

Simon Horman horms at verge.net.au
Mon Jun 25 06:44:30 UTC 2012


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

---

v4
* Manual rebase

v3
* No change

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

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 160bdb5..5bec44a 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1984,6 +1984,25 @@ ofputil_encode_flow_stats_request(const struct ofputil_flow_stats_request *fsr,
     uint8_t ofp_version = ofputil_protocol_to_ofp_version(protocol);
 
     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, ofp_version,
+                                          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