+static int
+ofputil_pull_queue_get_config_reply14(struct ofpbuf *msg,
+ struct ofputil_queue_config *queue)
+{
+ struct ofp14_queue_desc *oqd14 = ofpbuf_try_pull(msg, sizeof *oqd14);
+ if (!oqd14) {
+ return OFPERR_OFPBRC_BAD_LEN;
+ }
+ enum ofperr error = ofputil_port_from_ofp11(oqd14->port_no, &queue->port);
+ if (error) {
+ return error;
+ }
+ queue->queue = ntohl(oqd14->queue_id);
+
+ /* Length check. */
+ unsigned int len = ntohs(oqd14->len);
+ if (len < sizeof *oqd14 || len > msg->size + sizeof *oqd14 || len % 8) {
+ return OFPERR_OFPBRC_BAD_LEN;
+ }
+ len -= sizeof *oqd14;
+
+ struct ofpbuf properties;
+ ofpbuf_use_const(&properties, ofpbuf_pull(msg, len), len);
+ while (properties.size > 0) {
+ struct ofpbuf payload;
+ uint64_t type;
+
+ error = ofpprop_pull(&properties, &payload, &type);
+ if (error) {
+ return error;
+ }
+
+ switch (type) {
+ case OFPQDPT14_MIN_RATE:
+ error = ofpprop_parse_u16(&payload, &queue->min_rate);
+ break;
+
+ case OFPQDPT14_MAX_RATE:
+ error = ofpprop_parse_u16(&payload, &queue->max_rate);
+ break;
+
+ default:
+ error = OFPPROP_UNKNOWN(true, "queue desc", type);
+ break;
+ }
+
+ if (error) {
+ return error;
+ }
+ }
+
+ return 0;
+}
+
+/* Decodes information about a queue from the OFPT_QUEUE_GET_CONFIG_REPLY in
+ * 'reply' and stores it in '*queue'. ofputil_decode_queue_get_config_reply()
+ * must already have pulled off the main header.
+ *
+ * This function returns EOF if the last queue has already been decoded, 0 if a
+ * queue was successfully decoded into '*queue', or an ofperr if there was a
+ * problem decoding 'reply'. */
+int
+ofputil_pull_queue_get_config_reply(struct ofpbuf *msg,
+ struct ofputil_queue_config *queue)
+{
+ enum ofpraw raw;
+ if (!msg->header) {
+ /* Pull OpenFlow header. */
+ raw = ofpraw_pull_assert(msg);
+
+ /* Pull protocol-specific ofp_queue_get_config_reply header (OF1.4
+ * doesn't have one at all). */
+ if (raw == OFPRAW_OFPT10_QUEUE_GET_CONFIG_REPLY) {
+ ofpbuf_pull(msg, sizeof(struct ofp10_queue_get_config_reply));
+ } else if (raw == OFPRAW_OFPT11_QUEUE_GET_CONFIG_REPLY) {
+ ofpbuf_pull(msg, sizeof(struct ofp11_queue_get_config_reply));
+ } else {
+ ovs_assert(raw == OFPRAW_OFPST14_QUEUE_DESC_REPLY);
+ }
+ } else {
+ raw = ofpraw_decode_assert(msg->header);
+ }
+
+ queue->min_rate = UINT16_MAX;
+ queue->max_rate = UINT16_MAX;
+
+ if (!msg->size) {
+ return EOF;
+ } else if (raw == OFPRAW_OFPST14_QUEUE_DESC_REPLY) {
+ return ofputil_pull_queue_get_config_reply14(msg, queue);
+ } else {
+ return ofputil_pull_queue_get_config_reply10(msg, queue);
+ }
+}
+