diff mbox series

[14/20] RDMA/mlx5: Move signature_en attribute from mlx5_qp to ib_qp

Message ID 1559222731-16715-15-git-send-email-maxg@mellanox.com (mailing list archive)
State Superseded
Headers show
Series Introduce new API for T10-PI offload | expand

Commit Message

Max Gurtovoy May 30, 2019, 1:25 p.m. UTC
This is a preparation for adding new signature API to the rw-API.

Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Israel Rukshin <israelr@mellanox.com>
---
 drivers/infiniband/core/verbs.c      | 2 ++
 drivers/infiniband/hw/mlx5/mlx5_ib.h | 3 ---
 drivers/infiniband/hw/mlx5/qp.c      | 7 ++-----
 include/rdma/ib_verbs.h              | 1 +
 4 files changed, 5 insertions(+), 8 deletions(-)

Comments

Christoph Hellwig June 4, 2019, 7:46 a.m. UTC | #1
On Thu, May 30, 2019 at 04:25:25PM +0300, Max Gurtovoy wrote:
> This is a preparation for adding new signature API to the rw-API.
> 
> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
> Signed-off-by: Israel Rukshin <israelr@mellanox.com>

Wouldn't it be better to have a qp_flags field with a bit set, as that
is more extensible?

> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index fc55482f51d6..936498c3f9cb 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -1233,6 +1233,8 @@ struct ib_qp *ib_create_qp_user(struct ib_pd *pd,
>  	qp->max_write_sge = qp_init_attr->cap.max_send_sge;
>  	qp->max_read_sge = min_t(u32, qp_init_attr->cap.max_send_sge,
>  				 device->attrs.max_sge_rd);
> +	if (qp_init_attr->create_flags & IB_QP_CREATE_SIGNATURE_EN)
> +		qp->signature_en = true;

Don't we need a check if IB_QP_CREATE_SIGNATURE_EN is supported at all?
Sagi Grimberg June 5, 2019, 7:37 p.m. UTC | #2
> This is a preparation for adding new signature API to the rw-API.

I think it would be good to write how this is preparing for this?
Max Gurtovoy June 5, 2019, 10:02 p.m. UTC | #3
On 6/5/2019 10:37 PM, Sagi Grimberg wrote:
>> This is a preparation for adding new signature API to the rw-API.
>
> I think it would be good to write how this is preparing for this?

We'll squash patches 14+15 as Christoph suggested and add more 
information to the commit message.
diff mbox series

Patch

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index fc55482f51d6..936498c3f9cb 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1233,6 +1233,8 @@  struct ib_qp *ib_create_qp_user(struct ib_pd *pd,
 	qp->max_write_sge = qp_init_attr->cap.max_send_sge;
 	qp->max_read_sge = min_t(u32, qp_init_attr->cap.max_send_sge,
 				 device->attrs.max_sge_rd);
+	if (qp_init_attr->create_flags & IB_QP_CREATE_SIGNATURE_EN)
+		qp->signature_en = true;
 
 	return qp;
 
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 07bac37c3450..06de3507e3d6 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -431,9 +431,6 @@  struct mlx5_ib_qp {
 
 	int			create_type;
 
-	/* Store signature errors */
-	bool			signature_en;
-
 	struct list_head	qps_list;
 	struct list_head	cq_recv_list;
 	struct list_head	cq_send_list;
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 7c9fd335d43d..aa0c39acc4e3 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -496,9 +496,6 @@  static int calc_sq_size(struct mlx5_ib_dev *dev, struct ib_qp_init_attr *attr,
 			      sizeof(struct mlx5_wqe_inline_seg);
 	attr->cap.max_inline_data = qp->max_inline_data;
 
-	if (attr->create_flags & IB_QP_CREATE_SIGNATURE_EN)
-		qp->signature_en = true;
-
 	wq_size = roundup_pow_of_two(attr->cap.max_send_wr * wqe_size);
 	qp->sq.wqe_cnt = wq_size / MLX5_SEND_WQE_BB;
 	if (qp->sq.wqe_cnt > (1 << MLX5_CAP_GEN(dev->mdev, log_max_qp_sz))) {
@@ -4717,7 +4714,7 @@  static int set_pi_umr_wr(const struct ib_send_wr *send_wr,
 
 	if (unlikely(send_wr->num_sge != 0) ||
 	    unlikely(wr->access & IB_ACCESS_REMOTE_ATOMIC) ||
-	    unlikely(!sig_mr->sig) || unlikely(!qp->signature_en) ||
+	    unlikely(!sig_mr->sig) || unlikely(!qp->ibqp.signature_en) ||
 	    unlikely(!sig_mr->sig->sig_status_checked))
 		return -EINVAL;
 
@@ -4766,7 +4763,7 @@  static int set_sig_umr_wr(const struct ib_send_wr *send_wr,
 
 	if (unlikely(wr->wr.num_sge != 1) ||
 	    unlikely(wr->access_flags & IB_ACCESS_REMOTE_ATOMIC) ||
-	    unlikely(!sig_mr->sig) || unlikely(!qp->signature_en) ||
+	    unlikely(!sig_mr->sig) || unlikely(!qp->ibqp.signature_en) ||
 	    unlikely(!sig_mr->sig->sig_status_checked))
 		return -EINVAL;
 
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 94773f896012..a0e6d721143c 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1722,6 +1722,7 @@  struct ib_qp {
 	struct ib_qp_security  *qp_sec;
 	u8			port;
 
+	bool			signature_en;
 	/*
 	 * Implementation details of the RDMA core, don't use in drivers:
 	 */