ofproto: Optionally flush all learning tables with appctl.
authorEthan Jackson <ethan@nicira.com>
Tue, 24 Jan 2012 22:33:23 +0000 (14:33 -0800)
committerEthan Jackson <ethan@nicira.com>
Tue, 24 Jan 2012 23:14:04 +0000 (15:14 -0800)
Signed-off-by: Ethan Jackson <ethan@nicira.com>
ofproto/ofproto-dpif.c
vswitchd/ovs-vswitchd.8.in

index d5ada4c..dc85743 100644 (file)
@@ -5590,17 +5590,24 @@ ofproto_dpif_lookup(const char *name)
 
 static void
 ofproto_unixctl_fdb_flush(struct unixctl_conn *conn,
-                         const char *args, void *aux OVS_UNUSED)
+                          const char *args, void *aux OVS_UNUSED)
 {
     struct ofproto_dpif *ofproto;
 
-    ofproto = ofproto_dpif_lookup(args);
-    if (!ofproto) {
-        unixctl_command_reply(conn, 501, "no such bridge");
-        return;
+    if (args[0] != '\0') {
+        ofproto = ofproto_dpif_lookup(args);
+        if (!ofproto) {
+            unixctl_command_reply(conn, 501, "no such bridge");
+            return;
+        }
+        mac_learning_flush(ofproto->ml);
+        ofproto->need_revalidate = true;
+    } else {
+        HMAP_FOR_EACH (ofproto, all_ofproto_dpifs_node, &all_ofproto_dpifs) {
+            mac_learning_flush(ofproto->ml);
+            ofproto->need_revalidate = true;
+        }
     }
-    mac_learning_flush(ofproto->ml);
-    ofproto->need_revalidate = true;
 
     unixctl_command_reply(conn, 200, "table successfully flushed");
 }
@@ -5865,8 +5872,8 @@ ofproto_dpif_unixctl_init(void)
     unixctl_command_register("ofproto/trace",
                       "bridge {tun_id in_port packet | odp_flow [-generate]}",
                       ofproto_unixctl_trace, NULL);
-    unixctl_command_register("fdb/flush", "bridge", ofproto_unixctl_fdb_flush,
-                             NULL);
+    unixctl_command_register("fdb/flush", "[bridge]",
+                             ofproto_unixctl_fdb_flush, NULL);
     unixctl_command_register("fdb/show", "bridge", ofproto_unixctl_fdb_show,
                              NULL);
     unixctl_command_register("ofproto/clog", "", ofproto_dpif_clog, NULL);
index 314fe60..41413b9 100644 (file)
@@ -120,8 +120,9 @@ then displays detailed information about all interfaces with CFM
 enabled.
 .SS "BRIDGE COMMANDS"
 These commands manage bridges.
-.IP "\fBfdb/flush\fR \fIbridge\fR"
-Flushes \fIbridge\fR MAC address learning table.
+.IP "\fBfdb/flush\fR [\fIbridge\fR]"
+Flushes \fIbridge\fR MAC address learning table, or all learning tables
+if no \fIbridge\fR is given.
 .IP "\fBfdb/show\fR \fIbridge\fR"
 Lists each MAC address/VLAN pair learned by the specified \fIbridge\fR,
 along with the port on which it was learned and the age of the entry,