- *total_packetsp = total_packets;
- *total_bytesp = total_bytes;
- *n_flowsp = n_flows;
-}
-
-static int
-handle_aggregate_stats_request(struct ofconn *ofconn,
- const struct ofp_flow_stats_request *request)
-{
- struct ofproto *ofproto = ofconn_get_ofproto(ofconn);
- struct ofp_aggregate_stats_reply *reply;
- uint64_t total_packets, total_bytes;
- struct cls_rule target;
- struct ofpbuf *msg;
- uint32_t n_flows;
-
- ofputil_cls_rule_from_match(&request->match, 0, &target);
- query_aggregate_stats(ofproto, &target, request->out_port,
- request->table_id,
- &total_packets, &total_bytes, &n_flows);
-
- reply = ofputil_make_stats_reply(sizeof *reply, &request->osm, &msg);
- reply->flow_count = htonl(n_flows);
- put_32aligned_be64(&reply->packet_count, htonll(total_packets));
- put_32aligned_be64(&reply->byte_count, htonll(total_bytes));
- memset(reply->pad, 0, sizeof reply->pad);
-
- ofconn_send_reply(ofconn, msg);
-
- return 0;
-}
-
-static int
-handle_nxst_aggregate(struct ofconn *ofconn,
- const struct nx_aggregate_stats_request *nasr)
-{
- struct ofproto *ofproto = ofconn_get_ofproto(ofconn);
- struct nx_aggregate_stats_request *request;
- struct nx_aggregate_stats_reply *reply;
- uint64_t total_packets, total_bytes;
- struct cls_rule target;
- struct ofpbuf *msg;
- uint32_t n_flows;
- struct ofpbuf b;
- int error;
-
- ofpbuf_use_const(&b, nasr, ntohs(nasr->nsm.vsm.osm.header.length));
-
- /* Dissect the message. */
- request = ofpbuf_pull(&b, sizeof *request);
- error = nx_pull_match(&b, ntohs(request->match_len), 0, &target);
- if (error) {
- return error;
- }
- if (b.size) {
- return ofp_mkerr(OFPET_BAD_REQUEST, OFPBRC_BAD_LEN);
- }
-
- /* Count statistics. */
- query_aggregate_stats(ofproto, &target, request->out_port,
- request->table_id,
- &total_packets, &total_bytes, &n_flows);
-
- /* Reply. */
- COVERAGE_INC(ofproto_flows_req);
- reply = ofputil_make_stats_reply(sizeof *reply, &request->nsm.vsm.osm,
- &msg);
- reply->flow_count = htonl(n_flows);
- reply->packet_count = htonll(total_packets);
- reply->byte_count = htonll(total_bytes);
- memset(reply->pad, 0, sizeof reply->pad);
- ofconn_send_reply(ofconn, msg);