net/mlx5/windows: fix link speed calculation

Message ID 20210405161844.9560-1-talshn@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5/windows: fix link speed calculation |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success travis build: passed
ci/github-robot success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/intel-Testing success Testing PASS

Commit Message

Tal Shnaiderman April 5, 2021, 4:18 p.m. UTC
  In Windows DevX returns the value of the current link speed
in bps rate, the conversion to the Mbps rate expected by DPDK
is incorrect and fixed.

Fixes: 6fbd73709ee4be32 ("net/mlx5: support link update on Windows")
Cc: stable@dpdk.org

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
---
 drivers/net/mlx5/windows/mlx5_ethdev_os.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon April 5, 2021, 7:01 p.m. UTC | #1
There is no previous commit with net/mlx5/windows as title prefix.
In general, there is "on Windows" at the end of the title.
This way we can have the same formatting when fixing the common code
for a Windows case.

05/04/2021 18:18, Tal Shnaiderman:
> In Windows DevX returns the value of the current link speed
> in bps rate, the conversion to the Mbps rate expected by DPDK
> is incorrect and fixed.

"was" incorrect.

I think you should explain the confusion between Mbit/s and Mibit/s.

> -	dev_link.link_speed = context_obj->mlx5_dev.link_speed / (1024 * 1024);
> +	dev_link.link_speed = context_obj->mlx5_dev.link_speed / (1000 * 1000);
  
Tal Shnaiderman April 6, 2021, 7:02 a.m. UTC | #2
> Subject: Re: [PATCH] net/mlx5/windows: fix link speed calculation
> 
> External email: Use caution opening links or attachments
> 
> 
> There is no previous commit with net/mlx5/windows as title prefix.
> In general, there is "on Windows" at the end of the title.
> This way we can have the same formatting when fixing the common code for a
> Windows case.
> 
> 05/04/2021 18:18, Tal Shnaiderman:
> > In Windows DevX returns the value of the current link speed in bps
> > rate, the conversion to the Mbps rate expected by DPDK is incorrect
> > and fixed.
> 
> "was" incorrect.
> 
> I think you should explain the confusion between Mbit/s and Mibit/s.
> 
> > -     dev_link.link_speed = context_obj->mlx5_dev.link_speed / (1024 * 1024);
> > +     dev_link.link_speed = context_obj->mlx5_dev.link_speed / (1000 *
> > + 1000);
> 
> 

Thanks Thomas for the review, will address the comments in v2.
  

Patch

diff --git a/drivers/net/mlx5/windows/mlx5_ethdev_os.c b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
index 8609d38eca..c709dd19be 100644
--- a/drivers/net/mlx5/windows/mlx5_ethdev_os.c
+++ b/drivers/net/mlx5/windows/mlx5_ethdev_os.c
@@ -254,7 +254,7 @@  mlx5_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 	}
 	priv = dev->data->dev_private;
 	context_obj = (mlx5_context_st *)priv->sh->ctx;
-	dev_link.link_speed = context_obj->mlx5_dev.link_speed / (1024 * 1024);
+	dev_link.link_speed = context_obj->mlx5_dev.link_speed / (1000 * 1000);
 	dev_link.link_status =
 	      (context_obj->mlx5_dev.link_state == 1 && !mlx5_is_removed(dev))
 	      ? 1 : 0;