All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] RDMA/rxe: Do some cleanup
@ 2021-09-30  9:48 Xiao Yang
  2021-09-30  9:48 ` [PATCH v4 1/4] RDMA/rxe: Remove the is_user members of struct rxe_sq/rxe_rq/rxe_srq Xiao Yang
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Xiao Yang @ 2021-09-30  9:48 UTC (permalink / raw)
  To: linux-rdma, jgg; +Cc: rpearsonhpe, zyjzyj2000, leon, Xiao Yang

V3->V4:
1) Rebase on the latest for-next branch.
2) Remove [PATCH v3 1/5].
3) Update [PATCH v3 2/5] to remove the is_user members of
   struct rxe_sq/rxe_rq/rxe_srq.

Xiao Yang (4):
  RDMA/rxe: Remove the is_user members of struct rxe_sq/rxe_rq/rxe_srq
  RDMA/rxe: Change the is_user member of struct rxe_cq to bool
  RDMA/rxe: Set partial attributes when completion status !=
    IBV_WC_SUCCESS
  RDMA/rxe: Remove duplicate settings

 drivers/infiniband/sw/rxe/rxe_comp.c  | 45 +++++++++++++++------------
 drivers/infiniband/sw/rxe/rxe_cq.c    |  3 +-
 drivers/infiniband/sw/rxe/rxe_qp.c    |  2 --
 drivers/infiniband/sw/rxe/rxe_resp.c  |  4 ---
 drivers/infiniband/sw/rxe/rxe_srq.c   |  1 -
 drivers/infiniband/sw/rxe/rxe_verbs.c |  3 --
 drivers/infiniband/sw/rxe/rxe_verbs.h |  5 +--
 7 files changed, 27 insertions(+), 36 deletions(-)

-- 
2.25.1




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

* [PATCH v4 1/4] RDMA/rxe: Remove the is_user members of struct rxe_sq/rxe_rq/rxe_srq
  2021-09-30  9:48 [PATCH v4 0/4] RDMA/rxe: Do some cleanup Xiao Yang
@ 2021-09-30  9:48 ` Xiao Yang
  2021-09-30  9:48 ` [PATCH v4 2/4] RDMA/rxe: Change the is_user member of struct rxe_cq to bool Xiao Yang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Xiao Yang @ 2021-09-30  9:48 UTC (permalink / raw)
  To: linux-rdma, jgg; +Cc: rpearsonhpe, zyjzyj2000, leon, Xiao Yang

The is_user members of struct rxe_sq/rxe_rq/rxe_srq are unsed since
commit ae6e843fe08d ("RDMA/rxe: Add memory barriers to kernel queues").
In this case, it is fine to remove them directly.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
 drivers/infiniband/sw/rxe/rxe_qp.c    | 2 --
 drivers/infiniband/sw/rxe/rxe_srq.c   | 1 -
 drivers/infiniband/sw/rxe/rxe_verbs.c | 3 ---
 drivers/infiniband/sw/rxe/rxe_verbs.h | 3 ---
 4 files changed, 9 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
index c8f4790083d2..975321812c87 100644
--- a/drivers/infiniband/sw/rxe/rxe_qp.c
+++ b/drivers/infiniband/sw/rxe/rxe_qp.c
@@ -307,8 +307,6 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp,
 	spin_lock_init(&qp->rq.producer_lock);
 	spin_lock_init(&qp->rq.consumer_lock);
 
-	qp->rq.is_user = qp->is_user;
-
 	skb_queue_head_init(&qp->resp_pkts);
 
 	rxe_init_task(rxe, &qp->resp.task, qp,
diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c b/drivers/infiniband/sw/rxe/rxe_srq.c
index a9e7817e2732..eb1c4c3b3a78 100644
--- a/drivers/infiniband/sw/rxe/rxe_srq.c
+++ b/drivers/infiniband/sw/rxe/rxe_srq.c
@@ -86,7 +86,6 @@ int rxe_srq_from_init(struct rxe_dev *rxe, struct rxe_srq *srq,
 	srq->srq_num		= srq->pelem.index;
 	srq->rq.max_wr		= init->attr.max_wr;
 	srq->rq.max_sge		= init->attr.max_sge;
-	srq->rq.is_user		= srq->is_user;
 
 	srq_wqe_size		= rcv_wqe_size(srq->rq.max_sge);
 
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 9d0bb9aa7514..c49ba0381964 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -267,9 +267,6 @@ static int rxe_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init,
 		if (udata->outlen < sizeof(*uresp))
 			return -EINVAL;
 		uresp = udata->outbuf;
-		srq->is_user = true;
-	} else {
-		srq->is_user = false;
 	}
 
 	err = rxe_srq_chk_attr(rxe, NULL, &init->attr, IB_SRQ_INIT_MASK);
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h
index c807639435eb..962bb2481a28 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.h
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.h
@@ -77,7 +77,6 @@ enum wqe_state {
 };
 
 struct rxe_sq {
-	bool			is_user;
 	int			max_wr;
 	int			max_sge;
 	int			max_inline;
@@ -86,7 +85,6 @@ struct rxe_sq {
 };
 
 struct rxe_rq {
-	bool			is_user;
 	int			max_wr;
 	int			max_sge;
 	spinlock_t		producer_lock; /* guard queue producer */
@@ -100,7 +98,6 @@ struct rxe_srq {
 	struct rxe_pd		*pd;
 	struct rxe_rq		rq;
 	u32			srq_num;
-	bool			is_user;
 
 	int			limit;
 	int			error;
-- 
2.25.1




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

* [PATCH v4 2/4] RDMA/rxe: Change the is_user member of struct rxe_cq to bool
  2021-09-30  9:48 [PATCH v4 0/4] RDMA/rxe: Do some cleanup Xiao Yang
  2021-09-30  9:48 ` [PATCH v4 1/4] RDMA/rxe: Remove the is_user members of struct rxe_sq/rxe_rq/rxe_srq Xiao Yang
