[ovs-dev] [PATCH 14/27] ovs-ofctl: Teach dump-ports about Open Flow 1.1 & 1.2
Simon Horman
horms at verge.net.au
Tue Aug 21 04:55:46 UTC 2012
Signed-off-by: Simon Horman <horms at verge.net.au>
---
v12
* No change
v11
* No change
v10
* No change
v9
* Initial post
---
utilities/ovs-ofctl.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 05c4223..504d01c 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -1434,7 +1434,6 @@ ofctl_snoop(int argc OVS_UNUSED, char *argv[])
static void
ofctl_dump_ports(int argc, char *argv[])
{
- struct ofp10_port_stats_request *req;
struct ofpbuf *request;
struct vconn *vconn;
uint16_t port;
@@ -1453,9 +1452,24 @@ ofctl_dump_ports(int argc, char *argv[])
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(vconn, argv[2]) : OFPP_NONE;
- req->port_no = htons(port);
+ switch (vconn_get_version(vconn)) {
+ case OFP10_VERSION: {
+ struct ofp10_port_stats_request *req;
+ req = ofpbuf_put_zeros(request, sizeof *req);
+ req->port_no = htons(port);
+ break;
+ }
+ case OFP11_VERSION:
+ case OFP12_VERSION: {
+ struct ofp11_port_stats_request *req;
+ req = ofpbuf_put_zeros(request, sizeof *req);
+ req->port_no = ofputil_port_to_ofp11(port);
+ break;
+ }
+ default:
+ NOT_REACHED();
+ }
dump_stats_transaction(vconn, request);
vconn_close(vconn);
}
--
1.7.10.2.484.gcd07cc5
More information about the dev
mailing list