static uint16_t
str_to_port_no(const char *vconn_name, const char *port_name)
{
- uint16_t port_no = ofputil_port_from_string(port_name);
- if (port_no) {
+ uint16_t port_no;
+
+ if (ofputil_port_from_string(port_name, &port_no)) {
return port_no;
} else {
struct ofputil_phy_port pp;
static void
ofctl_queue_stats(int argc, char *argv[])
{
- struct ofp10_queue_stats_request *req;
struct ofpbuf *request;
struct vconn *vconn;
+ struct ofputil_queue_stats_request oqs;
open_vconn(argv[1], &vconn);
- request = ofpraw_alloc(OFPRAW_OFPST_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(argv[1], argv[2]));
+ oqs.port_no = str_to_port_no(argv[1], argv[2]);
} else {
- req->port_no = htons(OFPP_ALL);
+ oqs.port_no = OFPP_ALL;
}
if (argc > 3 && argv[3][0] && strcasecmp(argv[3], "all")) {
- req->queue_id = htonl(atoi(argv[3]));
+ oqs.queue_id = atoi(argv[3]);
} else {
- req->queue_id = htonl(OFPQ_ALL);
+ oqs.queue_id = OFPQ_ALL;
}
- memset(req->pad, 0, sizeof req->pad);
-
+ request = ofputil_encode_queue_stats_request(vconn_get_version(vconn), &oqs);
dump_stats_transaction(vconn, request);
vconn_close(vconn);
}