Signed-off-by: Simon Horman <[email protected]>
---
v10
* Manual rebase
* Make use of enum ofp_version
* Change subject name from "ovs-print: Enable display of Open Flow 1.1 &
1.2 Queue Stats Response" to "ovs-print: Enable display of Open Flow 1.1
& 1.2 Queue Stats Request"
* Add ofp-print test
* Use ofputil_port_from_ofp11 to decode port number
v9
* Omitted
v8
* Omitted
v7
* Omitted
v6
* No change
v5
* Initial Post
---
lib/ofp-print.c | 38 +++++++++++++++++++++++++++++++++++---
tests/ofp-print.at | 22 +++++++++++++++++++++-
2 files changed, 56 insertions(+), 4 deletions(-)
diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index ae0e140..81c803b 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -1368,13 +1368,45 @@ ofp_print_queue_name(struct ds *string, uint32_t
queue_id)
static void
ofp_print_ofpst_queue_request(struct ds *string, const struct ofp_header *oh)
{
- const struct ofp10_queue_stats_request *qsr = ofpmsg_body(oh);
+ uint16_t port_no;
+ uint32_t queue_id;
+
+ switch ((enum ofp_version)oh->version) {
+ case OFP11_VERSION:
+ case OFP12_VERSION: {
+ const struct ofp11_queue_stats_request *qsr;
+
+ qsr = ofpmsg_body(oh);
+ if (ofputil_port_from_ofp11(qsr->port_no, &port_no)) {
+ ds_put_cstr(string, "*** parse error: invalid port ***\n");
+ return;
+ }
+ if (ofputil_port_from_ofp11(qsr->port_no, &port_no)) {
+ ds_put_cstr(string, "*** parse error: invalid port ***\n");
+ return;
+ }
+ queue_id = ntohl(qsr->queue_id);
+ break;
+ }
+
+ case OFP10_VERSION: {
+ const struct ofp10_queue_stats_request *qsr;
+
+ qsr = ofpmsg_body(oh);
+ port_no = ntohs(qsr->port_no);
+ queue_id = ntohl(qsr->queue_id);
+ break;
+ }
+
+ default:
+ NOT_REACHED();
+ }
ds_put_cstr(string, "port=");
- ofputil_format_port(ntohs(qsr->port_no), string);
+ ofputil_format_port(port_no, string);
ds_put_cstr(string, " queue=");
- ofp_print_queue_name(string, ntohl(qsr->queue_id));
+ ofp_print_queue_name(string, queue_id);
}
static void
diff --git a/tests/ofp-print.at b/tests/ofp-print.at
index cd72cff..727bcac 100644
--- a/tests/ofp-print.at
+++ b/tests/ofp-print.at
@@ -982,7 +982,7 @@ OFPST_PORT reply (OF1.2) (xid=0x2): 3 ports
])
AT_CLEANUP
-AT_SETUP([OFPST_QUEUE request])
+AT_SETUP([OFPST_QUEUE request - OF1.0])
AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST])
AT_CHECK([ovs-ofctl ofp-print "\
01 10 00 14 00 00 00 01 00 05 00 00 ff fc 00 00 \
@@ -992,6 +992,26 @@ OFPST_QUEUE request (xid=0x1):port=ALL queue=ALL
])
AT_CLEANUP
+AT_SETUP([OFPST_QUEUE request - OF1.1])
+AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST])
+AT_CHECK([ovs-ofctl ofp-print "\
+02 12 00 18 00 00 00 02 00 05 00 00 00 00 00 00 \
+ff ff ff fc ff ff ff ff \
+"], [0], [dnl
+OFPST_QUEUE request (OF1.1) (xid=0x2):port=ALL queue=ALL
+])
+AT_CLEANUP
+
+AT_SETUP([OFPST_QUEUE request - OF1.2])
+AT_KEYWORDS([ofp-print OFPT_STATS_REQUEST])
+AT_CHECK([ovs-ofctl ofp-print "\
+03 12 00 18 00 00 00 02 00 05 00 00 00 00 00 00 \
+ff ff ff fc ff ff ff ff \
+"], [0], [dnl
+OFPST_QUEUE request (OF1.2) (xid=0x2):port=ALL queue=ALL
+])
+AT_CLEANUP
+
AT_SETUP([OFPST_QUEUE reply - OF1.0])
AT_KEYWORDS([ofp-print OFPT_STATS_REPLY])
AT_CHECK([ovs-ofctl ofp-print "\
--
1.7.10.2.484.gcd07cc5
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev