+static void
+set_all_rate_limits(bool enable)
+{
+ struct vlog_module **mp;
+
+ for (mp = vlog_modules; mp < &vlog_modules[n_vlog_modules]; mp++) {
+ (*mp)->honor_rate_limits = enable;
+ }
+}
+
+static void
+set_rate_limits(struct unixctl_conn *conn, int argc,
+ const char *argv[], bool enable)
+{
+ if (argc > 1) {
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ if (!strcasecmp(argv[i], "ANY")) {
+ set_all_rate_limits(enable);
+ } else {
+ struct vlog_module *module = vlog_module_from_name(argv[i]);
+ if (!module) {
+ unixctl_command_reply_error(conn, "unknown module");
+ return;
+ }
+ module->honor_rate_limits = enable;
+ }
+ }
+ } else {
+ set_all_rate_limits(enable);
+ }
+ unixctl_command_reply(conn, NULL);
+}
+
+static void
+vlog_enable_rate_limit(struct unixctl_conn *conn, int argc,
+ const char *argv[], void *aux OVS_UNUSED)
+{
+ set_rate_limits(conn, argc, argv, true);
+}
+
+static void
+vlog_disable_rate_limit(struct unixctl_conn *conn, int argc,
+ const char *argv[], void *aux OVS_UNUSED)
+{
+ set_rate_limits(conn, argc, argv, false);
+}
+