Skip to contentSkip to conversation

RDMA/mlx4: Read pkey table length instead of hardcoded value

PATCH Applied Leon Romanovsky 2 participants 2 messages Aug 24, 2020 – Aug 27, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/mlx4: Read pkey table length instead of hardcoded value

From: Mark Bloch <[email protected]>

If the pkey_table is not available (which is the case when RoCE is not supported), the cited commit caused a regression where mlx4_devices without RoCE are not created.

Fix this by returning a pkey table length of zero in procedure eth_link_query_port() if the pkey-table length reported by the device is zero.

Cc Long Li <[email protected]>
Fixes 1901b91f9982 ("IB/core: Fix potential NULL pointer dereference in pkey cache")
Fixes fa417f7b520e ("IB/mlx4: Add support for IBoE")

---
Changelog:
v1: Used commit message suggested by Jack
v0:
https://lore.kernel.org/linux-rdma/[email protected]

---
 drivers/infiniband/hw/mlx4/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/main.c +2 -1
index 5e7910a517da..bd4f975e7f9a 100644
@@ -784,7 +784,8 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port,
 	props->ip_gids = true;
 	props->gid_tbl_len	= mdev->dev->caps.gid_table_len[port];
 	props->max_msg_sz	= mdev->dev->caps.max_msg_sz;
-	props->pkey_tbl_len	= 1;
+	if (mdev->dev->caps.pkey_table_len[port])
+		props->pkey_tbl_len = 1;
 	props->max_mtu		= IB_MTU_4096;
 	props->max_vl_num	= 2;
 	props->state		= IB_PORT_DOWN;

--
2.26.2

maintainer Applied
#1 lore raw
Quoted 10 lines · Leon Romanovsky

From: Mark Bloch <[email protected]>

If the pkey_table is not available (which is the case when RoCE is not supported), the cited commit caused a regression where mlx4_devices without RoCE are not created.

Fix this by returning a pkey table length of zero in procedure eth_link_query_port() if the pkey-table length reported by the device is zero.

Quoted 7 lines
Cc Long Li <[email protected]>
Fixes 1901b91f9982 ("IB/core: Fix potential NULL pointer dereference in pkey cache")
Fixes fa417f7b520e ("IB/mlx4: Add support for IBoE")

Applied to for-rc, thanks

Jason