[ovs-dev] [PATCH v1 6/6] ofproto-dpif: Unixctl command to print userspace datapath summary.

Gurucharan Shetty shettyg at nicira.com
Fri Nov 1 09:15:17 UTC 2013


Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 ofproto/ofproto-dpif.c     |   26 ++++++++++++++++++++++++++
 vswitchd/ovs-vswitchd.8.in |    7 ++++++-
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 1a53766..2d6ea61 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -5713,6 +5713,30 @@ ofproto_unixctl_dpif_del_flows(struct unixctl_conn *conn,
 }
 
 static void
+ofproto_unixctl_netdev_show(struct unixctl_conn *conn,
+                            int argc OVS_UNUSED,
+                            const char *argv[] OVS_UNUSED,
+                            void *aux OVS_UNUSED)
+{
+    struct dpif *dpif;
+    struct ds ds;
+    int error;
+
+    /* We only have one backer for dpif-netdev. So just use it. */
+    error = dpif_open("ovs-netdev", "netdev", &dpif);
+    if (error) {
+        unixctl_command_reply_error(conn, "No netdev backer found.");
+        return;
+    }
+
+    ds_init(&ds);
+    dpif_show(dpif, &ds, false);
+
+    unixctl_command_reply(conn, ds_cstr(&ds));
+    ds_destroy(&ds);
+}
+
+static void
 ofproto_unixctl_netdev_dump_flows(struct unixctl_conn *conn,
                                   int argc OVS_UNUSED,
                                   const char *argv[] OVS_UNUSED,
@@ -5785,6 +5809,8 @@ ofproto_dpif_unixctl_init(void)
                              ofproto_unixctl_dpif_disable_megaflows, NULL);
     unixctl_command_register("dpif/enable-megaflows", "", 0, 0,
                              ofproto_unixctl_dpif_enable_megaflows, NULL);
+    unixctl_command_register("netdev/show", "", 0, 0,
+                             ofproto_unixctl_netdev_show, NULL);
     unixctl_command_register("netdev/dump-flows", "", 0, 0,
                              ofproto_unixctl_netdev_dump_flows, NULL);
 }
diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in
index c72093f..a370dd9 100644
--- a/vswitchd/ovs-vswitchd.8.in
+++ b/vswitchd/ovs-vswitchd.8.in
@@ -215,7 +215,12 @@ enabled.
 .SS "NETDEV COMMANDS"
 These commands manage the userspace datapath.
 .IP "\fBnetdev/dump-flows\fR"
-Prints to the console all flow entries in the userspace datapath's flow table.
+Prints to the console all the flow entries in the userspace datapath's flow
+table.
+.
+.IP "\fBnetdev/show\fR"
+Prints to the console a summary of the configured datapath, flow lookup stats
+and a list of ports connected to the datapath.
 .
 .so ofproto/ofproto-dpif-unixctl.man
 .so ofproto/ofproto-unixctl.man
-- 
1.7.9.5




More information about the dev mailing list