Skip to content

Commit

Permalink
openflow: Implement OF1.4+ OFPMP_QUEUE_DESC multipart message.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
blp committed Jan 20, 2016
1 parent 2b4c9d8 commit e016fb6
Show file tree
Hide file tree
Showing 13 changed files with 453 additions and 189 deletions.
4 changes: 3 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Post-v2.5.0
* New "monitor2" and "update2" extensions to RFC 7047.
- OpenFlow:
* OpenFlow 1.1+ OFPT_QUEUE_GET_CONFIG_REQUEST now supports OFPP_ANY.

* OpenFlow 1.4+ OFPMP_QUEUE_DESC is now supported.
- ovs-ofctl:
* queue-get-config command now allows a queue ID to be specified.

v2.5.0 - xx xxx xxxx
---------------------
Expand Down
4 changes: 2 additions & 2 deletions OPENFLOW-1.1+.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ OpenFlow 1.4 features are listed in the previous section.
Many on-wire structures got TLVs.
Already implemented: port desc properties, port mod properties,
port stats properties, table mod properties,
queue stats, unified property errors.
Remaining required: set-async, queue desc
queue stats, unified property errors, queue desc.
Remaining required: set-async
Remaining optional: table desc, table-status
[EXT-262]
[required for OF1.4+]
Expand Down
25 changes: 25 additions & 0 deletions include/openflow/openflow-1.4.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,31 @@ struct ofp14_queue_stats {
OFP_ASSERT(sizeof(struct ofp14_queue_stats) == 48);


/* ## ---------------- ## */
/* ## ofp14_queue_desc ## */
/* ## ---------------- ## */

struct ofp14_queue_desc_request {
ovs_be32 port; /* All ports if OFPP_ANY. */
ovs_be32 queue; /* All queues if OFPQ_ALL. */
};
OFP_ASSERT(sizeof(struct ofp14_queue_desc_request) == 8);

/* Body of reply to OFPMP_QUEUE_DESC request. */
struct ofp14_queue_desc {
ovs_be32 port_no; /* Port this queue is attached to. */
ovs_be32 queue_id; /* ID for the specific queue. */
ovs_be16 len; /* Length in bytes of this queue desc. */
uint8_t pad[6]; /* 64-bit alignment. */
};
OFP_ASSERT(sizeof(struct ofp14_queue_desc) == 16);

enum ofp14_queue_desc_prop_type {
OFPQDPT14_MIN_RATE = 1,
OFPQDPT14_MAX_RATE = 2,
OFPQDPT14_EXPERIMENTER = 0xffff
};

/* ## -------------- ## */
/* ## Miscellaneous. ## */
/* ## -------------- ## */
Expand Down
3 changes: 3 additions & 0 deletions lib/ofp-errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ enum ofperr {
/* OF1.0(5,2), OF1.1+(9,2). Permissions error. */
OFPERR_OFPQOFC_EPERM,

/* NX1.4+(23). System error retrieving queue details. */
OFPERR_NXQOFC_QUEUE_ERROR,

/* ## -------------------------- ## */
/* ## OFPET_SWITCH_CONFIG_FAILED ## */
/* ## -------------------------- ## */
Expand Down
15 changes: 11 additions & 4 deletions lib/ofp-msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ enum ofpraw {

/* OFPT 1.0 (20): struct ofp10_queue_get_config_request. */
OFPRAW_OFPT10_QUEUE_GET_CONFIG_REQUEST,
/* OFPT 1.1+ (22): struct ofp11_queue_get_config_request. */
/* OFPT 1.1-1.3 (22): struct ofp11_queue_get_config_request. */
OFPRAW_OFPT11_QUEUE_GET_CONFIG_REQUEST,

/* OFPT 1.0 (21): struct ofp10_queue_get_config_reply, uint8_t[8][]. */
OFPRAW_OFPT10_QUEUE_GET_CONFIG_REPLY,
/* OFPT 1.1+ (23): struct ofp11_queue_get_config_reply, uint8_t[8][]. */
/* OFPT 1.1-1.3 (23): struct ofp11_queue_get_config_reply, uint8_t[8][]. */
OFPRAW_OFPT11_QUEUE_GET_CONFIG_REPLY,

/* OFPT 1.2+ (24): struct ofp12_role_request. */
Expand Down Expand Up @@ -396,6 +396,11 @@ enum ofpraw {
/* OFPST 1.4+ (13): uint8_t[8][]. */
OFPRAW_OFPST14_PORT_DESC_REPLY,

/* OFPST 1.4+ (15): struct ofp14_queue_desc_request. */
OFPRAW_OFPST14_QUEUE_DESC_REQUEST,
/* OFPST 1.4+ (15): uint8_t[8][]. */
OFPRAW_OFPST14_QUEUE_DESC_REPLY,

/* OFPST 1.4+ (16): uint8_t[8][]. */
OFPRAW_OFPST14_FLOW_MONITOR_REQUEST,
/* NXST 1.0 (2): uint8_t[8][]. */
Expand Down Expand Up @@ -537,9 +542,11 @@ enum ofptype {

/* Queue Configuration messages. */
OFPTYPE_QUEUE_GET_CONFIG_REQUEST, /* OFPRAW_OFPT10_QUEUE_GET_CONFIG_REQUEST.
* OFPRAW_OFPT11_QUEUE_GET_CONFIG_REQUEST. */
* OFPRAW_OFPT11_QUEUE_GET_CONFIG_REQUEST.
* OFPRAW_OFPST14_QUEUE_DESC_REQUEST. */
OFPTYPE_QUEUE_GET_CONFIG_REPLY, /* OFPRAW_OFPT10_QUEUE_GET_CONFIG_REPLY.
* OFPRAW_OFPT11_QUEUE_GET_CONFIG_REPLY. */
* OFPRAW_OFPT11_QUEUE_GET_CONFIG_REPLY.
* OFPRAW_OFPST14_QUEUE_DESC_REPLY. */

/* Controller role change request messages. */
OFPTYPE_ROLE_REQUEST, /* OFPRAW_OFPT12_ROLE_REQUEST.
Expand Down
32 changes: 19 additions & 13 deletions lib/ofp-print.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,15 +1086,21 @@ 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;
}

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
Expand All @@ -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;
Expand All @@ -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');
Expand Down
Loading

0 comments on commit e016fb6

Please sign in to comment.