--min-ofp-version allows the minimum OpenFlow version to be set. --max-ofp-version allows the maximum OpenFlow version to be set. The default for both is OFP10_VERSION which retains the existing behaviour.
Signed-off-by: Simon Horman <ho...@verge.net.au> --- manpages.mk | 2 ++ vswitchd/bridge.c | 26 ++++++++++++++++---------- vswitchd/bridge.h | 4 +++- vswitchd/ovs-vswitchd.8.in | 1 + vswitchd/ovs-vswitchd.c | 16 ++++++++++------ 5 files changed, 32 insertions(+), 17 deletions(-) diff --git a/manpages.mk b/manpages.mk index 01700c3..69f11de 100644 --- a/manpages.mk +++ b/manpages.mk @@ -236,6 +236,7 @@ vswitchd/ovs-vswitchd.8: \ lib/daemon.man \ lib/leak-checker.man \ lib/memory-unixctl.man \ + lib/ofp-version.man \ lib/ssl-bootstrap.man \ lib/ssl.man \ lib/stress-unixctl.man \ @@ -249,6 +250,7 @@ lib/common.man: lib/daemon.man: lib/leak-checker.man: lib/memory-unixctl.man: +lib/ofp-version.man: lib/ssl-bootstrap.man: lib/ssl.man: lib/stress-unixctl.man: diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 197ae85..66463e7 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -186,7 +186,9 @@ static void bridge_configure_stp(struct bridge *); static void bridge_configure_tables(struct bridge *); static void bridge_configure_remotes(struct bridge *, const struct sockaddr_in *managers, - size_t n_managers); + size_t n_managers, + enum ofp_version min_version, + enum ofp_version max_version); static void bridge_pick_local_hw_addr(struct bridge *, uint8_t ea[ETH_ADDR_LEN], struct iface **hw_addr_iface); @@ -508,7 +510,9 @@ bridge_reconfigure_ofp(void) } static bool -bridge_reconfigure_continue(const struct ovsrec_open_vswitch *ovs_cfg) +bridge_reconfigure_continue(const struct ovsrec_open_vswitch *ovs_cfg, + enum ofp_version min_version, + enum ofp_version max_version) { struct sockaddr_in *managers; int sflow_bridge_number; @@ -544,7 +548,8 @@ bridge_reconfigure_continue(const struct ovsrec_open_vswitch *ovs_cfg) bridge_configure_flow_eviction_threshold(br); bridge_configure_forward_bpdu(br); bridge_configure_mac_idle_time(br); - bridge_configure_remotes(br, managers, n_managers); + bridge_configure_remotes(br, managers, n_managers, + min_version, max_version); bridge_configure_netflow(br); bridge_configure_sflow(br, &sflow_bridge_number); bridge_configure_stp(br); @@ -2039,7 +2044,7 @@ bridge_run_fast(void) } void -bridge_run(void) +bridge_run(enum ofp_version min_version, enum ofp_version max_version) { static const struct ovsrec_open_vswitch null_cfg; const struct ovsrec_open_vswitch *cfg; @@ -2073,7 +2078,7 @@ bridge_run(void) /* Let each bridge do the work that it needs to do. */ HMAP_FOR_EACH (br, node, &all_bridges) { - ofproto_run(br->ofproto, OFP10_VERSION, OFP10_VERSION); + ofproto_run(br->ofproto, min_version, max_version); } /* Re-configure SSL. We do this on every trip through the main loop, @@ -2120,11 +2125,11 @@ bridge_run(void) if (!reconf_txn) { reconf_txn = ovsdb_idl_txn_create(idl); } - if (bridge_reconfigure_continue(cfg)) { + if (bridge_reconfigure_continue(cfg, min_version, max_version)) { ovsrec_open_vswitch_set_cur_cfg(cfg, cfg->next_cfg); } } else { - bridge_reconfigure_continue(&null_cfg); + bridge_reconfigure_continue(&null_cfg, min_version, max_version); } } @@ -2647,8 +2652,9 @@ equal_pathnames(const char *a, const char *b) } static void -bridge_configure_remotes(struct bridge *br, - const struct sockaddr_in *managers, size_t n_managers) +bridge_configure_remotes(struct bridge *br, const struct sockaddr_in *managers, + size_t n_managers, enum ofp_version min_version, + enum ofp_version max_version) { bool disable_in_band; @@ -2719,7 +2725,7 @@ bridge_configure_remotes(struct bridge *br, } ofproto_set_controllers(br->ofproto, ocs, n_ocs, - OFP10_VERSION, OFP10_VERSION); + min_version, max_version); free(ocs[0].target); /* From bridge_ofproto_controller_for_mgmt(). */ free(ocs); diff --git a/vswitchd/bridge.h b/vswitchd/bridge.h index c1b0a2b..cd887fc 100644 --- a/vswitchd/bridge.h +++ b/vswitchd/bridge.h @@ -16,12 +16,14 @@ #ifndef VSWITCHD_BRIDGE_H #define VSWITCHD_BRIDGE_H 1 +#include "openflow/openflow-common.h" + struct simap; void bridge_init(const char *remote); void bridge_exit(void); -void bridge_run(void); +void bridge_run(enum ofp_version min_version, enum ofp_version max_version); void bridge_run_fast(void); void bridge_wait(void); diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in index 5a959dd..cdb874b 100644 --- a/vswitchd/ovs-vswitchd.8.in +++ b/vswitchd/ovs-vswitchd.8.in @@ -99,6 +99,7 @@ configuration. .so lib/vlog.man .so lib/common.man .so lib/leak-checker.man +.so lib/ofp-version.man . .SH "RUNTIME MANAGEMENT COMMANDS" \fBovs\-appctl\fR(8) can send commands to a running diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index 84e5ad1..44bbe27 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -52,6 +52,8 @@ #include "vconn.h" #include "vlog.h" #include "lib/vswitch-idl.h" +#include "lib/ofp-util.h" +#include "lib/ofp-version-opt.h" #include "worker.h" VLOG_DEFINE_THIS_MODULE(vswitchd); @@ -123,7 +125,7 @@ main(int argc, char *argv[]) simap_destroy(&usage); } bridge_run_fast(); - bridge_run(); + bridge_run(min_ofp_version, max_ofp_version); bridge_run_fast(); unixctl_server_run(unixctl); netdev_run(); @@ -158,7 +160,8 @@ parse_options(int argc, char *argv[], char **unixctl_pathp) OPT_BOOTSTRAP_CA_CERT, OPT_ENABLE_DUMMY, OPT_DISABLE_SYSTEM, - DAEMON_OPTION_ENUMS + DAEMON_OPTION_ENUMS, + OFP_VERSION_OPTION_ENUMS }; static struct option long_options[] = { {"help", no_argument, NULL, 'h'}, @@ -166,6 +169,7 @@ parse_options(int argc, char *argv[], char **unixctl_pathp) {"mlockall", no_argument, NULL, OPT_MLOCKALL}, {"unixctl", required_argument, NULL, OPT_UNIXCTL}, DAEMON_LONG_OPTIONS, + OFP_VERSION_LONG_OPTIONS, VLOG_LONG_OPTIONS, LEAK_CHECKER_LONG_OPTIONS, STREAM_SSL_LONG_OPTIONS, @@ -189,10 +193,6 @@ parse_options(int argc, char *argv[], char **unixctl_pathp) case 'h': usage(); - case 'V': - ovs_print_version(OFP10_VERSION, OFP10_VERSION); - exit(EXIT_SUCCESS); - case OPT_MLOCKALL: want_mlockall = true; break; @@ -203,6 +203,7 @@ parse_options(int argc, char *argv[], char **unixctl_pathp) VLOG_OPTION_HANDLERS DAEMON_OPTION_HANDLERS + OFP_VERSION_OPTION_HANDLERS LEAK_CHECKER_OPTION_HANDLERS STREAM_SSL_OPTION_HANDLERS @@ -231,6 +232,8 @@ parse_options(int argc, char *argv[], char **unixctl_pathp) } free(short_options); + ofp_version_check(); + argc -= optind; argv += optind; @@ -257,6 +260,7 @@ usage(void) program_name, program_name, ovs_rundir()); stream_usage("DATABASE", true, false, true); daemon_usage(); + ofp_version_usage(); vlog_usage(); printf("\nOther options:\n" " --unixctl=SOCKET override default control socket name\n" -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev