]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
RDMA/core: Fix return code when modify_port isn't supported
authorKamal Heib <kamalheib1@gmail.com>
Mon, 28 Oct 2019 15:59:28 +0000 (17:59 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 05:04:26 +0000 (00:04 -0500)
BugLink: https://bugs.launchpad.net/bugs/1860490
[ Upstream commit 55bfe905fa97633438c13fb029aed85371d85480 ]

Improve return code from ib_modify_port() by doing the following:
 - Use "-EOPNOTSUPP" instead "-ENOSYS" which is the proper return code

 - Allow only fake IB_PORT_CM_SUP manipulation for RoCE providers that
   didn't implement the modify_port callback, otherwise return
   "-EOPNOTSUPP"

Fixes: 61e0962d5221 ("IB: Avoid ib_modify_port() failure for RoCE devices")
Link: https://lore.kernel.org/r/20191028155931.1114-2-kamalheib1@gmail.com
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/infiniband/core/device.c

index e5a55fc7aa9f75673fba03057d87c1d6a888b9d1..42a30dfbcd1a8c2f8b1c50ccbd68bd4f795c5203 100644 (file)
@@ -2354,8 +2354,12 @@ int ib_modify_port(struct ib_device *device,
                rc = device->ops.modify_port(device, port_num,
                                             port_modify_mask,
                                             port_modify);
+       else if (rdma_protocol_roce(device, port_num) &&
+                ((port_modify->set_port_cap_mask & ~IB_PORT_CM_SUP) == 0 ||
+                 (port_modify->clr_port_cap_mask & ~IB_PORT_CM_SUP) == 0))
+               rc = 0;
        else
-               rc = rdma_protocol_roce(device, port_num) ? 0 : -ENOSYS;
+               rc = -EOPNOTSUPP;
        return rc;
 }
 EXPORT_SYMBOL(ib_modify_port);