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