public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [rdma-core 0/4] libqedr: cumulative updates and fixes
@ 2017-04-27  6:11 Ram Amrani
       [not found] ` <1493273468-23774-1-git-send-email-Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Ram Amrani @ 2017-04-27  6:11 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, leon-DgEjT+Ai2ygdnm+yROfE0A,
	jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/
  Cc: Ariel.Elior-YGCgFSpz5w/QT0dZR+AlfA,
	Michal.Kalderon-YGCgFSpz5w/QT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Ram Amrani

This patch series includes a couple of updates and a couple of fixes.

Ram Amrani (4):
  libqedr: remove obsolete device IDs
  libqedr: fail post_send on WR overflow
  libqedr: fix comments and alignment in verbs file
  libqedr: prevent EDPM loopback

 providers/qedr/qelr.h       |  1 +
 providers/qedr/qelr_main.c  | 10 ++-----
 providers/qedr/qelr_verbs.c | 71 ++++++++++++++++++++++++++++++++++++---------
 3 files changed, 61 insertions(+), 21 deletions(-)

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [rdma-core 1/4] libqedr: remove obsolete device IDs
       [not found] ` <1493273468-23774-1-git-send-email-Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
@ 2017-04-27  6:11   ` Ram Amrani
  2017-04-27  6:11   ` [rdma-core 2/4] libqedr: fail post_send on WR overflow Ram Amrani
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ram Amrani @ 2017-04-27  6:11 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, leon-DgEjT+Ai2ygdnm+yROfE0A,
	jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/
  Cc: Ariel.Elior-YGCgFSpz5w/QT0dZR+AlfA,
	Michal.Kalderon-YGCgFSpz5w/QT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Ram Amrani

The removed device IDs were never actually used.
Signed-off-by: Ram Amrani <Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
---
 providers/qedr/qelr_main.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/providers/qedr/qelr_main.c b/providers/qedr/qelr_main.c
index ba70db9..9f3feda 100644
--- a/providers/qedr/qelr_main.c
+++ b/providers/qedr/qelr_main.c
@@ -58,10 +58,7 @@
 #define PCI_DEVICE_ID_QLOGIC_57980S_50  (0x1654)
 #define PCI_DEVICE_ID_QLOGIC_57980S_25  (0x1656)
 #define PCI_DEVICE_ID_QLOGIC_57980S_IOV (0x1664)
-#define PCI_DEVICE_ID_QLOGIC_AH_50G     (0x8070)
-#define PCI_DEVICE_ID_QLOGIC_AH_10G     (0x8071)
-#define PCI_DEVICE_ID_QLOGIC_AH_40G     (0x8072)
-#define PCI_DEVICE_ID_QLOGIC_AH_25G     (0x8073)
+#define PCI_DEVICE_ID_QLOGIC_AH         (0x8070)
 #define PCI_DEVICE_ID_QLOGIC_AH_IOV     (0x8090)
 
 uint32_t qelr_dp_level;
@@ -83,10 +80,7 @@ static const struct {
 	QHCA(57980S_50),
 	QHCA(57980S_25),
 	QHCA(57980S_IOV),
-	QHCA(AH_50G),
-	QHCA(AH_10G),
-	QHCA(AH_40G),
-	QHCA(AH_25G),
+	QHCA(AH),
 	QHCA(AH_IOV),
 };
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [rdma-core 2/4] libqedr: fail post_send on WR overflow
       [not found] ` <1493273468-23774-1-git-send-email-Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
  2017-04-27  6:11   ` [rdma-core 1/4] libqedr: remove obsolete device IDs Ram Amrani
@ 2017-04-27  6:11   ` Ram Amrani
  2017-04-27  6:11   ` [rdma-core 3/4] libqedr: fix comments and alignment in verbs file Ram Amrani
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ram Amrani @ 2017-04-27  6:11 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, leon-DgEjT+Ai2ygdnm+yROfE0A,
	jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/
  Cc: Ariel.Elior-YGCgFSpz5w/QT0dZR+AlfA,
	Michal.Kalderon-YGCgFSpz5w/QT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Ram Amrani

Post send will fail if it is full, thus preventing an overflow.
Signed-off-by: Ram Amrani <Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
---
 providers/qedr/qelr_verbs.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/providers/qedr/qelr_verbs.c b/providers/qedr/qelr_verbs.c
index 8d94a12..7419540 100644
--- a/providers/qedr/qelr_verbs.c
+++ b/providers/qedr/qelr_verbs.c
@@ -70,6 +70,11 @@ static void qelr_inc_sw_prod_u16(struct qelr_qp_hwq_info *info)
 	info->prod = (info->prod + 1) % info->max_wr;
 }
 
