]>
Commit | Line | Data |
---|---|---|
a0a93ff7 TL |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: Thomas Lamprecht <t.lamprecht@proxmox.com> | |
3 | Date: Sat, 7 Jan 2023 13:48:41 +0100 | |
4 | Subject: [PATCH] Revert "RDMA/irdma: Report the correct link speed" | |
5 | ||
6 | seem to cause a regression with some NICs: | |
7 | https://lore.kernel.org/netdev/CAK8fFZ6A_Gphw_3-QMGKEFQk=sfCw1Qmq0TVZK3rtAi7vb621A@mail.gmail.com/ | |
8 | ||
9 | This reverts commit e8553504e366c8a47d1f6156c30d6eb9778cda13. | |
10 | ||
11 | Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> | |
12 | --- | |
13 | drivers/infiniband/hw/irdma/verbs.c | 35 ++++++++++++++++++++++++++--- | |
14 | 1 file changed, 32 insertions(+), 3 deletions(-) | |
15 | ||
16 | diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c | |
17 | index f6973ea55eda..132fe91bb799 100644 | |
18 | --- a/drivers/infiniband/hw/irdma/verbs.c | |
19 | +++ b/drivers/infiniband/hw/irdma/verbs.c | |
20 | @@ -63,6 +63,36 @@ static int irdma_query_device(struct ib_device *ibdev, | |
21 | return 0; | |
22 | } | |
23 | ||
24 | +/** | |
25 | + * irdma_get_eth_speed_and_width - Get IB port speed and width from netdev speed | |
26 | + * @link_speed: netdev phy link speed | |
27 | + * @active_speed: IB port speed | |
28 | + * @active_width: IB port width | |
29 | + */ | |
30 | +static void irdma_get_eth_speed_and_width(u32 link_speed, u16 *active_speed, | |
31 | + u8 *active_width) | |
32 | +{ | |
33 | + if (link_speed <= SPEED_1000) { | |
34 | + *active_width = IB_WIDTH_1X; | |
35 | + *active_speed = IB_SPEED_SDR; | |
36 | + } else if (link_speed <= SPEED_10000) { | |
37 | + *active_width = IB_WIDTH_1X; | |
38 | + *active_speed = IB_SPEED_FDR10; | |
39 | + } else if (link_speed <= SPEED_20000) { | |
40 | + *active_width = IB_WIDTH_4X; | |
41 | + *active_speed = IB_SPEED_DDR; | |
42 | + } else if (link_speed <= SPEED_25000) { | |
43 | + *active_width = IB_WIDTH_1X; | |
44 | + *active_speed = IB_SPEED_EDR; | |
45 | + } else if (link_speed <= SPEED_40000) { | |
46 | + *active_width = IB_WIDTH_4X; | |
47 | + *active_speed = IB_SPEED_FDR10; | |
48 | + } else { | |
49 | + *active_width = IB_WIDTH_4X; | |
50 | + *active_speed = IB_SPEED_EDR; | |
51 | + } | |
52 | +} | |
53 | + | |
54 | /** | |
55 | * irdma_query_port - get port attributes | |
56 | * @ibdev: device pointer from stack | |
57 | @@ -90,9 +120,8 @@ static int irdma_query_port(struct ib_device *ibdev, u32 port, | |
58 | props->state = IB_PORT_DOWN; | |
59 | props->phys_state = IB_PORT_PHYS_STATE_DISABLED; | |
60 | } | |
61 | - | |
62 | - ib_get_eth_speed(ibdev, port, &props->active_speed, | |
63 | - &props->active_width); | |
64 | + irdma_get_eth_speed_and_width(SPEED_100000, &props->active_speed, | |
65 | + &props->active_width); | |
66 | ||
67 | if (rdma_protocol_roce(ibdev, 1)) { | |
68 | props->gid_tbl_len = 32; |