[ovs-dev,v4,6/6] dpif-netdev: Add ovs-appctl dpif-netdev/pmd-rxq-rebalance.

Submitted by Kevin Traynor on Aug. 9, 2017, 3:45 p.m.

Details

Message ID 1502293530-10783-7-git-send-email-ktraynor@redhat.com
State New
Headers show

Commit Message

Kevin Traynor Aug. 9, 2017, 3:45 p.m.
Rxqs consumed processing cycles are used to improve the balance
of how rxqs are assigned to pmds. Currently some reconfiguration
is needed to perform a reassignment.

Add an ovs-appctl command to perform a new assignment in order
to balance based on the latest rxq processing cycle information.

Note: Jan requested this for testing purposes.

Suggested-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 Documentation/howto/dpdk.rst |  5 ++++-
 lib/dpif-netdev.c            | 35 +++++++++++++++++++++++++++++++++++
 vswitchd/ovs-vswitchd.8.in   |  2 ++
 3 files changed, 41 insertions(+), 1 deletion(-)

Comments

Greg Rose Aug. 10, 2017, 11:21 p.m.
On 08/09/2017 08:45 AM, Kevin Traynor wrote:
> Rxqs consumed processing cycles are used to improve the balance
> of how rxqs are assigned to pmds. Currently some reconfiguration
> is needed to perform a reassignment.
>
> Add an ovs-appctl command to perform a new assignment in order
> to balance based on the latest rxq processing cycle information.
>
> Note: Jan requested this for testing purposes.
>
> Suggested-by: Jan Scheurich <jan.scheurich@ericsson.com>
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
> ---
>   Documentation/howto/dpdk.rst |  5 ++++-
>   lib/dpif-netdev.c            | 35 +++++++++++++++++++++++++++++++++++
>   vswitchd/ovs-vswitchd.8.in   |  2 ++
>   3 files changed, 41 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst
> index 493e215..5d009bd 100644
> --- a/Documentation/howto/dpdk.rst
> +++ b/Documentation/howto/dpdk.rst
> @@ -140,5 +140,8 @@ Core 7: Q4 (70%) | Q5 (10%)
>   core 8: Q0 (60%) | Q0 (30%)
>
> -Rxq to pmds assignment takes place whenever there are configuration changes.
> +Rxq to pmds assignment takes place whenever there are configuration changes
> +or can be triggered by using::
> +
> +    $ ovs-appctl dpif-netdev/pmd-rxq-rebalance
>
>   QoS
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index b0f4010..8857489 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -708,4 +708,6 @@ static inline bool emc_entry_alive(struct emc_entry *ce);
>   static void emc_clear_entry(struct emc_entry *ce);
>
> +static void dp_netdev_request_reconfigure(struct dp_netdev *dp);
> +
>   static void
>   emc_cache_init(struct emc_cache *flow_cache)
> @@ -1001,4 +1003,34 @@ sorted_poll_thread_list(struct dp_netdev *dp,
>
>   static void
> +dpif_netdev_pmd_rebalance(struct unixctl_conn *conn, int argc,
> +                          const char *argv[], void *aux OVS_UNUSED)
> +{
> +    struct ds reply = DS_EMPTY_INITIALIZER;
> +    struct dp_netdev *dp = NULL;
> +
> +    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) {
> +        ovs_mutex_unlock(&dp_netdev_mutex);
> +        unixctl_command_reply_error(conn,
> +                                    "please specify an existing datapath");
> +        return;
> +    }
> +
> +    dp_netdev_request_reconfigure(dp);
> +    ovs_mutex_unlock(&dp_netdev_mutex);
> +    ds_put_cstr(&reply, "pmd rxq rebalance requested.\n");
> +    unixctl_command_reply(conn, ds_cstr(&reply));
> +    ds_destroy(&reply);
> +}
> +
> +static void
>   dpif_netdev_pmd_info(struct unixctl_conn *conn, int argc, const char *argv[],
>                        void *aux)
> @@ -1078,4 +1110,7 @@ dpif_netdev_init(void)
>                                0, 1, dpif_netdev_pmd_info,
>                                (void *)&poll_aux);
> +    unixctl_command_register("dpif-netdev/pmd-rxq-rebalance", "[dp]",
> +                             0, 1, dpif_netdev_pmd_rebalance,
> +                             NULL);
>       return 0;
>   }
> diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in
> index dfd209e..c18baf6 100644
> --- a/vswitchd/ovs-vswitchd.8.in
> +++ b/vswitchd/ovs-vswitchd.8.in
> @@ -281,4 +281,6 @@ bridge statistics, only the values shown by the above command.
>   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-rxq-rebalance\fR [\fIdp\fR]"
> +Reassigns rxqs to pmds in the datapath \fIdp\fR based on their current usage.
>   .
>   .so ofproto/ofproto-dpif-unixctl.man
>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>

Patch hide | download patch | download mbox

diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst
index 493e215..5d009bd 100644
--- a/Documentation/howto/dpdk.rst
+++ b/Documentation/howto/dpdk.rst
@@ -140,5 +140,8 @@  Core 7: Q4 (70%) | Q5 (10%)
 core 8: Q0 (60%) | Q0 (30%)
 
-Rxq to pmds assignment takes place whenever there are configuration changes.
+Rxq to pmds assignment takes place whenever there are configuration changes
+or can be triggered by using::
+
+    $ ovs-appctl dpif-netdev/pmd-rxq-rebalance
 
 QoS
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index b0f4010..8857489 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -708,4 +708,6 @@  static inline bool emc_entry_alive(struct emc_entry *ce);
 static void emc_clear_entry(struct emc_entry *ce);
 
+static void dp_netdev_request_reconfigure(struct dp_netdev *dp);
+
 static void
 emc_cache_init(struct emc_cache *flow_cache)
@@ -1001,4 +1003,34 @@  sorted_poll_thread_list(struct dp_netdev *dp,
 
 static void
+dpif_netdev_pmd_rebalance(struct unixctl_conn *conn, int argc,
+                          const char *argv[], void *aux OVS_UNUSED)
+{
+    struct ds reply = DS_EMPTY_INITIALIZER;
+    struct dp_netdev *dp = NULL;
+
+    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) {
+        ovs_mutex_unlock(&dp_netdev_mutex);
+        unixctl_command_reply_error(conn,
+                                    "please specify an existing datapath");
+        return;
+    }
+
+    dp_netdev_request_reconfigure(dp);
+    ovs_mutex_unlock(&dp_netdev_mutex);
+    ds_put_cstr(&reply, "pmd rxq rebalance requested.\n");
+    unixctl_command_reply(conn, ds_cstr(&reply));
+    ds_destroy(&reply);
+}
+
+static void
 dpif_netdev_pmd_info(struct unixctl_conn *conn, int argc, const char *argv[],
                      void *aux)
@@ -1078,4 +1110,7 @@  dpif_netdev_init(void)
                              0, 1, dpif_netdev_pmd_info,
                              (void *)&poll_aux);
+    unixctl_command_register("dpif-netdev/pmd-rxq-rebalance", "[dp]",
+                             0, 1, dpif_netdev_pmd_rebalance,
+                             NULL);
     return 0;
 }
diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in
index dfd209e..c18baf6 100644
--- a/vswitchd/ovs-vswitchd.8.in
+++ b/vswitchd/ovs-vswitchd.8.in
@@ -281,4 +281,6 @@  bridge statistics, only the values shown by the above command.
 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-rxq-rebalance\fR [\fIdp\fR]"
+Reassigns rxqs to pmds in the datapath \fIdp\fR based on their current usage.
 .
 .so ofproto/ofproto-dpif-unixctl.man