linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kamal Heib <kamalheib1@gmail.com>
To: linux-rdma@vger.kernel.org
Cc: Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Lijun Ou <oulijun@huawei.com>,
	Selvin Xavier <selvin.xavier@broadcom.com>,
	Michal Kalderon <mkalderon@marvell.com>,
	Kamal Heib <kamalheib1@gmail.com>
Subject: [for-next v4 1/4] RDMA/core: Fix return code when modify_port isn't supported
Date: Mon, 28 Oct 2019 17:59:28 +0200	[thread overview]
Message-ID: <20191028155931.1114-2-kamalheib1@gmail.com> (raw)
In-Reply-To: <20191028155931.1114-1-kamalheib1@gmail.com>

Improving return code from ib_modify_port() by doing the following:
1- Use "-EOPNOTSUPP" instead "-ENOSYS" which is the proper return code.
2- Allow only IB_PORT_CM_SUP fake 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")
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/core/device.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index eb35b663a742..ee5fe20bd8b0 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2395,8 +2395,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);
-- 
2.20.1


  reply	other threads:[~2019-10-28 16:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28 15:59 [for-next v4 0/4] RDMA: modify_port improvements Kamal Heib
2019-10-28 15:59 ` Kamal Heib [this message]
2019-10-28 15:59 ` [for-next v4 2/4] RDMA/hns: Remove unsupported modify_port callback Kamal Heib
2019-10-28 15:59 ` [for-next v4 3/4] RDMA/ocrdma: " Kamal Heib
2019-10-28 15:59 ` [for-next v4 4/4] RDMA/qedr: " Kamal Heib
2019-11-06 17:35 ` [for-next v4 0/4] RDMA: modify_port improvements Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191028155931.1114-2-kamalheib1@gmail.com \
    --to=kamalheib1@gmail.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mkalderon@marvell.com \
    --cc=oulijun@huawei.com \
    --cc=selvin.xavier@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).