+static inline int qelr_wq_is_full(struct qelr_qp_hwq_info *info)
+{
+	return (((info->prod + 1) % info->max_wr) == info->cons);
+}
+
 int qelr_query_device(struct ibv_context *context,
 		      struct ibv_device_attr *attr)
 {
@@ -1144,6 +1149,14 @@ static inline int qelr_can_post_send(struct qelr_devctx *cxt,
 		return -EINVAL;
 	}
 
+	/* WR overflow */
+	if (qelr_wq_is_full(&qp->sq)) {
+		DP_ERR(cxt->dbg_fp,
+		       "error: WQ is full. Post send on QP %p failed (this error appears only once)\n",
+		       qp);
+		return -ENOMEM;
+	}
+
 	/* WQE overflow */
 	if (qelr_chain_get_elem_left_u32(&qp->sq.chain) <
 			QELR_MAX_SQ_WQE_SIZE) {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [rdma-core 3/4] libqedr: fix comments and alignment in verbs file
       [not found] ` <1493273468-23774-1-git-send-email-Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
  2017-04-27  6:11   ` [rdma-core 1/4] libqedr: remove obsolete device IDs Ram Amrani
  2017-04-27  6:11   ` [rdma-core 2/4] libqedr: fail post_send on WR overflow Ram Amrani
@ 2017-04-27  6:11   ` Ram Amrani
  2017-04-27  6:11   ` [rdma-core 4/4] libqedr: prevent EDPM loopback Ram Amrani
  2017-04-27  8:44   ` [rdma-core 0/4] libqedr: cumulative updates and fixes Leon Romanovsky
  4 siblings, 0 replies; 6+ messages in thread
From: Ram Amrani @ 2017-04-27  6:11 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, leon-DgEjT+Ai2ygdnm+yROfE0A,
	jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/
  Cc: Ariel.Elior-YGCgFSpz5w/QT0dZR+AlfA,
	Michal.Kalderon-YGCgFSpz5w/QT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Ram Amrani

Signed-off-by: Ram Amrani <Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
---
 providers/qedr/qelr_verbs.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/providers/qedr/qelr_verbs.c b/providers/qedr/qelr_verbs.c
index 7419540..375664b 100644
--- a/providers/qedr/qelr_verbs.c
+++ b/providers/qedr/qelr_verbs.c
@@ -349,7 +349,7 @@ static inline int qelr_create_qp_buffers_sq(struct qelr_devctx *cxt,
 	rc = qelr_chain_alloc(&qp->sq.chain, chain_size, cxt->kernel_page_size,
 			      QELR_SQE_ELEMENT_SIZE);
 	if (rc)
-		DP_ERR(cxt->dbg_fp, "create qp: failed to map SQ, got %d", rc);
+		DP_ERR(cxt->dbg_fp, "create qp: failed to map SQ chain, got %d", rc);
 
 	qp->sq.max_wr = max_send_wr;
 	qp->sq.max_sges = cxt->sges_per_send_wr;
@@ -376,7 +376,7 @@ static inline int qelr_create_qp_buffers_rq(struct qelr_devctx *cxt,
 	rc = qelr_chain_alloc(&qp->rq.chain, chain_size, cxt->kernel_page_size,
 			      QELR_RQE_ELEMENT_SIZE);
 	if (rc)
-		DP_ERR(cxt->dbg_fp, "create qp: failed to map RQ, got %d", rc);
+		DP_ERR(cxt->dbg_fp, "create qp: failed to map RQ chain, got %d", rc);
 
 	qp->rq.max_wr = max_recv_wr;
 	qp->rq.max_sges = cxt->sges_per_recv_wr;
@@ -419,7 +419,7 @@ static inline int qelr_configure_qp_sq(struct qelr_devctx *cxt,
 	qp->wqe_wr_id = calloc(qp->sq.max_wr, sizeof(*qp->wqe_wr_id));
 	if (!qp->wqe_wr_id) {
 		DP_ERR(cxt->dbg_fp,
-		       "create qp: failed shdow SQ memory allocation\n");
+		       "create qp: failed shadow SQ memory allocation\n");
 		return -ENOMEM;
 	}
 	return 0;
@@ -441,7 +441,7 @@ static inline int qelr_configure_qp_rq(struct qelr_devctx *cxt,
 	qp->rqe_wr_id = calloc(qp->rq.max_wr, sizeof(*qp->rqe_wr_id));
 	if (!qp->rqe_wr_id) {
 		DP_ERR(cxt->dbg_fp,
-		       "create qp: failed shdow RQ memory allocation\n");
+		       "create qp: failed shadow RQ memory allocation\n");
 		return -ENOMEM;
 	}
 
@@ -1600,13 +1600,13 @@ static int qelr_poll_cq_req(struct qelr_qp *qp, struct qelr_cq *cq,
 			enum ibv_wc_status wc_status;
 
 			switch (req->status) {
-			case	RDMA_CQE_REQ_STS_BAD_RESPONSE_ERR:
+			case    RDMA_CQE_REQ_STS_BAD_RESPONSE_ERR:
 				DP_ERR(cxt->dbg_fp,
 				       "Error: POLL CQ with RDMA_CQE_REQ_STS_BAD_RESPONSE_ERR. QP icid=0x%x\n",
 				       qp->sq.icid);
 				wc_status = IBV_WC_BAD_RESP_ERR;
 				break;
-			case	RDMA_CQE_REQ_STS_LOCAL_LENGTH_ERR:
+			case    RDMA_CQE_REQ_STS_LOCAL_LENGTH_ERR:
 				DP_ERR(cxt->dbg_fp,
 				       "Error: POLL CQ with RDMA_CQE_REQ_STS_LOCAL_LENGTH_ERR. QP icid=0x%x\n",
 				       qp->sq.icid);
@@ -1663,7 +1663,7 @@ static int qelr_poll_cq_req(struct qelr_qp *qp, struct qelr_cq *cq,
 			default:
 				DP_ERR(cxt->dbg_fp,
 				       "IBV_WC_GENERAL_ERR. QP icid=0x%x\n",
-					qp->sq.icid);
+				       qp->sq.icid);
 				wc_status = IBV_WC_GENERAL_ERR;
 			}
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [rdma-core 4/4] libqedr: prevent EDPM loopback
       [not found] ` <1493273468-23774-1-git-send-email-Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-04-27  6:11   ` [rdma-core 3/4] libqedr: fix comments and alignment in verbs file Ram Amrani
@ 2017-04-27  6:11   ` Ram Amrani
  2017-04-27  8:44   ` [rdma-core 0/4] libqedr: cumulative updates and fixes Leon Romanovsky
  4 siblings, 0 replies; 6+ messages in thread
From: Ram Amrani @ 2017-04-27  6:11 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA, leon-DgEjT+Ai2ygdnm+yROfE0A,
	jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/
  Cc: Ariel.Elior-YGCgFSpz5w/QT0dZR+AlfA,
	Michal.Kalderon-YGCgFSpz5w/QT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, Ram Amrani

HW doesn't support EDPM loopback. Hence disable EDPM if this is
a loopback QP.

Signed-off-by: Ram Amrani <Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
---
 providers/qedr/qelr.h       |  1 +
 providers/qedr/qelr_verbs.c | 44 ++++++++++++++++++++++++++++++++++++++------
 2 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/providers/qedr/qelr.h b/providers/qedr/qelr.h
index b5310b5..0dd6835 100644
--- a/providers/qedr/qelr.h
+++ b/providers/qedr/qelr.h
@@ -243,6 +243,7 @@ struct qelr_qp {
 	uint32_t				qp_id;
 	int					sq_sig_all;
 	int					atomic_supported;
+	uint8_t					edpm_disabled;
 };
 
 static inline struct qelr_devctx *get_qelr_ctx(struct ibv_context *ibctx)
diff --git a/providers/qedr/qelr_verbs.c b/providers/qedr/qelr_verbs.c
index 375664b..676b18c 100644
--- a/providers/qedr/qelr_verbs.c
+++ b/providers/qedr/qelr_verbs.c
@@ -768,6 +768,7 @@ int qelr_modify_qp(struct ibv_qp *ibqp, struct ibv_qp_attr *attr,
 	struct ibv_modify_qp cmd = {};
 	struct qelr_qp *qp = get_qelr_qp(ibqp);
 	struct qelr_devctx *cxt = get_qelr_ctx(ibqp->context);
+	union ibv_gid sgid, *p_dgid;
 	int rc;
 
 	DP_VERBOSE(cxt->dbg_fp, QELR_MSG_QP, "QP Modify %p, attr_mask=0x%x\n",
@@ -776,14 +777,45 @@ int qelr_modify_qp(struct ibv_qp *ibqp, struct ibv_qp_attr *attr,
 	qelr_print_qp_attr(cxt, attr);
 
 	rc = ibv_cmd_modify_qp(ibqp, attr, attr_mask, &cmd, sizeof(cmd));
+	if (rc) {
+		DP_ERR(cxt->dbg_fp, "QP Modify: Failed command. rc=%d\n", rc);
+		return rc;
+	}
 
-	if (!rc && (attr_mask & IBV_QP_STATE)) {
-		DP_VERBOSE(cxt->dbg_fp, QELR_MSG_QP, "QP Modify state %d->%d\n",
-			   qp->state, attr->qp_state);
-		qelr_update_qp_state(qp, attr->qp_state);
+	if (attr_mask & IBV_QP_STATE) {
+		rc = qelr_update_qp_state(qp, attr->qp_state);
+		DP_VERBOSE(cxt->dbg_fp, QELR_MSG_QP,
+			   "QP Modify state %d->%d, rc=%d\n", qp->state,
+			   attr->qp_state, rc);
+		if (rc) {
+			DP_ERR(cxt->dbg_fp,
+			       "QP Modify: Failed to update state. rc=%d\n",
+			       rc);
+
+			return rc;
+		}
 	}
 
-	return rc;
+	/* EDPM must be disabled if GIDs match */
+	if (attr_mask & IBV_QP_AV) {
+		rc = ibv_query_gid(ibqp->context, attr->ah_attr.port_num,
+				   attr->ah_attr.grh.sgid_index, &sgid);
+
+		if (!rc) {
+			p_dgid = &attr->ah_attr.grh.dgid;
+			qp->edpm_disabled = !memcmp(&sgid, p_dgid,
+						    sizeof(sgid));
+			DP_VERBOSE(cxt->dbg_fp, QELR_MSG_QP,
+				   "QP Modify: %p, edpm_disabled=%d\n", qp,
+				   qp->edpm_disabled);
+		} else  {
+			DP_ERR(cxt->dbg_fp,
+			       "QP Modify: Failed querying GID. rc=%d\n",
+			       rc);
+		}
+	}
+
+	return 0;
 }
 
 int qelr_destroy_qp(struct ibv_qp *ibqp)
@@ -839,7 +871,7 @@ static inline void qelr_init_edpm_info(struct qelr_devctx *cxt,
 	edpm->is_edpm = 0;
 
 	if (qelr_chain_is_full(&qp->sq.chain) &&
-	    wr->send_flags & IBV_SEND_INLINE) {
+	    wr->send_flags & IBV_SEND_INLINE && !qp->edpm_disabled) {
 		memset(edpm, 0, sizeof(*edpm));
 		edpm->rdma_ext = (struct qelr_rdma_ext *)&edpm->dpm_payload;
 		edpm->is_edpm = 1;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [rdma-core 0/4] libqedr: cumulative updates and fixes
       [not found] ` <1493273468-23774-1-git-send-email-Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-04-27  6:11   ` [rdma-core 4/4] libqedr: prevent EDPM loopback Ram Amrani
@ 2017-04-27  8:44   ` Leon Romanovsky
  4 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2017-04-27  8:44 UTC (permalink / raw)
  To: Ram Amrani
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/,
	Ariel.Elior-YGCgFSpz5w/QT0dZR+AlfA,
	Michal.Kalderon-YGCgFSpz5w/QT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 564 bytes --]

On Thu, Apr 27, 2017 at 09:11:04AM +0300, Ram Amrani wrote:
> This patch series includes a couple of updates and a couple of fixes.
>
> Ram Amrani (4):
>   libqedr: remove obsolete device IDs
>   libqedr: fail post_send on WR overflow
>   libqedr: fix comments and alignment in verbs file
>   libqedr: prevent EDPM loopback
>
>  providers/qedr/qelr.h       |  1 +
>  providers/qedr/qelr_main.c  | 10 ++-----
>  providers/qedr/qelr_verbs.c | 71 ++++++++++++++++++++++++++++++++++++---------
>  3 files changed, 61 insertions(+), 21 deletions(-)
>

Thanks, applied.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-04-27  8:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-27  6:11 [rdma-core 0/4] libqedr: cumulative updates and fixes Ram Amrani
     [not found] ` <1493273468-23774-1-git-send-email-Ram.Amrani-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
2017-04-27  6:11   ` [rdma-core 1/4] libqedr: remove obsolete device IDs Ram Amrani
2017-04-27  6:11   ` [rdma-core 2/4] libqedr: fail post_send on WR overflow Ram Amrani
2017-04-27  6:11   ` [rdma-core 3/4] libqedr: fix comments and alignment in verbs file Ram Amrani
2017-04-27  6:11   ` [rdma-core 4/4] libqedr: prevent EDPM loopback Ram Amrani
2017-04-27  8:44   ` [rdma-core 0/4] libqedr: cumulative updates and fixes Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox