Message ID | MEYP282MB34997FE55F3D940FC490B6BDCDD79@MEYP282MB3499.AUSP282.PROD.OUTLOOK.COM |
---|---|
State | Accepted |
Commit | 83c0a364725b35ed185c8d526327aca53a533709 |
Headers | show |
Series | [ovs-dev,1/2] dpif-netdev: Fix ALB parameters type mismatch. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | fail | github build: failed |
ovsrobot/intel-ovs-compilation | success | test: success |
On 24/05/2022 14:48, miterv@outlook.com wrote: > From: Lin Huang <linhuang@ruijie.com.cn> > > The ALB parameters should never be negative. > So it's to use unsigned smap_get versions to get it properly, and > update VLOG formatting. > > Fixes: 5bf84282482a ("Adding support for PMD auto load balancing") > Signed-off-by: Lin Huang <linhuang@ruijie.com.cn> Thanks for improving the parameter checking Lin. Acked-by: Kevin Traynor <ktraynor@redhat.com> > --- > lib/dpif-netdev.c | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) > > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c > index 21277b236..95b154185 100644 > --- a/lib/dpif-netdev.c > +++ b/lib/dpif-netdev.c > @@ -4778,8 +4778,8 @@ dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config) > uint32_t insert_min, cur_min; > uint32_t tx_flush_interval, cur_tx_flush_interval; > uint64_t rebalance_intvl; > - uint8_t rebalance_load, cur_rebalance_load; > - uint8_t rebalance_improve; > + uint8_t cur_rebalance_load; > + uint32_t rebalance_load, rebalance_improve; > bool log_autolb = false; > enum sched_assignment_type pmd_rxq_assign_type; > > @@ -4880,8 +4880,9 @@ 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 = > @@ -4894,21 +4895,21 @@ 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; > } > if (rebalance_improve != pmd_alb->rebalance_improve_thresh) { > pmd_alb->rebalance_improve_thresh = rebalance_improve; > VLOG_INFO("PMD auto load balance improvement threshold set to " > - "%"PRIu8"%%", rebalance_improve); > + "%"PRIu32"%%", rebalance_improve); > 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; > } > @@ -4916,7 +4917,7 @@ dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config) > if (rebalance_load != cur_rebalance_load) { > atomic_store_relaxed(&pmd_alb->rebalance_load_thresh, > rebalance_load); > - VLOG_INFO("PMD auto load balance load threshold set to %"PRIu8"%%", > + VLOG_INFO("PMD auto load balance load threshold set to %"PRIu32"%%", > rebalance_load); > log_autolb = true; > }
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 21277b236..95b154185 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -4778,8 +4778,8 @@ dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config) uint32_t insert_min, cur_min; uint32_t tx_flush_interval, cur_tx_flush_interval; uint64_t rebalance_intvl; - uint8_t rebalance_load, cur_rebalance_load; - uint8_t rebalance_improve; + uint8_t cur_rebalance_load; + uint32_t rebalance_load, rebalance_improve; bool log_autolb = false; enum sched_assignment_type pmd_rxq_assign_type; @@ -4880,8 +4880,9 @@ 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 = @@ -4894,21 +4895,21 @@ 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; } if (rebalance_improve != pmd_alb->rebalance_improve_thresh) { pmd_alb->rebalance_improve_thresh = rebalance_improve; VLOG_INFO("PMD auto load balance improvement threshold set to " - "%"PRIu8"%%", rebalance_improve); + "%"PRIu32"%%", rebalance_improve); 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; } @@ -4916,7 +4917,7 @@ dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config) if (rebalance_load != cur_rebalance_load) { atomic_store_relaxed(&pmd_alb->rebalance_load_thresh, rebalance_load); - VLOG_INFO("PMD auto load balance load threshold set to %"PRIu8"%%", + VLOG_INFO("PMD auto load balance load threshold set to %"PRIu32"%%", rebalance_load); log_autolb = true; }