This command can be used to force PMD threads to reload
and apply new configuration.

Signed-off-by: Ilya Maximets <i.maxim...@samsung.com>
---
 NEWS                       |  2 ++
 lib/dpif-netdev.c          | 41 +++++++++++++++++++++++++++++++++++++++++
 vswitchd/ovs-vswitchd.8.in |  3 +++
 3 files changed, 46 insertions(+)

diff --git a/NEWS b/NEWS
index 4e81cad..817cba1 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,8 @@ Post-v2.5.0
        Old 'other_config:n-dpdk-rxqs' is no longer supported.
      * New appctl command 'dpif-netdev/pmd-rxq-show' to check the port/rxq
        assignment.
+     * New appctl command 'dpif-netdev/pmd-reconfigure' to force
+       reconfiguration of PMD threads.
      * Type of log messages from PMD threads changed from INFO to DBG.
      * QoS functionality with sample egress-policer implementation.
      * The mechanism for configuring DPDK has changed to use database
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 73aff8a..5ad6845 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -532,6 +532,8 @@ static void dp_netdev_add_port_tx_to_pmd(struct 
dp_netdev_pmd_thread *pmd,
 static void dp_netdev_add_rxq_to_pmd(struct dp_netdev_pmd_thread *pmd,
                                      struct dp_netdev_port *port,
                                      struct netdev_rxq *rx);
+static void reconfigure_pmd_threads(struct dp_netdev *dp)
+    OVS_REQUIRES(dp->port_mutex);
 static struct dp_netdev_pmd_thread *
 dp_netdev_less_loaded_pmd_on_numa(struct dp_netdev *dp, int numa_id);
 static void dp_netdev_reset_pmd_threads(struct dp_netdev *dp)
@@ -796,6 +798,43 @@ dpif_netdev_pmd_info(struct unixctl_conn *conn, int argc, 
const char *argv[],
     unixctl_command_reply(conn, ds_cstr(&reply));
     ds_destroy(&reply);
 }
+
+static void
+dpif_netdev_pmd_reconfigure(struct unixctl_conn *conn, int argc,
+                            const char *argv[], void *aux OVS_UNUSED)
+{
+    struct ds reply = DS_EMPTY_INITIALIZER;
+    struct dp_netdev *dp = NULL;
+
+    if (argc > 2) {
+        unixctl_command_reply_error(conn, "Invalid argument");
+        return;
+    }
+
+    ovs_mutex_lock(&dp_netdev_mutex);
+
+    if (argc == 2) {
+        dp = shash_find_data(&dp_netdevs, argv[1]);
+    } else if (shash_count(&dp_netdevs) == 1) {
+        /* There's only one datapath */
+        dp = shash_first(&dp_netdevs)->data;
+    }
+
+    if (!dp) {
+        unixctl_command_reply_error(conn,
+                                    "please specify an existing datapath");
+        goto exit;
+    }
+
+    ovs_mutex_lock(&dp->port_mutex);
+    reconfigure_pmd_threads(dp);
+    unixctl_command_reply(conn, ds_cstr(&reply));
+    ds_destroy(&reply);
+    ovs_mutex_unlock(&dp->port_mutex);
+exit:
+    ovs_mutex_unlock(&dp_netdev_mutex);
+}
+
 
 static int
 dpif_netdev_init(void)
@@ -813,6 +852,8 @@ dpif_netdev_init(void)
     unixctl_command_register("dpif-netdev/pmd-rxq-show", "[dp]",
                              0, 1, dpif_netdev_pmd_info,
                              (void *)&poll_aux);
+    unixctl_command_register("dpif-netdev/pmd-reconfigure", "[dp]",
+                             0, 1, dpif_netdev_pmd_reconfigure, NULL);
     return 0;
 }
 
diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in
index 3dacfc3..b181918 100644
--- a/vswitchd/ovs-vswitchd.8.in
+++ b/vswitchd/ovs-vswitchd.8.in
@@ -262,6 +262,9 @@ bridge statistics, only the values shown by the above 
command.
 .IP "\fBdpif-netdev/pmd-rxq-show\fR [\fIdp\fR]"
 For each pmd thread of the datapath \fIdp\fR shows list of queue-ids with
 port names, which this thread polls.
+.IP "\fBdpif-netdev/pmd-reconfigure\fR [\fIdp\fR]"
+This command can be used to force PMD threads to reload and apply new
+configuration.
 .
 .so ofproto/ofproto-dpif-unixctl.man
 .so ofproto/ofproto-unixctl.man
-- 
2.5.0

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to