[ovs-dev] [PATCH 37/47] ofp-msgs: Split OFPRAW_OFPST_PORT_{REQUEST, REPLY}
Simon Horman
horms at verge.net.au
Wed Aug 1 07:02:20 UTC 2012
Split OFPRAW_OFPST_PORT_{REQUEST,REPLY} into OpenFlow 1.0 and 1.1+
versions.
This prepares for encoding and decoding Open Flow 1.1 and 1.2 Port Stats
Request and Reply messages.
Signed-off-by: Simon Horman <horms at verge.net.au>
---
v9
* Update description - this only prepares for both encoding and decoding
* Move tests to "ofp-print: Allow printing of Open Flow 1.1 & 1.2 Port
Reply Messages" as this is just a preparatory patch.
v8
* Initial post
---
lib/ofp-msgs.h | 14 ++++++++++----
utilities/ovs-ofctl.c | 15 +++++++++++++--
2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/lib/ofp-msgs.h b/lib/ofp-msgs.h
index 752d12c..6420c5d 100644
--- a/lib/ofp-msgs.h
+++ b/lib/ofp-msgs.h
@@ -216,10 +216,14 @@ enum ofpraw {
OFPRAW_OFPST12_TABLE_REPLY,
/* OFPST 1.0 (4): struct ofp10_port_stats_request. */
- OFPRAW_OFPST_PORT_REQUEST,
+ OFPRAW_OFPST10_PORT_REQUEST,
+ /* OFPST 1.1+ (4): struct ofp11_port_stats_request. */
+ OFPRAW_OFPST11_PORT_REQUEST,
/* OFPST 1.0 (4): struct ofp10_port_stats[]. */
- OFPRAW_OFPST_PORT_REPLY,
+ OFPRAW_OFPST10_PORT_REPLY,
+ /* OFPST 1.1+ (4): struct ofp11_port_stats[]. */
+ OFPRAW_OFPST11_PORT_REPLY,
/* OFPST 1.0 (5): struct ofp10_queue_stats_request. */
OFPRAW_OFPST_QUEUE_REQUEST,
@@ -382,8 +386,10 @@ enum ofptype {
OFPTYPE_TABLE_STATS_REPLY, /* OFPRAW_OFPST10_TABLE_REPLY.
* OFPRAW_OFPST11_TABLE_REPLY.
* OFPRAW_OFPST12_TABLE_REPLY. */
- OFPTYPE_PORT_STATS_REQUEST, /* OFPRAW_OFPST_PORT_REQUEST. */
- OFPTYPE_PORT_STATS_REPLY, /* OFPRAW_OFPST_PORT_REPLY. */
+ OFPTYPE_PORT_STATS_REQUEST, /* OFPRAW_OFPST10_PORT_REQUEST.
+ * OFPRAW_OFPST11_PORT_REQUEST. */
+ OFPTYPE_PORT_STATS_REPLY, /* OFPRAW_OFPST10_PORT_REPLY.
+ * OFPRAW_OFPST11_PORT_REPLY. */
OFPTYPE_QUEUE_STATS_REQUEST, /* OFPRAW_OFPST_QUEUE_REQUEST. */
OFPTYPE_QUEUE_STATS_REPLY, /* OFPRAW_OFPST_QUEUE_REPLY. */
OFPTYPE_PORT_DESC_STATS_REQUEST, /* OFPRAW_OFPST_PORT_DESC_REQUEST. */
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 0a6ac0e..06f6dd8 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -1417,10 +1417,21 @@ ofctl_dump_ports(int argc, char *argv[])
struct ofpbuf *request;
struct vconn *vconn;
uint16_t port;
+ enum ofpraw raw;
open_vconn(argv[1], &vconn);
- request = ofpraw_alloc(OFPRAW_OFPST_PORT_REQUEST,
- vconn_get_version(vconn), 0);
+ switch (vconn_get_version(vconn)) {
+ case OFP10_VERSION:
+ raw = OFPRAW_OFPST10_PORT_REQUEST;
+ break;
+ case OFP11_VERSION:
+ case OFP12_VERSION:
+ raw = OFPRAW_OFPST11_PORT_REQUEST;
+ break;
+ default:
+ NOT_REACHED();
+ }
+ request = ofpraw_alloc(raw, vconn_get_version(vconn), 0);
req = ofpbuf_put_zeros(request, sizeof *req);
port = argc > 2 ? str_to_port_no(argv[1], argv[2]) : OFPP_NONE;
req->port_no = htons(port);
--
1.7.10.2.484.gcd07cc5
More information about the dev
mailing list