diff mbox series

[ovs-dev,v2,1/2] dpif-netdev: Fix ALB parameters type mismatch.

Message ID MEYP282MB33023ECD4EC8338D5ED4980ECDC89@MEYP282MB3302.AUSP282.PROD.OUTLOOK.COM
State Superseded
Headers show
Series Fix ALB parameters type and value mismatch. | expand

Checks

Context Check Description
ovsrobot/apply-robot warning apply and check: warning
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

miter May 11, 2022, 2:25 p.m. UTC
From: linhuang <linhuang@ruijie.com.cn>

The ALB parameters should never be negative.
So it's to use unsigned smap_get versions to get it properly.

Fixes: 5bf84282482a ("Adding support for PMD auto load balancing")
Signed-off-by: Lin Huang <linhuang@ruijie.com.cn>
---
 lib/dpif-netdev.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Kevin Traynor May 12, 2022, 3:45 p.m. UTC | #1
On 11/05/2022 15:25, miterv@outlook.com wrote:
> From: linhuang <linhuang@ruijie.com.cn>
> 
> The ALB parameters should never be negative.
> So it's to use unsigned smap_get versions to get it properly.
> 

Thanks Lin, one comment below.

> Fixes: 5bf84282482a ("Adding support for PMD auto load balancing")
> Signed-off-by: Lin Huang <linhuang@ruijie.com.cn>
> ---
>   lib/dpif-netdev.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index 61929049c..23ceccf3a 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -4879,8 +4879,8 @@ dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
>   
>       struct pmd_auto_lb *pmd_alb = &dp->pmd_alb;
>   
> -    rebalance_intvl = smap_get_int(other_config, "pmd-auto-lb-rebal-interval",
> -                                   ALB_REBALANCE_INTERVAL);
> +    rebalance_intvl = smap_get_ullong(other_config, "pmd-auto-lb-rebal-interval",
> +                                      ALB_REBALANCE_INTERVAL);
>   
>       /* Input is in min, convert it to msec. */
>       rebalance_intvl =
> @@ -4893,9 +4893,9 @@ dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
>           log_autolb = true;
>       }
>   
> -    rebalance_improve = smap_get_int(other_config,
> -                                     "pmd-auto-lb-improvement-threshold",
> -                                     ALB_IMPROVEMENT_THRESHOLD);
> +    rebalance_improve = smap_get_uint(other_config,
> +                                      "pmd-auto-lb-improvement-threshold",
> +                                      ALB_IMPROVEMENT_THRESHOLD);
>       if (rebalance_improve > 100) {
>           rebalance_improve = ALB_IMPROVEMENT_THRESHOLD;
>       }
> @@ -4906,8 +4906,8 @@ dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
>           log_autolb = true;
>       }
>   
> -    rebalance_load = smap_get_int(other_config, "pmd-auto-lb-load-threshold",
> -                                  ALB_LOAD_THRESHOLD);
> +    rebalance_load = smap_get_uint(other_config, "pmd-auto-lb-load-threshold",
> +                                   ALB_LOAD_THRESHOLD);

Not sure if you saw that Mike made a comment on the load/improve params 
and there is a suggestion how to fix it? See msgs below.

https://mail.openvswitch.org/pipermail/ovs-dev/2022-May/393872.html
https://mail.openvswitch.org/pipermail/ovs-dev/2022-May/393899.html

>       if (rebalance_load > 100) {
>           rebalance_load = ALB_LOAD_THRESHOLD;
>       }
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 61929049c..23ceccf3a 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -4879,8 +4879,8 @@  dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
 
     struct pmd_auto_lb *pmd_alb = &dp->pmd_alb;
 
-    rebalance_intvl = smap_get_int(other_config, "pmd-auto-lb-rebal-interval",
-                                   ALB_REBALANCE_INTERVAL);
+    rebalance_intvl = smap_get_ullong(other_config, "pmd-auto-lb-rebal-interval",
+                                      ALB_REBALANCE_INTERVAL);
 
     /* Input is in min, convert it to msec. */
     rebalance_intvl =
@@ -4893,9 +4893,9 @@  dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
         log_autolb = true;
     }
 
-    rebalance_improve = smap_get_int(other_config,
-                                     "pmd-auto-lb-improvement-threshold",
-                                     ALB_IMPROVEMENT_THRESHOLD);
+    rebalance_improve = smap_get_uint(other_config,
+                                      "pmd-auto-lb-improvement-threshold",
+                                      ALB_IMPROVEMENT_THRESHOLD);
     if (rebalance_improve > 100) {
         rebalance_improve = ALB_IMPROVEMENT_THRESHOLD;
     }
@@ -4906,8 +4906,8 @@  dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)
         log_autolb = true;
     }
 
-    rebalance_load = smap_get_int(other_config, "pmd-auto-lb-load-threshold",
-                                  ALB_LOAD_THRESHOLD);
+    rebalance_load = smap_get_uint(other_config, "pmd-auto-lb-load-threshold",
+                                   ALB_LOAD_THRESHOLD);
     if (rebalance_load > 100) {
         rebalance_load = ALB_LOAD_THRESHOLD;
     }