diff mbox series

[for-rc] irdma: Report the correct link speed

Message ID 20221104234957.1135-1-shiraz.saleem@intel.com (mailing list archive)
State Accepted
Commit 4eace75e0853273755b878ffa9cce6de84df975a
Headers show
Series [for-rc] irdma: Report the correct link speed | expand

Commit Message

Saleem, Shiraz Nov. 4, 2022, 11:49 p.m. UTC
The active link speed is currently hard-coded in irdma_query_port due
to which the port rate in ibstatus does reflect the active link speed.

Call ib_get_eth_speed in irdma_query_port to get the active link speed.

Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")
Reported-by: Kamal Heib <kamalheib1@gmail.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
---
 drivers/infiniband/hw/irdma/verbs.c | 34 ++--------------------------------
 1 file changed, 2 insertions(+), 32 deletions(-)

Comments

Leon Romanovsky Nov. 7, 2022, 7:12 a.m. UTC | #1
On Fri, Nov 04, 2022 at 06:49:57PM -0500, Shiraz Saleem wrote:
> The active link speed is currently hard-coded in irdma_query_port due
> to which the port rate in ibstatus does reflect the active link speed.
> 
> Call ib_get_eth_speed in irdma_query_port to get the active link speed.
> 
> Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")
> Reported-by: Kamal Heib <kamalheib1@gmail.com>
> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
> ---
>  drivers/infiniband/hw/irdma/verbs.c | 34 ++--------------------------------
>  1 file changed, 2 insertions(+), 32 deletions(-)

I fixed title to be "RDMA/irdma ..." and applied to -next and not to -rc.

Thanks
Leon Romanovsky Nov. 7, 2022, 7:27 a.m. UTC | #2
On Fri, 4 Nov 2022 18:49:57 -0500, Shiraz Saleem wrote:
> The active link speed is currently hard-coded in irdma_query_port due
> to which the port rate in ibstatus does reflect the active link speed.
> 
> Call ib_get_eth_speed in irdma_query_port to get the active link speed.
> 
> 

Applied, thanks!

[1/1] irdma: Report the correct link speed
      https://git.kernel.org/rdma/rdma/c/4eace75e085327

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index bfa790c..21d1e3b 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -64,36 +64,6 @@  static int irdma_query_device(struct ib_device *ibdev,
 }
 
 /**
- * irdma_get_eth_speed_and_width - Get IB port speed and width from netdev speed
- * @link_speed: netdev phy link speed
- * @active_speed: IB port speed
- * @active_width: IB port width
- */
-static void irdma_get_eth_speed_and_width(u32 link_speed, u16 *active_speed,
-					  u8 *active_width)
-{
-	if (link_speed <= SPEED_1000) {
-		*active_width = IB_WIDTH_1X;
-		*active_speed = IB_SPEED_SDR;
-	} else if (link_speed <= SPEED_10000) {
-		*active_width = IB_WIDTH_1X;
-		*active_speed = IB_SPEED_FDR10;
-	} else if (link_speed <= SPEED_20000) {
-		*active_width = IB_WIDTH_4X;
-		*active_speed = IB_SPEED_DDR;
-	} else if (link_speed <= SPEED_25000) {
-		*active_width = IB_WIDTH_1X;
-		*active_speed = IB_SPEED_EDR;
-	} else if (link_speed <= SPEED_40000) {
-		*active_width = IB_WIDTH_4X;
-		*active_speed = IB_SPEED_FDR10;
-	} else {
-		*active_width = IB_WIDTH_4X;
-		*active_speed = IB_SPEED_EDR;
-	}
-}
-
-/**
  * irdma_query_port - get port attributes
  * @ibdev: device pointer from stack
  * @port: port number for query
@@ -120,8 +90,8 @@  static int irdma_query_port(struct ib_device *ibdev, u32 port,
 		props->state = IB_PORT_DOWN;
 		props->phys_state = IB_PORT_PHYS_STATE_DISABLED;
 	}
-	irdma_get_eth_speed_and_width(SPEED_100000, &props->active_speed,
-				      &props->active_width);
+
+	ib_get_eth_speed(ibdev, port, &props->active_speed, &props->active_width);
 
 	if (rdma_protocol_roce(ibdev, 1)) {
 		props->gid_tbl_len = 32;