Skip to content

Commit 4eace75

Browse files
shirazsaleemrleon
authored andcommitted
RDMA/irdma: Report the correct link speed
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: b48c24c ("RDMA/irdma: Implement device supported verb APIs") Reported-by: Kamal Heib <[email protected]> Signed-off-by: Shiraz Saleem <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent abef378 commit 4eace75

File tree

1 file changed

+3
-32
lines changed

1 file changed

+3
-32
lines changed

drivers/infiniband/hw/irdma/verbs.c

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -63,36 +63,6 @@ static int irdma_query_device(struct ib_device *ibdev,
6363
return 0;
6464
}
6565

66-
/**
67-
* irdma_get_eth_speed_and_width - Get IB port speed and width from netdev speed
68-
* @link_speed: netdev phy link speed
69-
* @active_speed: IB port speed
70-
* @active_width: IB port width
71-
*/
72-
static void irdma_get_eth_speed_and_width(u32 link_speed, u16 *active_speed,
73-
u8 *active_width)
74-
{
75-
if (link_speed <= SPEED_1000) {
76-
*active_width = IB_WIDTH_1X;
77-
*active_speed = IB_SPEED_SDR;
78-
} else if (link_speed <= SPEED_10000) {
79-
*active_width = IB_WIDTH_1X;
80-
*active_speed = IB_SPEED_FDR10;
81-
} else if (link_speed <= SPEED_20000) {
82-
*active_width = IB_WIDTH_4X;
83-
*active_speed = IB_SPEED_DDR;
84-
} else if (link_speed <= SPEED_25000) {
85-
*active_width = IB_WIDTH_1X;
86-
*active_speed = IB_SPEED_EDR;
87-
} else if (link_speed <= SPEED_40000) {
88-
*active_width = IB_WIDTH_4X;
89-
*active_speed = IB_SPEED_FDR10;
90-
} else {
91-
*active_width = IB_WIDTH_4X;
92-
*active_speed = IB_SPEED_EDR;
93-
}
94-
}
95-
9666
/**
9767
* irdma_query_port - get port attributes
9868
* @ibdev: device pointer from stack
@@ -120,8 +90,9 @@ static int irdma_query_port(struct ib_device *ibdev, u32 port,
12090
props->state = IB_PORT_DOWN;
12191
props->phys_state = IB_PORT_PHYS_STATE_DISABLED;
12292
}
123-
irdma_get_eth_speed_and_width(SPEED_100000, &props->active_speed,
124-
&props->active_width);
93+
94+
ib_get_eth_speed(ibdev, port, &props->active_speed,
95+
&props->active_width);
12596

12697
if (rdma_protocol_roce(ibdev, 1)) {
12798
props->gid_tbl_len = 32;

0 commit comments

Comments
 (0)