@ 2021-09-30  9:48 ` Xiao Yang
  2021-09-30  9:48 ` [PATCH v4 3/4] RDMA/rxe: Set partial attributes when completion status != IBV_WC_SUCCESS Xiao Yang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Xiao Yang @ 2021-09-30  9:48 UTC (permalink / raw)
  To: linux-rdma, jgg; +Cc: rpearsonhpe, zyjzyj2000, leon, Xiao Yang

Make the is_user members of struct rxe_qp/rxe_cq has the same type.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
 drivers/infiniband/sw/rxe/rxe_cq.c    | 3 +--
 drivers/infiniband/sw/rxe/rxe_verbs.h | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c
index 4eedaa0244b3..6848426c074f 100644
--- a/drivers/infiniband/sw/rxe/rxe_cq.c
+++ b/drivers/infiniband/sw/rxe/rxe_cq.c
@@ -77,8 +77,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe,
 		return err;
 	}
 
-	if (uresp)
-		cq->is_user = 1;
+	cq->is_user = uresp;
 
 	cq->is_dying = false;
 
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h
index 962bb2481a28..098fde693dbd 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.h
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.h
@@ -64,7 +64,7 @@ struct rxe_cq {
 	spinlock_t		cq_lock;
 	u8			notify;
 	bool			is_dying;
-	int			is_user;
+	bool			is_user;
 	struct tasklet_struct	comp_task;
 };
 
-- 
2.25.1




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

* [PATCH v4 3/4] RDMA/rxe: Set partial attributes when completion status != IBV_WC_SUCCESS
  2021-09-30  9:48 [PATCH v4 0/4] RDMA/rxe: Do some cleanup Xiao Yang
  2021-09-30  9:48 ` [PATCH v4 1/4] RDMA/rxe: Remove the is_user members of struct rxe_sq/rxe_rq/rxe_srq Xiao Yang
  2021-09-30  9:48 ` [PATCH v4 2/4] RDMA/rxe: Change the is_user member of struct rxe_cq to bool Xiao Yang
