summaryrefslogtreecommitdiff
path: root/lib/ofp-print.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-01-18 16:00:05 -0800
committerBen Pfaff <blp@ovn.org>2016-01-20 09:28:32 -0800
commite016fb630d66ba29c37fe4246f0acf80f11c1b3f (patch)
tree63e41522bccab08369d948944c386103f1de8ea3 /lib/ofp-print.c
parent2b4c9d85e6d024eb42ddf7882b46297c9a7b8dae (diff)
downloadopenvswitch-e016fb630d66ba29c37fe4246f0acf80f11c1b3f.tar.gz
openflow: Implement OF1.4+ OFPMP_QUEUE_DESC multipart message.
OpenFlow 1.0 through 1.3 have a message OFPT_QUEUE_GET_CONFIG_REQUEST and its corresponding reply, for fetching a description of the queues configured on a given port. OpenFlow 1.4 changes this message to a multipart message OFPMP_QUEUE_DESC, which Open vSwitch has not until now implemented. This commit adds an implemntation of that message. Because the message is a replacement for the former one, this commit implements it using the same ofp-util functions as the former message, so that the client code doesn't have to distinguish a difference between versions. The ovs-ofctl command queue-get-config was previously undocumented (due only to an oversight). This commit corrects that and documents the new feature available with OpenFlow 1.4. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
Diffstat (limited to 'lib/ofp-print.c')
-rw-r--r--lib/ofp-print.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index af56e9bf3..42e822b91 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -1086,8 +1086,9 @@ ofp_print_queue_get_config_request(struct ds *string,
{
enum ofperr error;
ofp_port_t port;
+ uint32_t queue;
- error = ofputil_decode_queue_get_config_request(oh, &port);
+ error = ofputil_decode_queue_get_config_request(oh, &port, &queue);
if (error) {
ofp_print_error(string, error);
return;
@@ -1095,6 +1096,11 @@ ofp_print_queue_get_config_request(struct ds *string,
ds_put_cstr(string, " port=");
ofputil_format_port(port, string);
+
+ if (queue != OFPQ_ALL) {
+ ds_put_cstr(string, " queue=");
+ ofp_print_queue_name(string, queue);
+ }
}
static void
@@ -1111,21 +1117,12 @@ static void
ofp_print_queue_get_config_reply(struct ds *string,
const struct ofp_header *oh)
{
- enum ofperr error;
struct ofpbuf b;
- ofp_port_t port;
+ ofp_port_t port = 0;
ofpbuf_use_const(&b, oh, ntohs(oh->length));
- error = ofputil_decode_queue_get_config_reply(&b, &port);
- if (error) {
- ofp_print_error(string, error);
- return;
- }
-
- ds_put_cstr(string, " port=");
- ofputil_format_port(port, string);
- ds_put_char(string, '\n');
+ ds_put_char(string, ' ');
for (;;) {
struct ofputil_queue_config queue;
int retval;
@@ -1135,10 +1132,19 @@ ofp_print_queue_get_config_reply(struct ds *string,
if (retval != EOF) {
ofp_print_error(string, retval);
}
+ ds_chomp(string, ' ');
break;
}
- ds_put_format(string, "queue %"PRIu32":", queue.queue_id);
+ if (queue.port != port) {
+ port = queue.port;
+
+ ds_put_cstr(string, "port=");
+ ofputil_format_port(port, string);
+ ds_put_char(string, '\n');
+ }
+
+ ds_put_format(string, "queue %"PRIu32":", queue.queue);
print_queue_rate(string, "min_rate", queue.min_rate);
print_queue_rate(string, "max_rate", queue.max_rate);
ds_put_char(string, '\n');