diff mbox series

[ovs-dev,v6,3/4] dpif-netdev: Add PMD auto load balance status log.

Message ID 20201221131033.835007-4-ktraynor@redhat.com
State Accepted
Headers show
Series Add PMD auto load balance parameters. | expand

Commit Message

Kevin Traynor Dec. 21, 2020, 1:10 p.m. UTC
When any PMD auto load balance parameters change, it is useful
to also log if the feature is enabled or disabled.

|dpif_netdev|INFO|PMD auto load balance pmd load threshold changed to 70%
|dpif_netdev|INFO|PMD auto load balance is disabled

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: David Marchand <david.marchand@redhat.com>
---
 lib/dpif-netdev.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Stokes, Ian Jan. 14, 2021, 7:49 p.m. UTC | #1
> When any PMD auto load balance parameters change, it is useful
> to also log if the feature is enabled or disabled.
> 
> |dpif_netdev|INFO|PMD auto load balance pmd load threshold changed to
> 70%
> |dpif_netdev|INFO|PMD auto load balance is disabled
> 
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
> Acked-by: David Marchand <david.marchand@redhat.com>

Thanks for the patch, LGTM, tested fine.

Acked-by: ian.stokes@intel.com

> ---
>  lib/dpif-netdev.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index bf2112815..c78f22c54 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -4202,5 +4202,5 @@ dpif_netdev_operate(struct dpif *dpif, struct
> dpif_op **ops, size_t n_ops,
>  /* Enable or Disable PMD auto load balancing. */
>  static void
> -set_pmd_auto_lb(struct dp_netdev *dp)
> +set_pmd_auto_lb(struct dp_netdev *dp, bool always_log)
>  {
>      unsigned int cnt = 0;
> @@ -4234,5 +4234,5 @@ set_pmd_auto_lb(struct dp_netdev *dp)
>                      pmd_alb->auto_lb_requested;
> 
> -    if (pmd_alb->is_enabled != enable_alb) {
> +    if (pmd_alb->is_enabled != enable_alb || always_log) {
>          pmd_alb->is_enabled = enable_alb;
>          if (pmd_alb->is_enabled) {
> @@ -4252,5 +4252,4 @@ set_pmd_auto_lb(struct dp_netdev *dp)
>          }
>      }
> -
>  }
> 
> @@ -4272,4 +4271,5 @@ dpif_netdev_set_config(struct dpif *dpif, const
> struct smap *other_config)
>      uint8_t rebalance_load, cur_rebalance_load;
>      uint8_t rebalance_improve;
> +    bool log_autolb = false;
> 
>      tx_flush_interval = smap_get_int(other_config, "tx-flush-interval",
> @@ -4359,4 +4359,5 @@ dpif_netdev_set_config(struct dpif *dpif, const
> struct smap *other_config)
>          VLOG_INFO("PMD auto load balance interval set to "
>                    "%"PRIu64" mins\n", rebalance_intvl / MIN_TO_MSEC);
> +        log_autolb = true;
>      }
> 
> @@ -4370,4 +4371,5 @@ dpif_netdev_set_config(struct dpif *dpif, const
> struct smap *other_config)
>          VLOG_INFO("PMD auto load balance improvement threshold set to "
>                    "%"PRIu8"%%\n", rebalance_improve);
> +        log_autolb = true;
>      }
> 
> @@ -4383,6 +4385,7 @@ dpif_netdev_set_config(struct dpif *dpif, const
> struct smap *other_config)
>          VLOG_INFO("PMD auto load balance pmd load threshold set to "
>                  "%"PRIu8"%%\n", rebalance_load);
> +        log_autolb = true;
>      }
> -    set_pmd_auto_lb(dp);
> +    set_pmd_auto_lb(dp, log_autolb);
>      return 0;
>  }
> @@ -5468,5 +5471,5 @@ reconfigure_datapath(struct dp_netdev *dp)
> 
>      /* Check if PMD Auto LB is to be enabled */
> -    set_pmd_auto_lb(dp);
> +    set_pmd_auto_lb(dp, false);
>  }
> 
> --
> 2.26.2
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index bf2112815..c78f22c54 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -4202,5 +4202,5 @@  dpif_netdev_operate(struct dpif *dpif, struct dpif_op **ops, size_t n_ops,
 /* Enable or Disable PMD auto load balancing. */
 static void
-set_pmd_auto_lb(struct dp_netdev *dp)
+set_pmd_auto_lb(struct dp_netdev *dp, bool always_log)
 {
     unsigned int cnt = 0;
@@ -4234,5 +4234,5 @@  set_pmd_auto_lb(struct dp_netdev *dp)
                     pmd_alb->auto_lb_requested;
 
-    if (pmd_alb->is_enabled != enable_alb) {
+    if (pmd_alb->is_enabled != enable_alb || always_log) {
         pmd_alb->is_enabled = enable_alb;
         if (pmd_alb->is_enabled) {
@@ -4252,5 +4252,4 @@  set_pmd_auto_lb(struct dp_netdev *dp)
         }
     }
-
 }
 
@@ -4272,4 +4271,5 @@  dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
     uint8_t rebalance_load, cur_rebalance_load;
     uint8_t rebalance_improve;
+    bool log_autolb = false;
 
     tx_flush_interval = smap_get_int(other_config, "tx-flush-interval",
@@ -4359,4 +4359,5 @@  dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
         VLOG_INFO("PMD auto load balance interval set to "
                   "%"PRIu64" mins\n", rebalance_intvl / MIN_TO_MSEC);
+        log_autolb = true;
     }
 
@@ -4370,4 +4371,5 @@  dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
         VLOG_INFO("PMD auto load balance improvement threshold set to "
                   "%"PRIu8"%%\n", rebalance_improve);
+        log_autolb = true;
     }
 
@@ -4383,6 +4385,7 @@  dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
         VLOG_INFO("PMD auto load balance pmd load threshold set to "
                 "%"PRIu8"%%\n", rebalance_load);
+        log_autolb = true;
     }
-    set_pmd_auto_lb(dp);
+    set_pmd_auto_lb(dp, log_autolb);
     return 0;
 }
@@ -5468,5 +5471,5 @@  reconfigure_datapath(struct dp_netdev *dp)
 
     /* Check if PMD Auto LB is to be enabled */
-    set_pmd_auto_lb(dp);
+    set_pmd_auto_lb(dp, false);
 }