Commit 8d20a1f0 authored by Parav Pandit's avatar Parav Pandit Committed by Jason Gunthorpe

RDMA/cma: Fix rdma_cm raw IB path setting for RoCE

rdma_set_ib_path() missed setting path record fields for RoCE
transport when RoCE support was added.

This results in setting incorrect ndev, destination mac address,
incorrect GID type etc errors when user space attempts to set a raw
IB path using the roce IB path compatibility mapping from userspace.

Fixes: 3c86aa70 ("RDMA/cm: Add RDMA CM support for IBoE devices")
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent fe75889f
...@@ -2521,6 +2521,7 @@ int rdma_set_ib_path(struct rdma_cm_id *id, ...@@ -2521,6 +2521,7 @@ int rdma_set_ib_path(struct rdma_cm_id *id,
struct sa_path_rec *path_rec) struct sa_path_rec *path_rec)
{ {
struct rdma_id_private *id_priv; struct rdma_id_private *id_priv;
struct net_device *ndev;
int ret; int ret;
id_priv = container_of(id, struct rdma_id_private, id); id_priv = container_of(id, struct rdma_id_private, id);
...@@ -2535,8 +2536,21 @@ int rdma_set_ib_path(struct rdma_cm_id *id, ...@@ -2535,8 +2536,21 @@ int rdma_set_ib_path(struct rdma_cm_id *id,
goto err; goto err;
} }
if (rdma_protocol_roce(id->device, id->port_num)) {
ndev = cma_iboe_set_path_rec_l2_fields(id_priv);
if (!ndev) {
ret = -ENODEV;
goto err_free;
}
dev_put(ndev);
}
id->route.num_paths = 1; id->route.num_paths = 1;
return 0; return 0;
err_free:
kfree(id->route.path_rec);
id->route.path_rec = NULL;
err: err:
cma_comp_exch(id_priv, RDMA_CM_ROUTE_RESOLVED, RDMA_CM_ADDR_RESOLVED); cma_comp_exch(id_priv, RDMA_CM_ROUTE_RESOLVED, RDMA_CM_ADDR_RESOLVED);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment