[ovs-dev] [PATCH 30/38] ovs-ofpctl: Enable queue-stats for Open Flow 1.1 & 1.2
Simon Horman
horms at verge.net.au
Thu Aug 9 08:49:51 UTC 2012
Signed-off-by: Simon Horman <horms at verge.net.au>
---
v11
* No change
v10
* Manual rebase
* Make use of enum ofp_version
v9
* Omitted
v8
* Omitted
v7
* Omitted
v6
* The queue_id variable in do_dump_aggregate() should be uint32_t not
uint16_t.
v5
* Initial Post
---
utilities/ovs-ofctl.c | 43 ++++++++++++++++++++++++++++++++++---------
1 file changed, 34 insertions(+), 9 deletions(-)
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index ec72c91..9e29581 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -968,27 +968,52 @@ ofctl_dump_aggregate(int argc, char *argv[])
static void
ofctl_queue_stats(int argc, char *argv[])
{
- struct ofp10_queue_stats_request *req;
struct ofpbuf *request;
struct vconn *vconn;
+ uint16_t port_no;
+ uint32_t queue_id;
open_vconn(argv[1], &vconn);
- request = ofpraw_alloc(OFPRAW_OFPST10_QUEUE_REQUEST,
- vconn_get_version(vconn), 0);
- req = ofpbuf_put_zeros(request, sizeof *req);
if (argc > 2 && argv[2][0] && strcasecmp(argv[2], "all")) {
- req->port_no = htons(str_to_port_no(vconn, argv[2]));
+ port_no = str_to_port_no(vconn, argv[2]);
} else {
- req->port_no = htons(OFPP_ALL);
+ port_no = OFPP_ALL;
}
if (argc > 3 && argv[3][0] && strcasecmp(argv[3], "all")) {
- req->queue_id = htonl(atoi(argv[3]));
+ queue_id = atoi(argv[3]);
} else {
- req->queue_id = htonl(OFPQ_ALL);
+ queue_id = OFPQ_ALL;
}
- memset(req->pad, 0, sizeof req->pad);
+ switch (vconn_get_version(vconn)) {
+ case OFP12_VERSION:
+ case OFP11_VERSION: {
+ struct ofp11_queue_stats_request *req;
+
+ request = ofpraw_alloc(OFPRAW_OFPST11_QUEUE_REQUEST,
+ vconn_get_version(vconn), 0);
+ req = ofpbuf_put_zeros(request, sizeof *req);
+ req->port_no = ofputil_port_to_ofp11(port_no);
+ req->queue_id = htonl(queue_id);
+ break;
+ }
+
+ case OFP10_VERSION: {
+ struct ofp10_queue_stats_request *req;
+
+ request = ofpraw_alloc(OFPRAW_OFPST10_QUEUE_REQUEST,
+ vconn_get_version(vconn), 0);
+ req = ofpbuf_put_zeros(request, sizeof *req);
+ req->port_no = htons(port_no);
+ memset(req->pad, 0, sizeof req->pad);
+ req->queue_id = htonl(queue_id);
+ break;
+ }
+
+ default:
+ NOT_REACHED();
+ }
dump_stats_transaction(vconn, request);
vconn_close(vconn);
--
1.7.10.2.484.gcd07cc5
More information about the dev
mailing list