linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-next 0/3] RDMA: modify_device improvements
@ 2019-09-23 10:41 Kamal Heib
  2019-09-23 10:41 ` [PATCH for-next 1/3] RDMA/core: Fix return code when modify_device isn't supported Kamal Heib
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kamal Heib @ 2019-09-23 10:41 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Selvin Xavier, Moni Shoua, Kamal Heib

This series includes three patches which fix the return values from
modify_device() callbacks when they aren't supported.

Kamal Heib (3):
  RDMA/core: Fix return code when modify_device isn't supported
  RDMA/bnxt_re: Remove unsupported modify_device callback
  RDMA/rxe: Verify modify_device mask

 drivers/infiniband/core/device.c         |  2 +-
 drivers/infiniband/core/sysfs.c          |  2 +-
 drivers/infiniband/hw/bnxt_re/ib_verbs.c | 18 ------------------
 drivers/infiniband/hw/bnxt_re/ib_verbs.h |  3 ---
 drivers/infiniband/hw/bnxt_re/main.c     |  1 -
 drivers/infiniband/sw/rxe/rxe_verbs.c    |  4 ++++
 6 files changed, 6 insertions(+), 24 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH for-next 1/3] RDMA/core: Fix return code when modify_device isn't supported
  2019-09-23 10:41 [PATCH for-next 0/3] RDMA: modify_device improvements Kamal Heib
@ 2019-09-23 10:41 ` Kamal Heib
  2019-09-23 10:41 ` [PATCH for-next 2/3] RDMA/bnxt_re: Remove unsupported modify_device callback Kamal Heib
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kamal Heib @ 2019-09-23 10:41 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Selvin Xavier, Moni Shoua, Kamal Heib

The proper return code is "-EOPNOTSUPP" when modify_device callback is
not supported.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/core/device.c | 2 +-
 drivers/infiniband/core/sysfs.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 99c4a55545cf..a667636f74bf 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2365,7 +2365,7 @@ int ib_modify_device(struct ib_device *device,
 		     struct ib_device_modify *device_modify)
 {
 	if (!device->ops.modify_device)
-		return -ENOSYS;
+		return -EOPNOTSUPP;
 
 	return device->ops.modify_device(device, device_modify_mask,
 					 device_modify);
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 7a50cedcef1f..92c932c067cb 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -1268,7 +1268,7 @@ static ssize_t node_desc_store(struct device *device,
 	int ret;
 
 	if (!dev->ops.modify_device)
-		return -EIO;
+		return -EOPNOTSUPP;
 
 	memcpy(desc.node_desc, buf, min_t(int, count, IB_DEVICE_NODE_DESC_MAX));
 	ret = ib_modify_device(dev, IB_DEVICE_MODIFY_NODE_DESC, &desc);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH for-next 2/3] RDMA/bnxt_re: Remove unsupported modify_device callback
  2019-09-23 10:41 [PATCH for-next 0/3] RDMA: modify_device improvements Kamal Heib
  2019-09-23 10:41 ` [PATCH for-next 1/3] RDMA/core: Fix return code when modify_device isn't supported Kamal Heib
