netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>,
	Yishai Hadas <yishaih@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>,
	linux-netdev <netdev@vger.kernel.org>
Subject: [PATCH rdma-next 21/25] IB/mlx5: Set valid umem bit on DEVX
Date: Mon, 17 Sep 2018 14:04:14 +0300	[thread overview]
Message-ID: <20180917110418.18937-22-leon@kernel.org> (raw)
In-Reply-To: <20180917110418.18937-1-leon@kernel.org>

From: Yishai Hadas <yishaih@mellanox.com>

Set valid umem bit on DEVX commands that use umem.
This will enforce the umem usage by the firmware and not the 'pas' info.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/hw/mlx5/devx.c | 95 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)

diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
index 25dafa4ff6ca..562c7936bbad 100644
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -264,6 +264,97 @@ static int devx_is_valid_obj_id(struct devx_obj *obj, const void *in)
 	return false;
 }
 
+static void devx_set_umem_valid(const void *in)
+{
+	u16 opcode = MLX5_GET(general_obj_in_cmd_hdr, in, opcode);
+
+	switch (opcode) {
+	case MLX5_CMD_OP_CREATE_MKEY:
+		MLX5_SET(create_mkey_in, in, mkey_umem_valid, 1);
+		break;
+	case MLX5_CMD_OP_CREATE_CQ:
+	{
+		void *cqc;
+
+		MLX5_SET(create_cq_in, in, cq_umem_valid, 1);
+		cqc = MLX5_ADDR_OF(create_cq_in, in, cq_context);
+		MLX5_SET(cqc, cqc, dbr_umem_valid, 1);
+		break;
+	}
+	case MLX5_CMD_OP_CREATE_QP:
+	{
+		void *qpc;
+
+		qpc = MLX5_ADDR_OF(create_qp_in, in, qpc);
+		MLX5_SET(qpc, qpc, dbr_umem_valid, 1);
+		MLX5_SET(create_qp_in, in, wq_umem_valid, 1);
+		break;
+	}
+
+	case MLX5_CMD_OP_CREATE_RQ:
+	{
+		void *rqc, *wq;
+
+		rqc = MLX5_ADDR_OF(create_rq_in, in, ctx);
+		wq  = MLX5_ADDR_OF(rqc, rqc, wq);
+		MLX5_SET(wq, wq, dbr_umem_valid, 1);
+		MLX5_SET(wq, wq, wq_umem_valid, 1);
+		break;
+	}
+
+	case MLX5_CMD_OP_CREATE_SQ:
+	{
+		void *sqc, *wq;
+
+		sqc = MLX5_ADDR_OF(create_sq_in, in, ctx);
+		wq = MLX5_ADDR_OF(sqc, sqc, wq);
+		MLX5_SET(wq, wq, dbr_umem_valid, 1);
+		MLX5_SET(wq, wq, wq_umem_valid, 1);
+		break;
+	}
+
+	case MLX5_CMD_OP_MODIFY_CQ:
+		MLX5_SET(modify_cq_in, in, cq_umem_valid, 1);
+		break;
+
+	case MLX5_CMD_OP_CREATE_RMP:
+	{
+		void *rmpc, *wq;
+
+		rmpc = MLX5_ADDR_OF(create_rmp_in, in, ctx);
+		wq = MLX5_ADDR_OF(rmpc, rmpc, wq);
+		MLX5_SET(wq, wq, dbr_umem_valid, 1);
+		MLX5_SET(wq, wq, wq_umem_valid, 1);
+		break;
+	}
+
+	case MLX5_CMD_OP_CREATE_XRQ:
+	{
+		void *xrqc, *wq;
+
+		xrqc = MLX5_ADDR_OF(create_xrq_in, in, xrq_context);
+		wq = MLX5_ADDR_OF(xrqc, xrqc, wq);
+		MLX5_SET(wq, wq, dbr_umem_valid, 1);
+		MLX5_SET(wq, wq, wq_umem_valid, 1);
+		break;
+	}
+
+	case MLX5_CMD_OP_CREATE_XRC_SRQ:
+	{
+		void *xrc_srqc;
+
+		MLX5_SET(create_xrc_srq_in, in, xrc_srq_umem_valid, 1);
+		xrc_srqc = MLX5_ADDR_OF(create_xrc_srq_in, in,
+					xrc_srq_context_entry);
+		MLX5_SET(xrc_srqc, xrc_srqc, dbr_umem_valid, 1);
+		break;
+	}
+
+	default:
+		return;
+	}
+}
+
 static bool devx_is_obj_create_cmd(const void *in)
 {
 	u16 opcode = MLX5_GET(general_obj_in_cmd_hdr, in, opcode);
@@ -741,6 +832,8 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
 		return -ENOMEM;
 
 	MLX5_SET(general_obj_in_cmd_hdr, cmd_in, uid, c->devx_uid);
+	devx_set_umem_valid(cmd_in);
+
 	err = mlx5_cmd_exec(dev->mdev, cmd_in,
 			    uverbs_attr_get_len(attrs, MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_IN),
 			    cmd_out, cmd_out_len);
@@ -790,6 +883,8 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_MODIFY)(
 		return PTR_ERR(cmd_out);
 
 	MLX5_SET(general_obj_in_cmd_hdr, cmd_in, uid, c->devx_uid);
+	devx_set_umem_valid(cmd_in);
+
 	err = mlx5_cmd_exec(obj->mdev, cmd_in,
 			    uverbs_attr_get_len(attrs, MLX5_IB_ATTR_DEVX_OBJ_MODIFY_CMD_IN),
 			    cmd_out, cmd_out_len);
-- 
2.14.4

  parent reply	other threads:[~2018-09-17 16:32 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17 11:03 [PATCH rdma-next 00/24] Extend DEVX functionality Leon Romanovsky
2018-09-17 11:03 ` [PATCH mlx5-next 01/25] net/mlx5: Set uid as part of CQ commands Leon Romanovsky
2018-09-17 11:03 ` [PATCH mlx5-next 02/25] net/mlx5: Set uid as part of QP commands Leon Romanovsky
2018-09-19 17:27   ` Jason Gunthorpe
2018-09-20  4:51     ` Leon Romanovsky
2018-09-17 11:03 ` [PATCH mlx5-next 03/25] net/mlx5: Set uid as part of RQ commands Leon Romanovsky
2018-09-19 17:28   ` Jason Gunthorpe
2018-09-19 18:40     ` Saeed Mahameed
2018-09-19 21:10       ` Jason Gunthorpe
2018-09-17 11:03 ` [PATCH mlx5-next 04/25] net/mlx5: Set uid as part of SQ commands Leon Romanovsky
2018-09-17 11:03 ` [PATCH mlx5-next 05/25] net/mlx5: Set uid as part of SRQ commands Leon Romanovsky
2018-09-17 11:03 ` [PATCH mlx5-next 06/25] net/mlx5: Set uid as part of DCT commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH mlx5-next 07/25] net/mlx5: Update mlx5_ifc with DEVX UID bits Leon Romanovsky
2018-09-19 17:31   ` Jason Gunthorpe
2018-09-20  4:51     ` Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 08/25] IB/mlx5: Set uid as part of CQ creation Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 09/25] IB/mlx5: Set uid as part of QP creation Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 10/25] IB/mlx5: Set uid as part of RQ commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 11/25] IB/mlx5: Set uid as part of SQ commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 12/25] IB/mlx5: Set uid as part of TIR commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 13/25] IB/mlx5: Set uid as part of TIS commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 14/25] IB/mlx5: Set uid as part of RQT commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 15/25] IB/mlx5: Set uid as part of PD commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 16/25] IB/mlx5: Set uid as part of TD commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 17/25] IB/mlx5: Set uid as part of SRQ commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 18/25] IB/mlx5: Set uid as part of DCT commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 19/25] IB/mlx5: Set uid as part of XRCD commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 20/25] IB/mlx5: Set uid as part of MCG commands Leon Romanovsky
2018-09-17 11:04 ` Leon Romanovsky [this message]
2018-09-17 11:04 ` [PATCH rdma-next 22/25] IB/mlx5: Expose RAW QP device handles to user space Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 23/25] IB/mlx5: Manage device uid for DEVX white list commands Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 24/25] IB/mlx5: Enable " Leon Romanovsky
2018-09-17 11:04 ` [PATCH rdma-next 25/25] IB/mlx5: Enable DEVX on IB Leon Romanovsky
2018-09-17 19:34 ` [PATCH rdma-next 00/24] Extend DEVX functionality Leon Romanovsky
2018-09-17 19:51   ` Or Gerlitz
2018-09-17 20:07     ` Leon Romanovsky
2018-09-17 20:13       ` Or Gerlitz
2018-09-17 20:20         ` Leon Romanovsky
2018-09-19 18:17 ` Jason Gunthorpe
2018-09-20  5:01   ` Leon Romanovsky

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=20180917110418.18937-22-leon@kernel.org \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@mellanox.com \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    --cc=yishaih@mellanox.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).