From: Kamal Heib Date: Mon, 28 Oct 2019 15:59:28 +0000 (+0200) Subject: RDMA/core: Fix return code when modify_port isn't supported X-Git-Tag: v5.4.7~196 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7613870e2501e618770fd602a46d9fae317236e1;p=thirdparty%2Fkernel%2Fstable.git RDMA/core: Fix return code when modify_port isn't supported [ 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 Reviewed-by: Jason Gunthorpe Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index e6327d8f5b79a..2b5bd7206fc6e 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2409,8 +2409,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);