Skip to content

Commit

Permalink
Revert "ksmbd: fix missing RDMA-capable flag for IPoIB device in ksmb…
Browse files Browse the repository at this point in the history
…d_rdma_capable_netdev()"

This reverts commit ecce70c.

Revert the GUID trick code causing the layering violation.
I will try to allow the users to turn RDMA-capable on/off via sysfs later

Cc: Kangjing Huang <huangkangjing@gmail.com>
Cc: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
Namjae Jeon authored and Steve French committed Mar 28, 2025
1 parent bab703e commit 1a81ea7
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions fs/smb/server/transport_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -2142,7 +2142,8 @@ static int smb_direct_ib_client_add(struct ib_device *ib_dev)
if (ib_dev->node_type != RDMA_NODE_IB_CA)
smb_direct_port = SMB_DIRECT_PORT_IWARP;

if (!rdma_frwr_is_supported(&ib_dev->attrs))
if (!ib_dev->ops.get_netdev ||
!rdma_frwr_is_supported(&ib_dev->attrs))
return 0;

smb_dev = kzalloc(sizeof(*smb_dev), KSMBD_DEFAULT_GFP);
Expand Down Expand Up @@ -2242,38 +2243,17 @@ bool ksmbd_rdma_capable_netdev(struct net_device *netdev)
for (i = 0; i < smb_dev->ib_dev->phys_port_cnt; i++) {
struct net_device *ndev;

if (smb_dev->ib_dev->ops.get_netdev) {
ndev = smb_dev->ib_dev->ops.get_netdev(
smb_dev->ib_dev, i + 1);
if (!ndev)
continue;
ndev = smb_dev->ib_dev->ops.get_netdev(smb_dev->ib_dev,
i + 1);
if (!ndev)
continue;

if (ndev == netdev) {
dev_put(ndev);
rdma_capable = true;
goto out;
}
if (ndev == netdev) {
dev_put(ndev);
/* if ib_dev does not implement ops.get_netdev
* check for matching infiniband GUID in hw_addr
*/
} else if (netdev->type == ARPHRD_INFINIBAND) {
struct netdev_hw_addr *ha;
union ib_gid gid;
u32 port_num;
int ret;

netdev_hw_addr_list_for_each(
ha, &netdev->dev_addrs) {
memcpy(&gid, ha->addr + 4, sizeof(gid));
ret = ib_find_gid(smb_dev->ib_dev, &gid,
&port_num, NULL);
if (!ret) {
rdma_capable = true;
goto out;
}
}
rdma_capable = true;
goto out;
}
dev_put(ndev);
}
}
out:
Expand Down

0 comments on commit 1a81ea7

Please sign in to comment.