From 2a1c0549a3bfd9ef8528ebf7f34fec07ec509e11 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 23 May 2011 16:07:22 -0700 Subject: [PATCH] openflow: Merge ofp_flow_stats_request and ofp_aggregate_stats_request. --- include/openflow/openflow.h | 16 ++-------------- lib/ofp-util.c | 5 +---- ofproto/ofproto.c | 2 +- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/include/openflow/openflow.h b/include/openflow/openflow.h index 5329f20a..b7c7085d 100644 --- a/include/openflow/openflow.h +++ b/include/openflow/openflow.h @@ -706,7 +706,7 @@ enum ofp_stats_types { OFPST_FLOW, /* Aggregate flow statistics. - * The request body is struct ofp_aggregate_stats_request. + * The request body is struct ofp_flow_stats_request. * The reply body is struct ofp_aggregate_stats_reply. */ OFPST_AGGREGATE, @@ -759,7 +759,7 @@ struct ofp_desc_stats { }; OFP_ASSERT(sizeof(struct ofp_desc_stats) == 1056); -/* Body for stats request of type OFPST_FLOW. */ +/* Body for stats request of type OFPST_FLOW or OFPST_AGGREGATE. */ struct ofp_flow_stats_request { struct ofp_match match; /* Fields to match. */ uint8_t table_id; /* ID of table to read (from ofp_table_stats) @@ -792,18 +792,6 @@ struct ofp_flow_stats { }; OFP_ASSERT(sizeof(struct ofp_flow_stats) == 88); -/* Body for stats request of type OFPST_AGGREGATE. */ -struct ofp_aggregate_stats_request { - struct ofp_match match; /* Fields to match. */ - uint8_t table_id; /* ID of table to read (from ofp_table_stats) - or 0xff for all tables. */ - uint8_t pad; /* Align to 32 bits. */ - ovs_be16 out_port; /* Require matching entries to include this - as an output port. A value of OFPP_NONE - indicates no restriction. */ -}; -OFP_ASSERT(sizeof(struct ofp_aggregate_stats_request) == 44); - /* Body of reply to OFPST_AGGREGATE request. */ struct ofp_aggregate_stats_reply { ovs_32aligned_be64 packet_count; /* Number of packets in flows. */ diff --git a/lib/ofp-util.c b/lib/ofp-util.c index e96ace94..df084b0e 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -512,7 +512,7 @@ ofputil_decode_ofpst_request(const struct ofp_header *oh, { OFPUTIL_OFPST_AGGREGATE_REQUEST, OFPST_AGGREGATE, "OFPST_AGGREGATE request", - OSM_SIZE + sizeof(struct ofp_aggregate_stats_request), 0 }, + OSM_SIZE + sizeof(struct ofp_flow_stats_request), 0 }, { OFPUTIL_OFPST_TABLE_REQUEST, OFPST_TABLE, "OFPST_TABLE request", @@ -1099,9 +1099,6 @@ ofputil_encode_flow_stats_request(const struct flow_stats_request *fsr, struct ofp_flow_stats_request *ofsr; int type; - BUILD_ASSERT_DECL(sizeof(struct ofp_flow_stats_request) - == sizeof(struct ofp_aggregate_stats_request)); - type = fsr->aggregate ? OFPST_AGGREGATE : OFPST_FLOW; ofsr = ofputil_make_stats_request(sizeof *ofsr, type, &msg); ofputil_cls_rule_to_match(&fsr->match, &ofsr->match); diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 553680dc..e5bea041 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2066,7 +2066,7 @@ static int handle_aggregate_stats_request(struct ofconn *ofconn, const struct ofp_header *oh) { - const struct ofp_aggregate_stats_request *request = ofputil_stats_body(oh); + const struct ofp_flow_stats_request *request = ofputil_stats_body(oh); struct ofproto *ofproto = ofconn_get_ofproto(ofconn); struct ofp_aggregate_stats_reply *reply; struct cls_rule target; -- 2.30.2