+static void
+query_aggregate_stats(struct ofproto *ofproto, struct cls_rule *target,
+ uint16_t out_port, uint8_t table_id,
+ struct ofp_aggregate_stats_reply *oasr)
+{
+ struct aggregate_stats_cbdata cbdata;
+
+ COVERAGE_INC(ofproto_agg_request);
+ cbdata.ofproto = ofproto;
+ cbdata.out_port = out_port;
+ cbdata.packet_count = 0;
+ cbdata.byte_count = 0;
+ cbdata.n_flows = 0;
+ classifier_for_each_match(&ofproto->cls, target,
+ table_id_to_include(table_id),
+ aggregate_stats_cb, &cbdata);
+
+ oasr->flow_count = htonl(cbdata.n_flows);
+ oasr->packet_count = htonll(cbdata.packet_count);
+ oasr->byte_count = htonll(cbdata.byte_count);
+ memset(oasr->pad, 0, sizeof oasr->pad);
+}
+