]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
RDMA/cma: Fix rdma_cm path querying for RoCE
authorParav Pandit <parav@mellanox.com>
Mon, 8 Jan 2018 15:04:48 +0000 (17:04 +0200)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Thu, 12 Apr 2018 13:06:39 +0000 (10:06 -0300)
BugLink: http://bugs.launchpad.net/bugs/1763366
[ Upstream commit 89838118a515847d3e5c904d2e022779a7173bec ]

The 'if' logic in ucma_query_path was broken with OPA was introduced
and started to treat RoCE paths as as OPA paths. Invert the logic
of the 'if' so only OPA paths are treated as OPA paths.

Otherwise the path records returned to rdma_cma users are mangled
when in RoCE mode.

Fixes: 57520751445b ("IB/SA: Add OPA path record type")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/infiniband/core/ucma.c

index 722235bed0759843c6704ab81169e8d2d38a922b..d6fa38f8604f27a74c4ed25086f4e800eaa90358 100644 (file)
@@ -914,13 +914,14 @@ static ssize_t ucma_query_path(struct ucma_context *ctx,
 
                resp->path_data[i].flags = IB_PATH_GMP | IB_PATH_PRIMARY |
                                           IB_PATH_BIDIRECTIONAL;
-               if (rec->rec_type == SA_PATH_REC_TYPE_IB) {
-                       ib_sa_pack_path(rec, &resp->path_data[i].path_rec);
-               } else {
+               if (rec->rec_type == SA_PATH_REC_TYPE_OPA) {
                        struct sa_path_rec ib;
 
                        sa_convert_path_opa_to_ib(&ib, rec);
                        ib_sa_pack_path(&ib, &resp->path_data[i].path_rec);
+
+               } else {
+                       ib_sa_pack_path(rec, &resp->path_data[i].path_rec);
                }
        }