X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fofp-print.c;h=5cbfe6c046555c5f79a11d666465f07c639cbe6e;hb=d2805da2cb2256e9e2efc5074fbe8df55408213f;hp=78f3649ba4cd1162da6d2c0b74102cada9ee8be5;hpb=4e8e4213a815a30216e855a805a8bcd5b8c5a886;p=sliver-openvswitch.git diff --git a/lib/ofp-print.c b/lib/ofp-print.c index 78f3649ba..5cbfe6c04 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -38,6 +38,7 @@ #include "xtoxll.h" static void ofp_print_port_name(struct ds *string, uint16_t port); +static void ofp_print_queue_name(struct ds *string, uint32_t port); /* Returns a string that represents the contents of the Ethernet frame in the * 'len' bytes starting at 'data' to 'stream' as output by tcpdump. @@ -1165,6 +1166,53 @@ ofp_table_stats_reply(struct ds *string, const void *body, size_t len, } } +static void +ofp_print_queue_name(struct ds *string, uint32_t queue_id) +{ + if (queue_id == OFPQ_ALL) { + ds_put_cstr(string, "ALL"); + } else { + ds_put_format(string, "%"PRIu32, queue_id); + } +} + +static void +ofp_queue_stats_request(struct ds *string, const void *body_, + size_t len OVS_UNUSED, int verbosity OVS_UNUSED) +{ + const struct ofp_queue_stats_request *qsr = body_; + + ds_put_cstr(string, "port="); + ofp_print_port_name(string, ntohs(qsr->port_no)); + + ds_put_cstr(string, " queue="); + ofp_print_queue_name(string, ntohl(qsr->queue_id)); +} + +static void +ofp_queue_stats_reply(struct ds *string, const void *body, size_t len, + int verbosity) +{ + const struct ofp_queue_stats *qs = body; + size_t n = len / sizeof *qs; + ds_put_format(string, " %zu queues\n", n); + if (verbosity < 1) { + return; + } + + for (; n--; qs++) { + ds_put_cstr(string, " port "); + ofp_print_port_name(string, ntohs(qs->port_no)); + ds_put_cstr(string, " queue "); + ofp_print_queue_name(string, ntohl(qs->queue_id)); + ds_put_cstr(string, ": "); + + print_port_stat(string, "bytes=", ntohll(qs->tx_bytes), 1); + print_port_stat(string, "pkts=", ntohll(qs->tx_packets), 1); + print_port_stat(string, "errors=", ntohll(qs->tx_errors), 0); + } +} + static void vendor_stat(struct ds *string, const void *body, size_t len, int verbosity OVS_UNUSED) @@ -1234,6 +1282,14 @@ print_stats(struct ds *string, int type, const void *body, size_t body_len, ofp_port_stats_request }, { 0, SIZE_MAX, ofp_port_stats_reply }, }, + { + OFPST_QUEUE, + "queue", + { sizeof(struct ofp_queue_stats_request), + sizeof(struct ofp_queue_stats_request), + ofp_queue_stats_request }, + { 0, SIZE_MAX, ofp_queue_stats_reply }, + }, { OFPST_VENDOR, "vendor-specific",