summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2016-01-20 08:05:20 -0800
committerBen Pfaff <blp@ovn.org>2016-01-20 08:05:20 -0800
commitd2e5fa1f91a1465b608adf513509f27c853f1250 (patch)
tree6425f420cb1912912b25fefc31a067ee44c451da /lib
parent3e461c2c0e5b807fe234b4723969014baf2ce0b8 (diff)
downloadopenvswitch-d2e5fa1f91a1465b608adf513509f27c853f1250.tar.gz
openflow: Rename OF0.1-1.3 queue property constants.
At first glance, OF1.4 queue properties look a lot like those for OF1.0 to OF1.3, but in fact their different padding makes them incompatible. In addition, OF1.4 switches from using regular OpenFlow messages to request queue properties, to using multipart messages. Thus, we really need to use separate code to deal with OF1.4 queues. OF1.0, OF1.1, and OF1.2 all have slightly different queue config reply messages, but only OF1.0 and OF1.2 had tests, so this adds tests. (There is no test for OF1.3 because it's the same as OF1.2.) Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Jarno Rajahalme <jarno@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ofp-util.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index effd96a30..8fffcecf8 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -2554,11 +2554,11 @@ ofputil_encode_queue_get_config_reply(const struct ofp_header *oh)
}
static void
-put_queue_rate(struct ofpbuf *reply, enum ofp_queue_properties property,
- uint16_t rate)
+put_ofp10_queue_rate(struct ofpbuf *reply,
+ enum ofp10_queue_properties property, uint16_t rate)
{
if (rate != UINT16_MAX) {
- struct ofp_queue_prop_rate *oqpr;
+ struct ofp10_queue_prop_rate *oqpr;
oqpr = ofpbuf_put_zeros(reply, sizeof *oqpr);
oqpr->prop_header.property = htons(property);
@@ -2593,8 +2593,8 @@ ofputil_append_queue_get_config_reply(struct ofpbuf *reply,
len_ofs = (char *) &opq12->len - (char *) reply->data;
}
- put_queue_rate(reply, OFPQT_MIN_RATE, oqc->min_rate);
- put_queue_rate(reply, OFPQT_MAX_RATE, oqc->max_rate);
+ put_ofp10_queue_rate(reply, OFPQT10_MIN_RATE, oqc->min_rate);
+ put_ofp10_queue_rate(reply, OFPQT11_MAX_RATE, oqc->max_rate);
len = ofpbuf_at(reply, len_ofs, sizeof *len);
*len = htons(reply->size - start_ofs);
@@ -2628,12 +2628,13 @@ ofputil_decode_queue_get_config_reply(struct ofpbuf *reply, ofp_port_t *port)
}
static enum ofperr
-parse_queue_rate(const struct ofp_queue_prop_header *hdr, uint16_t *rate)
+parse_ofp10_queue_rate(const struct ofp10_queue_prop_header *hdr,
+ uint16_t *rate)
{
- const struct ofp_queue_prop_rate *oqpr;
+ const struct ofp10_queue_prop_rate *oqpr;
if (hdr->len == htons(sizeof *oqpr)) {
- oqpr = (const struct ofp_queue_prop_rate *) hdr;
+ oqpr = (const struct ofp10_queue_prop_rate *) hdr;
*rate = ntohs(oqpr->rate);
return 0;
} else {
@@ -2692,7 +2693,7 @@ ofputil_pull_queue_get_config_reply(struct ofpbuf *reply,
len -= opq_len;
while (len > 0) {
- const struct ofp_queue_prop_header *hdr;
+ const struct ofp10_queue_prop_header *hdr;
unsigned int property;
unsigned int prop_len;
enum ofperr error = 0;
@@ -2705,12 +2706,12 @@ ofputil_pull_queue_get_config_reply(struct ofpbuf *reply,
property = ntohs(hdr->property);
switch (property) {
- case OFPQT_MIN_RATE:
- error = parse_queue_rate(hdr, &queue->min_rate);
+ case OFPQT10_MIN_RATE:
+ error = parse_ofp10_queue_rate(hdr, &queue->min_rate);
break;
- case OFPQT_MAX_RATE:
- error = parse_queue_rate(hdr, &queue->max_rate);
+ case OFPQT11_MAX_RATE:
+ error = parse_ofp10_queue_rate(hdr, &queue->max_rate);
break;
default: