Skip to content

Commit

Permalink
librdmacm: Don't rely on IB device index if not available
Browse files Browse the repository at this point in the history
[ Upstream commit c755e22 ]

When rdma-core is built with "-DENABLE_RESOLVE_NEIGH=0", it skips
linkage to libnl library. This causes to ibv_idx to stay in its default
value (-1).
Update the match function to treat such scenario to be the same as
not-supported by the kernel flow.

Fixes: 28da4a8 ("librdmacm: Rely on IB device index if available")
Signed-off-by: Mark Zhang <markzhang@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
  • Loading branch information
MarkZhang81 authored and nmorey committed Apr 5, 2022
1 parent b6b7564 commit befe583
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion librdmacm/cma.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ int ucma_init(void)

static bool match(struct cma_device *cma_dev, __be64 guid, uint32_t idx)
{
if (idx == UCMA_INVALID_IB_INDEX)
if ((idx == UCMA_INVALID_IB_INDEX) ||
(cma_dev->ibv_idx == UCMA_INVALID_IB_INDEX))
return cma_dev->guid == guid;

return cma_dev->ibv_idx == idx && cma_dev->guid == guid;
Expand Down

0 comments on commit befe583

Please sign in to comment.