diff mbox series

[v5,2/3] rte_pie: remove unnecessary floating point

Message ID 20220526202653.99796-3-stephen@networkplumber.org (mailing list archive)
State Accepted
Delegated to: Thomas Monjalon
Headers show
Series introduce random floating point function | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger May 26, 2022, 8:26 p.m. UTC
The qdelay variable is derived from and compared to 64 bit
value so it doesn't have to be floating point.

Fixes: 44c730b0e379 ("sched: add PIE based congestion management")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/sched/rte_pie.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dumitrescu, Cristian May 30, 2022, 11:50 a.m. UTC | #1
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Thursday, May 26, 2022 9:27 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Dumitrescu,
> Cristian <cristian.dumitrescu@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>; Wojciech Liguzinski
> <wojciechx.liguzinski@intel.com>
> Subject: [PATCH v5 2/3] rte_pie: remove unnecessary floating point
> 
> The qdelay variable is derived from and compared to 64 bit
> value so it doesn't have to be floating point.
> 
> Fixes: 44c730b0e379 ("sched: add PIE based congestion management")
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/sched/rte_pie.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/sched/rte_pie.h b/lib/sched/rte_pie.h
> index 02a987f54ad1..3e2c1ef46721 100644
> --- a/lib/sched/rte_pie.h
> +++ b/lib/sched/rte_pie.h
> @@ -218,7 +218,7 @@ _rte_pie_drop(const struct rte_pie_config *pie_cfg,
>  	struct rte_pie *pie)
>  {
>  	uint64_t rand_value;
> -	double qdelay = pie_cfg->qdelay_ref * 0.5;
> +	uint64_t qdelay = pie_cfg->qdelay_ref / 2;
> 
>  	/* PIE is active but the queue is not congested: return 0 */
>  	if (((pie->qdelay_old < qdelay) && (pie->drop_prob < 0.2)) ||
> --
> 2.35.1

Hi Stephen,

Thanks for your proposed fix. It looks good to me, but since Jasvinder handled the PIE integration, I am going to defer this for his review once he comes back from vacation, just to make sure I am not missing anything here.

Regards,
Cristian
Singh, Jasvinder June 21, 2022, 8:18 a.m. UTC | #2
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Thursday, May 26, 2022 9:27 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Dumitrescu,
> Cristian <cristian.dumitrescu@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>; Wojciech Liguzinski
> <wojciechx.liguzinski@intel.com>
> Subject: [PATCH v5 2/3] rte_pie: remove unnecessary floating point
> 
> The qdelay variable is derived from and compared to 64 bit value so it doesn't
> have to be floating point.
> 
> Fixes: 44c730b0e379 ("sched: add PIE based congestion management")
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/sched/rte_pie.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/sched/rte_pie.h b/lib/sched/rte_pie.h index
> 02a987f54ad1..3e2c1ef46721 100644
> --- a/lib/sched/rte_pie.h
> +++ b/lib/sched/rte_pie.h
> @@ -218,7 +218,7 @@ _rte_pie_drop(const struct rte_pie_config *pie_cfg,
>  	struct rte_pie *pie)
>  {
>  	uint64_t rand_value;
> -	double qdelay = pie_cfg->qdelay_ref * 0.5;
> +	uint64_t qdelay = pie_cfg->qdelay_ref / 2;
> 
>  	/* PIE is active but the queue is not congested: return 0 */
>  	if (((pie->qdelay_old < qdelay) && (pie->drop_prob < 0.2)) ||
> --
> 2.35.1


Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
diff mbox series

Patch

diff --git a/lib/sched/rte_pie.h b/lib/sched/rte_pie.h
index 02a987f54ad1..3e2c1ef46721 100644
--- a/lib/sched/rte_pie.h
+++ b/lib/sched/rte_pie.h
@@ -218,7 +218,7 @@  _rte_pie_drop(const struct rte_pie_config *pie_cfg,
 	struct rte_pie *pie)
 {
 	uint64_t rand_value;
-	double qdelay = pie_cfg->qdelay_ref * 0.5;
+	uint64_t qdelay = pie_cfg->qdelay_ref / 2;
 
 	/* PIE is active but the queue is not congested: return 0 */
 	if (((pie->qdelay_old < qdelay) && (pie->drop_prob < 0.2)) ||