Signed-off-by: Simon Horman <ho...@verge.net.au>

---

v5
* Manual rebase
* Place OFPST12_REPLY(OFPST11_AGGREGATE,... below
  OFPST12_REPLY(OFPST11_FLOW...
  This is consistent with the ordering for Open Flow 1.0.

v4
* Use OFPUTIL_OFPST11_AGGREGATE_REPLY as code for Open Flow 1.1 and 1.2
  messages.
* Don't explicitly pull message header pad,
  it is now handled by ofputil_make_stats_reply()
* Manual rebase

v3
* Initial post
---
 include/openflow/openflow-1.1.h | 10 ++++++++++
 lib/ofp-util.c                  | 14 +++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/include/openflow/openflow-1.1.h b/include/openflow/openflow-1.1.h
index dd87247..4cf2d74 100644
--- a/include/openflow/openflow-1.1.h
+++ b/include/openflow/openflow-1.1.h
@@ -617,6 +617,16 @@ OFP_ASSERT(sizeof(struct ofp11_flow_stats) == 48);
 /* Body for ofp_stats_request of type OFPST_AGGREGATE. */
 /* Identical to ofp11_flow_stats_request */
 
+/* Reply to OFPST_AGGREGATE request. */
+/* Same elements as ofp10_aggregate_stats_reply but different alignment */
+struct ofp11_aggregate_stats_reply {
+    ovs_be64 packet_count;    /* Number of packets in flows. */
+    ovs_be64 byte_count;      /* Number of bytes in flows. */
+    ovs_be32 flow_count;      /* Number of flows. */
+    uint8_t pad[4];           /* Align to 64 bits. */
+};
+OFP_ASSERT(sizeof(struct ofp11_aggregate_stats_reply) == 24);
+
 /* Body of reply to OFPST_TABLE request. */
 struct ofp11_table_stats {
     uint8_t table_id;        /* Identifier of table. Lower numbered tables
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 23b892b..e437185 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -952,6 +952,8 @@ static const struct ofputil_msg_type ofputil_msg_types[] = {
     }
     OFPST11_REPLY(OFPST_DESC, OFPST_DESC,
                   sizeof(struct ofp_desc_stats), 0),
+    OFPST11_REPLY(OFPST11_AGGREGATE, OFPST_AGGREGATE,
+                  sizeof(struct ofp11_aggregate_stats_reply), 0),
     OFPST11_REPLY(OFPST_PORT_DESC, OFPST_PORT_DESC,
                   0, sizeof(struct ofp11_port)),
 #undef OFPST11_REPLY
@@ -967,6 +969,8 @@ static const struct ofputil_msg_type ofputil_msg_types[] = {
     OFPST12_REPLY(OFPST_DESC, OFPST_DESC,
                   sizeof(struct ofp_desc_stats), 0),
     OFPST12_REPLY(OFPST11_FLOW, OFPST_FLOW, 0, 1),
+    OFPST12_REPLY(OFPST11_AGGREGATE, OFPST_AGGREGATE,
+                  sizeof(struct ofp11_aggregate_stats_reply), 0),
     OFPST12_REPLY(OFPST_PORT_DESC, OFPST_PORT_DESC,
                   0, sizeof(struct ofp11_port)),
 #undef OFPST12_REPLY
@@ -2469,7 +2473,15 @@ ofputil_encode_aggregate_stats_reply(
 
     ofputil_decode_msg_type(request, &type);
     code = ofputil_msg_type_code(type);
-    if (code == OFPUTIL_OFPST10_AGGREGATE_REQUEST) {
+    if (code == OFPUTIL_OFPST11_AGGREGATE_REQUEST) {
+        struct ofp11_stats_msg *osm;
+        struct ofp11_aggregate_stats_reply *asr;
+
+        asr = ofputil_make_stats_reply(sizeof *asr, request, &msg);
+        asr->packet_count = htonll(unknown_to_zero(stats->packet_count));
+        asr->byte_count = htonll(unknown_to_zero(stats->byte_count));
+        asr->flow_count = htonl(stats->flow_count);
+    } else if (code == OFPUTIL_OFPST10_AGGREGATE_REQUEST) {
         struct ofp10_aggregate_stats_reply *asr;
 
         asr = ofputil_make_stats_reply(sizeof *asr, request, &msg);
-- 
1.7.10.2.484.gcd07cc5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to