@ 2021-09-30  9:48 ` Xiao Yang
  2021-09-30  9:48 ` [PATCH v4 4/4] RDMA/rxe: Remove duplicate settings Xiao Yang
  2021-10-06 22:46 ` [PATCH v4 0/4] RDMA/rxe: Do some cleanup Jason Gunthorpe
  4 siblings, 0 replies; 6+ messages in thread
From: Xiao Yang @ 2021-09-30  9:48 UTC (permalink / raw)
  To: linux-rdma, jgg; +Cc: rpearsonhpe, zyjzyj2000, leon, Xiao Yang

As ibv_poll_cq()'s manual said, only partial attributes are valid
when completion status != IBV_WC_SUCCESS.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
 drivers/infiniband/sw/rxe/rxe_comp.c | 45 +++++++++++++++-------------
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c
index 48a3864ada29..d771ba8449a1 100644
--- a/drivers/infiniband/sw/rxe/rxe_comp.c
+++ b/drivers/infiniband/sw/rxe/rxe_comp.c
@@ -380,30 +380,35 @@ static inline enum comp_state do_atomic(struct rxe_qp *qp,
 static void make_send_cqe(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
 			  struct rxe_cqe *cqe)
 {
+	struct ib_wc *wc = &cqe->ibwc;
+	struct ib_uverbs_wc *uwc = &cqe->uibwc;
+
 	memset(cqe, 0, sizeof(*cqe));
 
 	if (!qp->is_user) {
-		struct ib_wc		*wc	= &cqe->ibwc;
-
-		wc->wr_id		= wqe->wr.wr_id;
-		wc->status		= wqe->status;
-		wc->opcode		= wr_to_wc_opcode(wqe->wr.opcode);
-		if (wqe->wr.opcode == IB_WR_RDMA_WRITE_WITH_IMM ||
-		    wqe->wr.opcode == IB_WR_SEND_WITH_IMM)
-			wc->wc_flags = IB_WC_WITH_IMM;
-		wc->byte_len		= wqe->dma.length;
-		wc->qp			= &qp->ibqp;
+		wc->wr_id = wqe->wr.wr_id;
+		wc->status = wqe->status;
+		wc->qp = &qp->ibqp;
 	} else {
-		struct ib_uverbs_wc	*uwc	= &cqe->uibwc;
-
-		uwc->wr_id		= wqe->wr.wr_id;
-		uwc->status		= wqe->status;
-		uwc->opcode		= wr_to_wc_opcode(wqe->wr.opcode);
-		if (wqe->wr.opcode == IB_WR_RDMA_WRITE_WITH_IMM ||
-		    wqe->wr.opcode == IB_WR_SEND_WITH_IMM)
-			uwc->wc_flags = IB_WC_WITH_IMM;
-		uwc->byte_len		= wqe->dma.length;
-		uwc->qp_num		= qp->ibqp.qp_num;
+		uwc->wr_id = wqe->wr.wr_id;
+		uwc->status = wqe->status;
+		uwc->qp_num = qp->ibqp.qp_num;
+	}
+
+	if (wqe->status == IB_WC_SUCCESS) {
+		if (!qp->is_user) {
+			wc->opcode = wr_to_wc_opcode(wqe->wr.opcode);
+			if (wqe->wr.opcode == IB_WR_RDMA_WRITE_WITH_IMM ||
+			    wqe->wr.opcode == IB_WR_SEND_WITH_IMM)
+				wc->wc_flags = IB_WC_WITH_IMM;
+			wc->byte_len = wqe->dma.length;
+		} else {
+			uwc->opcode = wr_to_wc_opcode(wqe->wr.opcode);
+			if (wqe->wr.opcode == IB_WR_RDMA_WRITE_WITH_IMM ||
+			    wqe->wr.opcode == IB_WR_SEND_WITH_IMM)
+				uwc->wc_flags = IB_WC_WITH_IMM;
+			uwc->byte_len = wqe->dma.length;
+		}
 	}
 }
 
-- 
2.25.1




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

* [PATCH v4 4/4] RDMA/rxe: Remove duplicate settings
  2021-09-30  9:48 [PATCH v4 0/4] RDMA/rxe: Do some cleanup Xiao Yang
                   ` (2 preceding siblings ...)
  2021-09-30  9:48 ` [PATCH v4 3/4] RDMA/rxe: Set partial attributes when completion status != IBV_WC_SUCCESS Xiao Yang
@ 2021-09-30  9:48 ` Xiao Yang
  2021-10-06 22:46 ` [PATCH v4 0/4] RDMA/rxe: Do some cleanup Jason Gunthorpe
  4 siblings, 0 replies; 6+ messages in thread
From: Xiao Yang @ 2021-09-30  9:48 UTC (permalink / raw)
  To: linux-rdma, jgg; +Cc: rpearsonhpe, zyjzyj2000, leon, Xiao Yang

Remove duplicate settings for vendor_err and qp_num.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
 drivers/infiniband/sw/rxe/rxe_resp.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index 4af0dc95784a..e8f435fa6e4d 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -860,7 +860,6 @@ static enum resp_states do_complete(struct rxe_qp *qp,
 		wc->opcode = (pkt->mask & RXE_IMMDT_MASK &&
 				pkt->mask & RXE_WRITE_MASK) ?
 					IB_WC_RECV_RDMA_WITH_IMM : IB_WC_RECV;
-		wc->vendor_err = 0;
 		wc->byte_len = (pkt->mask & RXE_IMMDT_MASK &&
 				pkt->mask & RXE_WRITE_MASK) ?
 					qp->resp.length : wqe->dma.length - wqe->dma.resid;
@@ -881,8 +880,6 @@ static enum resp_states do_complete(struct rxe_qp *qp,
 				uwc->ex.invalidate_rkey = ieth_rkey(pkt);
 			}
 
-			uwc->qp_num		= qp->ibqp.qp_num;
-
 			if (pkt->mask & RXE_DETH_MASK)
 				uwc->src_qp = deth_sqp(pkt);
 
@@ -914,7 +911,6 @@ static enum resp_states do_complete(struct rxe_qp *qp,
 			if (pkt->mask & RXE_DETH_MASK)
 				wc->src_qp = deth_sqp(pkt);
 
-			wc->qp			= &qp->ibqp;
 			wc->port_num		= qp->attr.port_num;
 		}
 	}
-- 
2.25.1




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

* Re: [PATCH v4 0/4] RDMA/rxe: Do some cleanup
  2021-09-30  9:48 [PATCH v4 0/4] RDMA/rxe: Do some cleanup Xiao Yang
                   ` (3 preceding siblings ...)
  2021-09-30  9:48 ` [PATCH v4 4/4] RDMA/rxe: Remove duplicate settings Xiao Yang
@ 2021-10-06 22:46 ` Jason Gunthorpe
  4 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2021-10-06 22:46 UTC (permalink / raw)
  To: Xiao Yang; +Cc: linux-rdma, rpearsonhpe, zyjzyj2000, leon