@ 2019-09-23 10:41 ` Kamal Heib
  2019-09-23 10:41 ` [PATCH for-next 3/3] RDMA/rxe: Verify modify_device mask Kamal Heib
  2019-10-01 16:10 ` [PATCH for-next 0/3] RDMA: modify_device improvements Jason Gunthorpe
  3 siblings, 0 replies; 5+ messages in thread
From: Kamal Heib @ 2019-09-23 10:41 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Selvin Xavier, Moni Shoua, Kamal Heib

There is no need to return always zero for function which is not supported.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/bnxt_re/ib_verbs.c | 18 ------------------
 drivers/infiniband/hw/bnxt_re/ib_verbs.h |  3 ---
 drivers/infiniband/hw/bnxt_re/main.c     |  1 -
 3 files changed, 22 deletions(-)

diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index b4149dc9e824..8afd7d93cfe4 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -191,24 +191,6 @@ int bnxt_re_query_device(struct ib_device *ibdev,
 	return 0;
 }
 
-int bnxt_re_modify_device(struct ib_device *ibdev,
-			  int device_modify_mask,
-			  struct ib_device_modify *device_modify)
-{
-	switch (device_modify_mask) {
-	case IB_DEVICE_MODIFY_SYS_IMAGE_GUID:
-		/* Modify the GUID requires the modification of the GID table */
-		/* GUID should be made as READ-ONLY */
-		break;
-	case IB_DEVICE_MODIFY_NODE_DESC:
-		/* Node Desc should be made as READ-ONLY */
-		break;
-	default:
-		break;
-	}
-	return 0;
-}
-
 /* Port */
 int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num,
 		       struct ib_port_attr *port_attr)
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.h b/drivers/infiniband/hw/bnxt_re/ib_verbs.h
index 31662b1ee35a..23d972da5652 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.h
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.h
@@ -145,9 +145,6 @@ struct bnxt_re_ucontext {
 int bnxt_re_query_device(struct ib_device *ibdev,
 			 struct ib_device_attr *ib_attr,
 			 struct ib_udata *udata);
-int bnxt_re_modify_device(struct ib_device *ibdev,
-			  int device_modify_mask,
-			  struct ib_device_modify *device_modify);
 int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num,
 		       struct ib_port_attr *port_attr);
 int bnxt_re_get_port_immutable(struct ib_device *ibdev, u8 port_num,
diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index 30a54f8aa42c..7b914bdd7c13 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -625,7 +625,6 @@ static const struct ib_device_ops bnxt_re_dev_ops = {
 	.map_mr_sg = bnxt_re_map_mr_sg,
 	.mmap = bnxt_re_mmap,
 	.modify_ah = bnxt_re_modify_ah,
-	.modify_device = bnxt_re_modify_device,
 	.modify_qp = bnxt_re_modify_qp,
 	.modify_srq = bnxt_re_modify_srq,
 	.poll_cq = bnxt_re_poll_cq,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH for-next 3/3] RDMA/rxe: Verify modify_device mask
  2019-09-23 10:41 [PATCH for-next 0/3] RDMA: modify_device improvements Kamal Heib
  2019-09-23 10:41 ` [PATCH for-next 1/3] RDMA/core: Fix return code when modify_device isn't supported Kamal Heib
  2019-09-23 10:41 ` [PATCH for-next 2/3] RDMA/bnxt_re: Remove unsupported modify_device callback Kamal Heib
@ 2019-09-23 10:41 ` Kamal Heib
  2019-10-01 16:10 ` [PATCH for-next 0/3] RDMA: modify_device improvements Jason Gunthorpe
  3 siblings, 0 replies; 5+ messages in thread
From: Kamal Heib @ 2019-09-23 10:41 UTC (permalink / raw)
  To: linux-rdma
  Cc: Doug Ledford, Jason Gunthorpe, Selvin Xavier, Moni Shoua, Kamal Heib

Verify that the passed mask to rxe_modify_device() is supported.

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe_verbs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 623129f27f5a..fa47bdcc7f54 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -106,6 +106,10 @@ static int rxe_modify_device(struct ib_device *dev,
 {
 	struct rxe_dev *rxe = to_rdev(dev);
 
+	if (mask & ~(IB_DEVICE_MODIFY_SYS_IMAGE_GUID |
+		     IB_DEVICE_MODIFY_NODE_DESC))
+		return -EOPNOTSUPP;
+
 	if (mask & IB_DEVICE_MODIFY_SYS_IMAGE_GUID)
 		rxe->attr.sys_image_guid = cpu_to_be64(attr->sys_image_guid);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH for-next 0/3] RDMA: modify_device improvements
  2019-09-23 10:41 [PATCH for-next 0/3] RDMA: modify_device improvements Kamal Heib
                   ` (2 preceding siblings ...)
  2019-09-23 10:41 ` [PATCH for-next 3/3] RDMA/rxe: Verify modify_device mask Kamal Heib
@ 2019-10-01 16:10 ` Jason Gunthorpe
  3 siblings, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2019-10-01 16:10 UTC (permalink / raw)
  To: Kamal Heib; +Cc: linux-rdma, Doug Ledford, Selvin Xavier, Moni Shoua

On Mon, Sep 23, 2019 at 01:41:55PM +0300, Kamal Heib wrote:
> This series includes three patches which fix the return values from
> modify_device() callbacks when they aren't supported.
> 
> Kamal Heib (3):
>   RDMA/core: Fix return code when modify_device isn't supported
>   RDMA/bnxt_re: Remove unsupported modify_device callback
>   RDMA/rxe: Verify modify_device mask

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-01 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23 10:41 [PATCH for-next 0/3] RDMA: modify_device improvements Kamal Heib
2019-09-23 10:41 ` [PATCH for-next 1/3] RDMA/core: Fix return code when modify_device isn't supported Kamal Heib
2019-09-23 10:41 ` [PATCH for-next 2/3] RDMA/bnxt_re: Remove unsupported modify_device callback Kamal Heib
2019-09-23 10:41 ` [PATCH for-next 3/3] RDMA/rxe: Verify modify_device mask Kamal Heib
2019-10-01 16:10 ` [PATCH for-next 0/3] RDMA: modify_device improvements Jason Gunthorpe

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).