linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-next] IB/mlx5: Add CREATE_PSV/DESTROY_PSV for devx interface
@ 2019-07-23  7:04 Leon Romanovsky
  2019-07-25 17:25 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Leon Romanovsky @ 2019-07-23  7:04 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Max Gurtovoy, RDMA mailing list, Leon Romanovsky

From: Max Gurtovoy <maxg@mellanox.com>

Limit the number of PSV's created through devx to 1, to create a symmetry
between create/destroy cmds. In the kernel, one can create up to 4 PSV's
using CREATE_PSV cmd but the destruction is one by one. Add a protection
for this a-symmetric definition for devx.

Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/hw/mlx5/devx.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
index ec4370f99381..a527cf7f01ac 100644
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -776,6 +776,14 @@ static bool devx_is_obj_create_cmd(const void *in, u16 *opcode)
 			return true;
 		return false;
 	}
+	case MLX5_CMD_OP_CREATE_PSV:
+	{
+		u8 num_psv = MLX5_GET(create_psv_in, in, num_psv);
+
+		if (num_psv == 1)
+			return true;
+		return false;
+	}
 	default:
 		return false;
 	}
@@ -1215,6 +1223,12 @@ static void devx_obj_build_destroy_cmd(void *in, void *out, void *din,
 	case MLX5_CMD_OP_ALLOC_XRCD:
 		MLX5_SET(general_obj_in_cmd_hdr, din, opcode, MLX5_CMD_OP_DEALLOC_XRCD);
 		break;
+	case MLX5_CMD_OP_CREATE_PSV:
+		MLX5_SET(general_obj_in_cmd_hdr, din, opcode,
+			 MLX5_CMD_OP_DESTROY_PSV);
+		MLX5_SET(destroy_psv_in, din, psvn,
+			 MLX5_GET(create_psv_out, out, psv0_index));
+		break;
 	default:
 		/* The entry must match to one of the devx_is_obj_create_cmd */
 		WARN_ON(true);
--
2.20.1


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

* Re: [PATCH rdma-next] IB/mlx5: Add CREATE_PSV/DESTROY_PSV for devx interface
  2019-07-23  7:04 [PATCH rdma-next] IB/mlx5: Add CREATE_PSV/DESTROY_PSV for devx interface Leon Romanovsky
@ 2019-07-25 17:25 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2019-07-25 17:25 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, Max Gurtovoy, RDMA mailing list, Leon Romanovsky

On Tue, Jul 23, 2019 at 10:04:12AM +0300, Leon Romanovsky wrote:
> From: Max Gurtovoy <maxg@mellanox.com>
> 
> Limit the number of PSV's created through devx to 1, to create a symmetry
> between create/destroy cmds. In the kernel, one can create up to 4 PSV's
> using CREATE_PSV cmd but the destruction is one by one. Add a protection
> for this a-symmetric definition for devx.
> 
> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx5/devx.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
 
Applied to for-next, thanks

Jason

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

end of thread, other threads:[~2019-07-25 17:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-23  7:04 [PATCH rdma-next] IB/mlx5: Add CREATE_PSV/DESTROY_PSV for devx interface Leon Romanovsky
2019-07-25 17:25 ` 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).