On Thu, Sep 30, 2021 at 05:48:09PM +0800, Xiao Yang wrote:
> V3->V4:
> 1) Rebase on the latest for-next branch.
> 2) Remove [PATCH v3 1/5].
> 3) Update [PATCH v3 2/5] to remove the is_user members of
>    struct rxe_sq/rxe_rq/rxe_srq.
> 
> Xiao Yang (4):
>   RDMA/rxe: Remove the is_user members of struct rxe_sq/rxe_rq/rxe_srq
>   RDMA/rxe: Change the is_user member of struct rxe_cq to bool
>   RDMA/rxe: Set partial attributes when completion status !=
>     IBV_WC_SUCCESS
>   RDMA/rxe: Remove duplicate settings

Applied to for-next, thanks

Jason

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

end of thread, other threads:[~2021-10-06 22:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-30  9:48 [PATCH v4 0/4] RDMA/rxe: Do some cleanup Xiao Yang
2021-09-30  9:48 ` [PATCH v4 1/4] RDMA/rxe: Remove the is_user members of struct rxe_sq/rxe_rq/rxe_srq Xiao Yang
2021-09-30  9:48 ` [PATCH v4 2/4] RDMA/rxe: Change the is_user member of struct rxe_cq to bool Xiao Yang
2021-09-30  9:48 ` [PATCH v4 3/4] RDMA/rxe: Set partial attributes when completion status != IBV_WC_SUCCESS Xiao Yang
2021-09-30  9:48 ` [PATCH v4 4/4] RDMA/rxe: Remove duplicate settings Xiao Yang
2021-10-06 22:46 ` [PATCH v4 0/4] RDMA/rxe: Do some cleanup Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.