[ovs-dev] [PATCH 7/8] ovs-ofctl: By default, do not set flow format for OpenFlow 1.1+
Simon Horman
horms at verge.net.au
Mon Nov 19 05:59:34 UTC 2012
Only set the default format for ovs-ofctl monitor if
OpenFlow 1.0 is the prevailing version. IMHO that is
the only case where it makes sense.
Signed-off-by: Simon Horman <horms at verge.net.au>
---
v4
* Rebase
---
utilities/ovs-ofctl.c | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index b5b5e24..e46076c 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -1394,19 +1394,29 @@ ofctl_monitor(int argc, char *argv[])
if (preferred_packet_in_format >= 0) {
set_packet_in_format(vconn, preferred_packet_in_format);
} else {
- struct ofpbuf *spif, *reply;
-
- spif = ofputil_make_set_packet_in_format(vconn_get_version(vconn),
- NXPIF_NXM);
- run(vconn_transact_noreply(vconn, spif, &reply),
- "talking to %s", vconn_get_name(vconn));
- if (reply) {
- char *s = ofp_to_string(reply->data, reply->size, 2);
- VLOG_DBG("%s: failed to set packet in format to nxm, controller"
- " replied: %s. Falling back to the switch default.",
- vconn_get_name(vconn), s);
- free(s);
- ofpbuf_delete(reply);
+ switch (vconn_get_version(vconn)) {
+ case OFP10_VERSION: {
+ struct ofpbuf *spif, *reply;
+
+ spif = ofputil_make_set_packet_in_format(vconn_get_version(vconn),
+ NXPIF_NXM);
+ run(vconn_transact_noreply(vconn, spif, &reply),
+ "talking to %s", vconn_get_name(vconn));
+ if (reply) {
+ char *s = ofp_to_string(reply->data, reply->size, 2);
+ VLOG_DBG("%s: failed to set packet in format to nxm, controller"
+ " replied: %s. Falling back to the switch default.",
+ vconn_get_name(vconn), s);
+ free(s);
+ ofpbuf_delete(reply);
+ }
+ break;
+ }
+ case OFP11_VERSION:
+ case OFP12_VERSION:
+ break;
+ default:
+ NOT_REACHED();
}
}
--
1.7.10.4
More information about the dev
mailing list