Signed-off-by: Simon Horman <ho...@verge.net.au> ---
v5 * Initial Post --- lib/ofp-util.c | 4 ++++ ofproto/ofproto.c | 33 +++++++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index f430dc3..99d4269 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -901,6 +901,8 @@ static const struct ofputil_msg_type ofputil_msg_types[] = { OFPST11_REQUEST(OFPST_TABLE, OFPST_TABLE, 0, 0), OFPST11_REQUEST(OFPST_PORT, OFPST_PORT, sizeof(struct ofp11_port_stats_request), 0), + OFPST11_REQUEST(OFPST_QUEUE, OFPST_QUEUE, + sizeof(struct ofp11_queue_stats_request), 0), OFPST11_REQUEST(OFPST_PORT_DESC, OFPST_PORT_DESC, 0, 0), #undef OFPST11_REQUEST @@ -920,6 +922,8 @@ static const struct ofputil_msg_type ofputil_msg_types[] = { OFPST12_REQUEST(OFPST_TABLE, OFPST_TABLE, 0, 0), OFPST12_REQUEST(OFPST_PORT, OFPST_PORT, sizeof(struct ofp11_port_stats_request), 0), + OFPST12_REQUEST(OFPST_QUEUE, OFPST_QUEUE, + sizeof(struct ofp11_queue_stats_request), 0), OFPST12_REQUEST(OFPST_PORT_DESC, OFPST_PORT_DESC, 0, 0), #undef OFPST12_REQUEST diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 4c5fe9b..9c5c0b2 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2865,18 +2865,43 @@ handle_queue_stats_request(struct ofconn *ofconn, const struct ofp_header *rq) { struct ofproto *ofproto = ofconn_get_ofproto(ofconn); - const struct ofp10_queue_stats_request *qsr = ofputil_stats_msg_body(rq); struct queue_stats_cbdata cbdata; struct ofport *port; - unsigned int port_no; + uint16_t port_no; uint32_t queue_id; COVERAGE_INC(ofproto_queue_req); ofputil_start_stats_reply(rq, &cbdata.replies); - port_no = ntohs(qsr->port_no); - queue_id = ntohl(qsr->queue_id); + switch (rq->version) { + case OFP12_VERSION: + case OFP11_VERSION: { + const struct ofp11_queue_stats_request *qsr; + enum ofperr error; + + qsr = ofputil_stats_msg_body(rq); + error = ofputil_port_from_ofp11(qsr->port_no, &port_no); + if (error) { + return error; + } + queue_id = ntohl(qsr->queue_id); + break; + } + + case OFP10_VERSION: { + const struct ofp10_queue_stats_request *qsr; + + qsr = ofputil_stats_msg_body(rq); + port_no = ntohs(qsr->port_no); + queue_id = ntohl(qsr->queue_id); + break; + } + + default: + NOT_REACHED(); + } + if (port_no == OFPP_ALL) { HMAP_FOR_EACH (port, hmap_node, &ofproto->ports) { handle_queue_stats_for_port(port, queue_id, &cbdata); -- 1.7.10.2.484.gcd07cc5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev