All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] more i40iw fixes
@ 2017-09-30  1:29 Shiraz Saleem
       [not found] ` <20170930012942.9128-1-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Shiraz Saleem @ 2017-09-30  1:29 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Shiraz Saleem

Hi Doug,

This series includes a few more minor i40iw fixes.

If you deem the submission is too late for 4.14-rc, it is fine
to push it to for-next.

Mustafa Ismail (3):
  i40iw: Do not generate CQE for RTR on QP flush
  i40iw: Add missing memory barriers
  i40iw: Fix port number for query QP

Shiraz Saleem (1):
  i40iw: Do not allow posting WR after QP is flushed

Tatyana Nikolova (1):
  i40iw: Do not retransmit MPA request after it is ACKed

 drivers/infiniband/hw/i40iw/i40iw_cm.c    | 13 ++++++++++---
 drivers/infiniband/hw/i40iw/i40iw_cm.h    |  1 +
 drivers/infiniband/hw/i40iw/i40iw_ctrl.c  |  2 +-
 drivers/infiniband/hw/i40iw/i40iw_p.h     |  2 ++
 drivers/infiniband/hw/i40iw/i40iw_puda.c  | 11 ++++-------
 drivers/infiniband/hw/i40iw/i40iw_uk.c    | 13 +++++++++++++
 drivers/infiniband/hw/i40iw/i40iw_user.h  |  1 +
 drivers/infiniband/hw/i40iw/i40iw_verbs.c | 15 +++++++++++++++
 8 files changed, 47 insertions(+), 11 deletions(-)

-- 
2.8.3

--
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] 10+ messages in thread

* [PATCH 1/5] i40iw: Do not retransmit MPA request after it is ACKed
       [not found] ` <20170930012942.9128-1-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-09-30  1:29   ` Shiraz Saleem
       [not found]     ` <20170930012942.9128-2-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2017-09-30  1:29   ` [PATCH 2/5] i40iw: Do not generate CQE for RTR on QP flush Shiraz Saleem
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Shiraz Saleem @ 2017-09-30  1:29 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Tatyana Nikolova,
	Shiraz Saleem

From: Tatyana Nikolova <tatyana.e.nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

The ACK packets for an MPA request are ignored and
the MPA request is retransmitted if the MPA reply
is late or missing. Fix this by checking ack_rcvd
variable before retransmitting a packet.

Fixes: f27b4746f378 ("i40iw: add connection management code")
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Faisal Latif <faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Shiraz Saleem <shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/i40iw/i40iw_cm.c | 13 ++++++++++---
 drivers/infiniband/hw/i40iw/i40iw_cm.h |  1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c
index 5230dd3..5dbf9f1 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
@@ -1267,13 +1267,16 @@ static void i40iw_cm_timer_tick(unsigned long pass)
 			spin_lock_irqsave(&cm_node->retrans_list_lock, flags);
 			goto done;
 		}
-		cm_node->cm_core->stats_pkt_retrans++;
 		spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags);
 
 		vsi = &cm_node->iwdev->vsi;
 		dev = cm_node->dev;
-		atomic_inc(&send_entry->sqbuf->refcount);
-		i40iw_puda_send_buf(vsi->ilq, send_entry->sqbuf);
+
+		if (!atomic_read(&cm_node->ack_rcvd)) {
+			atomic_inc(&send_entry->sqbuf->refcount);
+			i40iw_puda_send_buf(vsi->ilq, send_entry->sqbuf);
+			cm_node->cm_core->stats_pkt_retrans++;
+		}
 		spin_lock_irqsave(&cm_node->retrans_list_lock, flags);
 		if (send_entry->send_retrans) {
 			send_entry->retranscount--;
@@ -2181,6 +2184,7 @@ static struct i40iw_cm_node *i40iw_make_cm_node(
 	cm_node->cm_id = cm_info->cm_id;
 	ether_addr_copy(cm_node->loc_mac, netdev->dev_addr);
 	spin_lock_init(&cm_node->retrans_list_lock);
+	atomic_set(&cm_node->ack_rcvd, 0);
 
 	atomic_set(&cm_node->ref_count, 1);
 	/* associate our parent CM core */
@@ -2719,7 +2723,10 @@ static int i40iw_handle_ack_pkt(struct i40iw_cm_node *cm_node,
 		cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq);
 		if (datasize) {
 			cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize;
+			atomic_set(&cm_node->ack_rcvd, 0);
 			i40iw_handle_rcv_mpa(cm_node, rbuf);
+		} else {
+			atomic_set(&cm_node->ack_rcvd, 1);
 		}
 		break;
 	case I40IW_CM_STATE_LISTENING:
diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.h b/drivers/infiniband/hw/i40iw/i40iw_cm.h
index 45abef7..7e86b64 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_cm.h
+++ b/drivers/infiniband/hw/i40iw/i40iw_cm.h
@@ -360,6 +360,7 @@ struct i40iw_cm_node {
 
 	u8 pdata_buf[IETF_MAX_PRIV_DATA_LEN];
 	struct i40iw_kmem_info mpa_hdr;
+	atomic_t ack_rcvd;
 };
 
 /* structure for client or CM to fill when making CM api calls. */
-- 
2.8.3

--
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] 10+ messages in thread

* [PATCH 2/5] i40iw: Do not generate CQE for RTR on QP flush
       [not found] ` <20170930012942.9128-1-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2017-09-30  1:29   ` [PATCH 1/5] i40iw: Do not retransmit MPA request after it is ACKed Shiraz Saleem
@ 2017-09-30  1:29   ` Shiraz Saleem
       [not found]     ` <20170930012942.9128-3-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2017-09-30  1:29   ` [PATCH 3/5] i40iw: Do not allow posting WR after QP is flushed Shiraz Saleem
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Shiraz Saleem @ 2017-09-30  1:29 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Mustafa Ismail,
	Shiraz Saleem

From: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

If RTR WQE is posted and QP is flushed, a CQE is
incorrectly generated for the RTR WQE. Add code
to look for the RTR and not generate a CQE when
QP is flushed.

Fixes: 280cfc4b74e6 ("i40iw: user kernel shared files")
Signed-off-by: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Shiraz Saleem <shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/i40iw/i40iw_uk.c   | 13 +++++++++++++
 drivers/infiniband/hw/i40iw/i40iw_user.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_uk.c b/drivers/infiniband/hw/i40iw/i40iw_uk.c
index 0aadb7a..28e6d9e 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_uk.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_uk.c
@@ -821,6 +821,18 @@ static enum i40iw_status_code i40iw_cq_poll_completion(struct i40iw_cq_uk *cq,
 		I40IW_RING_SET_TAIL(qp->rq_ring, array_idx + 1);
 		pring = &qp->rq_ring;
 	} else {
+		if (qp->first_sq_wq) {
+			qp->first_sq_wq = 0;
+			if (!wqe_idx && (qp->sq_ring.head == qp->sq_ring.tail)) {
+				I40IW_RING_MOVE_HEAD_NOCHECK(cq->cq_ring);
+				I40IW_RING_MOVE_TAIL(cq->cq_ring);
+				set_64bit_val(cq->shadow_area, 0,
+					      I40IW_RING_GETCURRENT_HEAD(cq->cq_ring));
+				memset(info, 0, sizeof(struct i40iw_cq_poll_info));
+				return i40iw_cq_poll_completion(cq, info);
+			}
+		}
+
 		if (info->comp_status != I40IW_COMPL_STATUS_FLUSHED) {
 			info->wr_id = qp->sq_wrtrk_array[wqe_idx].wrid;
 			info->bytes_xfered = qp->sq_wrtrk_array[wqe_idx].wr_len;
@@ -988,6 +1000,7 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
 	I40IW_RING_MOVE_TAIL(qp->sq_ring);
 	I40IW_RING_MOVE_HEAD(qp->initial_ring, ret_code);
 	qp->swqe_polarity = 1;
+	qp->first_sq_wq = 1;
 	qp->swqe_polarity_deferred = 1;
 	qp->rwqe_polarity = 0;
 
diff --git a/drivers/infiniband/hw/i40iw/i40iw_user.h b/drivers/infiniband/hw/i40iw/i40iw_user.h
index 84be6f1..995b8eb 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_user.h
+++ b/drivers/infiniband/hw/i40iw/i40iw_user.h
@@ -376,6 +376,7 @@ struct i40iw_qp_uk {
 	u8 rwqe_polarity;
 	u8 rq_wqe_size;
 	u8 rq_wqe_size_multiplier;
+	u8 first_sq_wq;
 	bool deferred_flag;
 };
 
-- 
2.8.3

--
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] 10+ messages in thread

* [PATCH 3/5] i40iw: Do not allow posting WR after QP is flushed
       [not found] ` <20170930012942.9128-1-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2017-09-30  1:29   ` [PATCH 1/5] i40iw: Do not retransmit MPA request after it is ACKed Shiraz Saleem
  2017-09-30  1:29   ` [PATCH 2/5] i40iw: Do not generate CQE for RTR on QP flush Shiraz Saleem
@ 2017-09-30  1:29   ` Shiraz Saleem
  2017-09-30  1:29   ` [PATCH 4/5] i40iw: Add missing memory barriers Shiraz Saleem
  2017-09-30  1:29   ` [PATCH 5/5] i40iw: Fix port number for query QP Shiraz Saleem
  4 siblings, 0 replies; 10+ messages in thread
From: Shiraz Saleem @ 2017-09-30  1:29 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Shiraz Saleem

A Work Request (WR) posted after QP is flushed will not
get a flush completion.

Correct this problem by not allowing posting of WRs
after a QP is flushed.

Fixes: d37498417947 ("i40iw: add files for iwarp interface")
Signed-off-by: Shiraz Saleem <shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/i40iw/i40iw_verbs.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 28b3d02..58d815f 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -2202,6 +2202,12 @@ static int i40iw_post_send(struct ib_qp *ibqp,
 	ukqp = &iwqp->sc_qp.qp_uk;
 
 	spin_lock_irqsave(&iwqp->lock, flags);
+
+	if (iwqp->flush_issued) {
+		err = -EINVAL;
+		goto out;
+	}
+
 	while (ib_wr) {
 		inv_stag = false;
 		memset(&info, 0, sizeof(info));
@@ -2344,6 +2350,7 @@ static int i40iw_post_send(struct ib_qp *ibqp,
 		ib_wr = ib_wr->next;
 	}
 
+out:
 	if (err)
 		*bad_wr = ib_wr;
 	else
@@ -2376,6 +2383,12 @@ static int i40iw_post_recv(struct ib_qp *ibqp,
 
 	memset(&post_recv, 0, sizeof(post_recv));
 	spin_lock_irqsave(&iwqp->lock, flags);
+
+	if (iwqp->flush_issued) {
+		err = -EINVAL;
+		goto out;
+	}
+
 	while (ib_wr) {
 		post_recv.num_sges = ib_wr->num_sge;
 		post_recv.wr_id = ib_wr->wr_id;
-- 
2.8.3

--
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] 10+ messages in thread

* [PATCH 4/5] i40iw: Add missing memory barriers
       [not found] ` <20170930012942.9128-1-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-09-30  1:29   ` [PATCH 3/5] i40iw: Do not allow posting WR after QP is flushed Shiraz Saleem
@ 2017-09-30  1:29   ` Shiraz Saleem
  2017-09-30  1:29   ` [PATCH 5/5] i40iw: Fix port number for query QP Shiraz Saleem
  4 siblings, 0 replies; 10+ messages in thread
From: Shiraz Saleem @ 2017-09-30  1:29 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Mustafa Ismail,
	Shiraz Saleem

From: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Remove duplicate set_64bit_val call to offset 24.
Replace some instances of set_64bit_val with
i40iw_insert_wqe_hdr as valid bit needs a write
barrier and should be the last write operation for the WQE.

Fixes: 786c6adb3a94 ("i40iw: add puda code")
Signed-off-by: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Shiraz Saleem <shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/i40iw/i40iw_ctrl.c |  2 +-
 drivers/infiniband/hw/i40iw/i40iw_p.h    |  2 ++
 drivers/infiniband/hw/i40iw/i40iw_puda.c | 11 ++++-------
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
index d1f5345..42ca534 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
@@ -48,7 +48,7 @@
  * @wqe: cqp wqe for header
  * @header: header for the cqp wqe
  */
-static inline void i40iw_insert_wqe_hdr(u64 *wqe, u64 header)
+void i40iw_insert_wqe_hdr(u64 *wqe, u64 header)
 {
 	wmb();            /* make sure WQE is populated before polarity is set */
 	set_64bit_val(wqe, 24, header);
diff --git a/drivers/infiniband/hw/i40iw/i40iw_p.h b/drivers/infiniband/hw/i40iw/i40iw_p.h
index e217a12..5498ad0 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_p.h
+++ b/drivers/infiniband/hw/i40iw/i40iw_p.h
@@ -59,6 +59,8 @@ enum i40iw_status_code i40iw_sc_mr_fast_register(struct i40iw_sc_qp *qp,
 						 struct i40iw_fast_reg_stag_info *info,
 						 bool post_sq);
 
+void i40iw_insert_wqe_hdr(u64 *wqe, u64 header);
+
 /* HMC/FPM functions */
 enum i40iw_status_code i40iw_sc_init_iw_hmc(struct i40iw_sc_dev *dev,
 					    u8 hmc_fn_id);
diff --git a/drivers/infiniband/hw/i40iw/i40iw_puda.c b/drivers/infiniband/hw/i40iw/i40iw_puda.c
index c2cab20..59f7067 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_puda.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_puda.c
@@ -123,12 +123,11 @@ static void i40iw_puda_post_recvbuf(struct i40iw_puda_rsrc *rsrc, u32 wqe_idx,
 		get_64bit_val(wqe, 24, &offset24);
 
 	offset24 = (offset24) ? 0 : LS_64(1, I40IWQPSQ_VALID);
-	set_64bit_val(wqe, 24, offset24);
 
 	set_64bit_val(wqe, 0, buf->mem.pa);
 	set_64bit_val(wqe, 8,
 		      LS_64(buf->mem.size, I40IWQPSQ_FRAG_LEN));
-	set_64bit_val(wqe, 24, offset24);
+	i40iw_insert_wqe_hdr(wqe, offset24);
 }
 
 /**
@@ -409,9 +408,7 @@ enum i40iw_status_code i40iw_puda_send(struct i40iw_sc_qp *qp,
 	set_64bit_val(wqe, 8, LS_64(info->len, I40IWQPSQ_FRAG_LEN));
 	set_64bit_val(wqe, 16, header[0]);
 
-	/* Ensure all data is written before writing valid bit */
-	wmb();
-	set_64bit_val(wqe, 24, header[1]);
+	i40iw_insert_wqe_hdr(wqe, header[1]);
 
 	i40iw_debug_buf(qp->dev, I40IW_DEBUG_PUDA, "PUDA SEND WQE", wqe, 32);
 	i40iw_qp_post_wr(&qp->qp_uk);
@@ -539,7 +536,7 @@ static enum i40iw_status_code i40iw_puda_qp_wqe(struct i40iw_sc_dev *dev, struct
 		 LS_64(2, I40IW_CQPSQ_QP_NEXTIWSTATE) |
 		 LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID);
 
-	set_64bit_val(wqe, 24, header);
+	i40iw_insert_wqe_hdr(wqe, header);
 
 	i40iw_debug_buf(cqp->dev, I40IW_DEBUG_PUDA, "PUDA CQE", wqe, 32);
 	i40iw_sc_cqp_post_sq(cqp);
@@ -655,7 +652,7 @@ static enum i40iw_status_code i40iw_puda_cq_wqe(struct i40iw_sc_dev *dev, struct
 	    LS_64(1, I40IW_CQPSQ_CQ_ENCEQEMASK) |
 	    LS_64(1, I40IW_CQPSQ_CQ_CEQIDVALID) |
 	    LS_64(cqp->polarity, I40IW_CQPSQ_WQEVALID);
-	set_64bit_val(wqe, 24, header);
+	i40iw_insert_wqe_hdr(wqe, header);
 
 	i40iw_debug_buf(dev, I40IW_DEBUG_PUDA, "PUDA CQE",
 			wqe, I40IW_CQP_WQE_SIZE * 8);
-- 
2.8.3

--
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] 10+ messages in thread

* [PATCH 5/5] i40iw: Fix port number for query QP
       [not found] ` <20170930012942.9128-1-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-09-30  1:29   ` [PATCH 4/5] i40iw: Add missing memory barriers Shiraz Saleem
@ 2017-09-30  1:29   ` Shiraz Saleem
  4 siblings, 0 replies; 10+ messages in thread
From: Shiraz Saleem @ 2017-09-30  1:29 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Mustafa Ismail,
	Shiraz Saleem

From: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Port number 0 is an invalid port number. Set it to 1
as there is one port per i40iw device.

Fixes: d37498417947 ("i40iw: add files for iwarp interface")
Signed-off-by: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Shiraz Saleem <shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 drivers/infiniband/hw/i40iw/i40iw_verbs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
index 58d815f..5c60de6 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -826,12 +826,14 @@ static int i40iw_query_qp(struct ib_qp *ibqp,
 	attr->cap.max_inline_data = I40IW_MAX_INLINE_DATA_SIZE;
 	attr->cap.max_send_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
 	attr->cap.max_recv_sge = I40IW_MAX_WQ_FRAGMENT_COUNT;
+	attr->port_num = 1;
 	init_attr->event_handler = iwqp->ibqp.event_handler;
 	init_attr->qp_context = iwqp->ibqp.qp_context;
 	init_attr->send_cq = iwqp->ibqp.send_cq;
 	init_attr->recv_cq = iwqp->ibqp.recv_cq;
 	init_attr->srq = iwqp->ibqp.srq;
 	init_attr->cap = attr->cap;
+	init_attr->port_num = 1;
 	return 0;
 }
 
-- 
2.8.3

--
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] 10+ messages in thread

* Re: [PATCH 1/5] i40iw: Do not retransmit MPA request after it is ACKed
       [not found]     ` <20170930012942.9128-2-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-10-01  6:16       ` Leon Romanovsky
       [not found]         ` <20171001061609.GC2031-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Leon Romanovsky @ 2017-10-01  6:16 UTC (permalink / raw)
  To: Shiraz Saleem
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Tatyana Nikolova

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

On Fri, Sep 29, 2017 at 08:29:38PM -0500, Shiraz Saleem wrote:
> From: Tatyana Nikolova <tatyana.e.nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
> The ACK packets for an MPA request are ignored and
> the MPA request is retransmitted if the MPA reply
> is late or missing. Fix this by checking ack_rcvd
> variable before retransmitting a packet.
>
> Fixes: f27b4746f378 ("i40iw: add connection management code")
> Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Faisal Latif <faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Shiraz Saleem <shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/infiniband/hw/i40iw/i40iw_cm.c | 13 ++++++++++---
>  drivers/infiniband/hw/i40iw/i40iw_cm.h |  1 +
>  2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c
> index 5230dd3..5dbf9f1 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
> @@ -1267,13 +1267,16 @@ static void i40iw_cm_timer_tick(unsigned long pass)
>  			spin_lock_irqsave(&cm_node->retrans_list_lock, flags);
>  			goto done;
>  		}
> -		cm_node->cm_core->stats_pkt_retrans++;
>  		spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags);
>
>  		vsi = &cm_node->iwdev->vsi;
>  		dev = cm_node->dev;
> -		atomic_inc(&send_entry->sqbuf->refcount);
> -		i40iw_puda_send_buf(vsi->ilq, send_entry->sqbuf);
> +
> +		if (!atomic_read(&cm_node->ack_rcvd)) {
> +			atomic_inc(&send_entry->sqbuf->refcount);
> +			i40iw_puda_send_buf(vsi->ilq, send_entry->sqbuf);
> +			cm_node->cm_core->stats_pkt_retrans++;
> +		}
>  		spin_lock_irqsave(&cm_node->retrans_list_lock, flags);
>  		if (send_entry->send_retrans) {
>  			send_entry->retranscount--;
> @@ -2181,6 +2184,7 @@ static struct i40iw_cm_node *i40iw_make_cm_node(
>  	cm_node->cm_id = cm_info->cm_id;
>  	ether_addr_copy(cm_node->loc_mac, netdev->dev_addr);
>  	spin_lock_init(&cm_node->retrans_list_lock);
> +	atomic_set(&cm_node->ack_rcvd, 0);
>
>  	atomic_set(&cm_node->ref_count, 1);
>  	/* associate our parent CM core */
> @@ -2719,7 +2723,10 @@ static int i40iw_handle_ack_pkt(struct i40iw_cm_node *cm_node,
>  		cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq);
>  		if (datasize) {
>  			cm_node->tcp_cntxt.rcv_nxt = inc_sequence + datasize;
> +			atomic_set(&cm_node->ack_rcvd, 0);
>  			i40iw_handle_rcv_mpa(cm_node, rbuf);
> +		} else {
> +			atomic_set(&cm_node->ack_rcvd, 1);

Sorry, for my lame question, but why do you need atomic to set bool variable?
Atomic doesn't ensure correctness and doesn't replace lock, just ensure
that there is no intermediate result in the memory.

Or proper locking is needed here, or regular bool will do the same trick.

Thanks

>  		}
>  		break;
>  	case I40IW_CM_STATE_LISTENING:
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.h b/drivers/infiniband/hw/i40iw/i40iw_cm.h
> index 45abef7..7e86b64 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_cm.h
> +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.h
> @@ -360,6 +360,7 @@ struct i40iw_cm_node {
>
>  	u8 pdata_buf[IETF_MAX_PRIV_DATA_LEN];
>  	struct i40iw_kmem_info mpa_hdr;
> +	atomic_t ack_rcvd;
>  };
>
>  /* structure for client or CM to fill when making CM api calls. */
> --
> 2.8.3
>
> --
> 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

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

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

* Re: [PATCH 2/5] i40iw: Do not generate CQE for RTR on QP flush
       [not found]     ` <20170930012942.9128-3-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2017-10-01  6:19       ` Leon Romanovsky
       [not found]         ` <20171001061928.GD2031-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Leon Romanovsky @ 2017-10-01  6:19 UTC (permalink / raw)
  To: Shiraz Saleem
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Mustafa Ismail

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

On Fri, Sep 29, 2017 at 08:29:39PM -0500, Shiraz Saleem wrote:
> From: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
> If RTR WQE is posted and QP is flushed, a CQE is
> incorrectly generated for the RTR WQE. Add code
> to look for the RTR and not generate a CQE when
> QP is flushed.
>
> Fixes: 280cfc4b74e6 ("i40iw: user kernel shared files")
> Signed-off-by: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Shiraz Saleem <shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/infiniband/hw/i40iw/i40iw_uk.c   | 13 +++++++++++++
>  drivers/infiniband/hw/i40iw/i40iw_user.h |  1 +
>  2 files changed, 14 insertions(+)
>
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_uk.c b/drivers/infiniband/hw/i40iw/i40iw_uk.c
> index 0aadb7a..28e6d9e 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_uk.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_uk.c
> @@ -821,6 +821,18 @@ static enum i40iw_status_code i40iw_cq_poll_completion(struct i40iw_cq_uk *cq,
>  		I40IW_RING_SET_TAIL(qp->rq_ring, array_idx + 1);
>  		pring = &qp->rq_ring;
>  	} else {
> +		if (qp->first_sq_wq) {
> +			qp->first_sq_wq = 0;
> +			if (!wqe_idx && (qp->sq_ring.head == qp->sq_ring.tail)) {
> +				I40IW_RING_MOVE_HEAD_NOCHECK(cq->cq_ring);
> +				I40IW_RING_MOVE_TAIL(cq->cq_ring);
> +				set_64bit_val(cq->shadow_area, 0,
> +					      I40IW_RING_GETCURRENT_HEAD(cq->cq_ring));
> +				memset(info, 0, sizeof(struct i40iw_cq_poll_info));
> +				return i40iw_cq_poll_completion(cq, info);
> +			}
> +		}
> +
>  		if (info->comp_status != I40IW_COMPL_STATUS_FLUSHED) {
>  			info->wr_id = qp->sq_wrtrk_array[wqe_idx].wrid;
>  			info->bytes_xfered = qp->sq_wrtrk_array[wqe_idx].wr_len;
> @@ -988,6 +1000,7 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
>  	I40IW_RING_MOVE_TAIL(qp->sq_ring);
>  	I40IW_RING_MOVE_HEAD(qp->initial_ring, ret_code);
>  	qp->swqe_polarity = 1;
> +	qp->first_sq_wq = 1;
>  	qp->swqe_polarity_deferred = 1;
>  	qp->rwqe_polarity = 0;
>
> diff --git a/drivers/infiniband/hw/i40iw/i40iw_user.h b/drivers/infiniband/hw/i40iw/i40iw_user.h
> index 84be6f1..995b8eb 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_user.h
> +++ b/drivers/infiniband/hw/i40iw/i40iw_user.h
> @@ -376,6 +376,7 @@ struct i40iw_qp_uk {
>  	u8 rwqe_polarity;
>  	u8 rq_wqe_size;
>  	u8 rq_wqe_size_multiplier;
> +	u8 first_sq_wq;

Isn't this supposed to be "bool" and not "u8"?

Thanks

>  	bool deferred_flag;
>  };
>
> --
> 2.8.3
>
> --
> 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

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

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

* RE: [PATCH 2/5] i40iw: Do not generate CQE for RTR on QP flush
       [not found]         ` <20171001061928.GD2031-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-10-02 15:12           ` Ismail, Mustafa
  0 siblings, 0 replies; 10+ messages in thread
From: Ismail, Mustafa @ 2017-10-02 15:12 UTC (permalink / raw)
  To: Leon Romanovsky, Saleem, Shiraz
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

> Subject: Re: [PATCH 2/5] i40iw: Do not generate CQE for RTR on QP flush
> 
> On Fri, Sep 29, 2017 at 08:29:39PM -0500, Shiraz Saleem wrote:
> > From: Mustafa Ismail <mustafa.ismail-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> >
> > If RTR WQE is posted and QP is flushed, a CQE is incorrectly generated
> > for the RTR WQE. Add code to look for the RTR and not generate a CQE
> > when QP is flushed.
> >
> > +	u8 first_sq_wq;
> 
> Isn't this supposed to be "bool" and not "u8"?
Agreed. We will send a V2.

Thanks.

--
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] 10+ messages in thread

* RE: [PATCH 1/5] i40iw: Do not retransmit MPA request after it is ACKed
       [not found]         ` <20171001061609.GC2031-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-10-03  3:34           ` Nikolova, Tatyana E
  0 siblings, 0 replies; 10+ messages in thread
From: Nikolova, Tatyana E @ 2017-10-03  3:34 UTC (permalink / raw)
  To: Leon Romanovsky, Saleem, Shiraz
  Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	e1000-rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f



> -----Original Message-----
> From: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [mailto:linux-rdma-
> owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org] On Behalf Of Leon Romanovsky
> Sent: Sunday, October 01, 2017 1:16 AM
> To: Saleem, Shiraz <shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org; linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; e1000-
> rdma-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org; Nikolova, Tatyana E
> <tatyana.e.nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Subject: Re: [PATCH 1/5] i40iw: Do not retransmit MPA request after it is
> ACKed
> 
> On Fri, Sep 29, 2017 at 08:29:38PM -0500, Shiraz Saleem wrote:
> > From: Tatyana Nikolova <tatyana.e.nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> >
> > The ACK packets for an MPA request are ignored and the MPA request is
> > retransmitted if the MPA reply is late or missing. Fix this by
> > checking ack_rcvd variable before retransmitting a packet.
> >
> > Fixes: f27b4746f378 ("i40iw: add connection management code")
> > Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Signed-off-by: Faisal Latif <faisal.latif-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Signed-off-by: Shiraz Saleem <shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > ---
> >  drivers/infiniband/hw/i40iw/i40iw_cm.c | 13 ++++++++++---
> > drivers/infiniband/hw/i40iw/i40iw_cm.h |  1 +
> >  2 files changed, 11 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c
> > b/drivers/infiniband/hw/i40iw/i40iw_cm.c
> > index 5230dd3..5dbf9f1 100644
> > --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
> > +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
> > @@ -1267,13 +1267,16 @@ static void i40iw_cm_timer_tick(unsigned long
> pass)
> >  			spin_lock_irqsave(&cm_node->retrans_list_lock,
> flags);
> >  			goto done;
> >  		}
> > -		cm_node->cm_core->stats_pkt_retrans++;
> >  		spin_unlock_irqrestore(&cm_node->retrans_list_lock, flags);
> >
> >  		vsi = &cm_node->iwdev->vsi;
> >  		dev = cm_node->dev;
> > -		atomic_inc(&send_entry->sqbuf->refcount);
> > -		i40iw_puda_send_buf(vsi->ilq, send_entry->sqbuf);
> > +
> > +		if (!atomic_read(&cm_node->ack_rcvd)) {
> > +			atomic_inc(&send_entry->sqbuf->refcount);
> > +			i40iw_puda_send_buf(vsi->ilq, send_entry->sqbuf);
> > +			cm_node->cm_core->stats_pkt_retrans++;
> > +		}
> >  		spin_lock_irqsave(&cm_node->retrans_list_lock, flags);
> >  		if (send_entry->send_retrans) {
> >  			send_entry->retranscount--;
> > @@ -2181,6 +2184,7 @@ static struct i40iw_cm_node
> *i40iw_make_cm_node(
> >  	cm_node->cm_id = cm_info->cm_id;
> >  	ether_addr_copy(cm_node->loc_mac, netdev->dev_addr);
> >  	spin_lock_init(&cm_node->retrans_list_lock);
> > +	atomic_set(&cm_node->ack_rcvd, 0);
> >
> >  	atomic_set(&cm_node->ref_count, 1);
> >  	/* associate our parent CM core */
> > @@ -2719,7 +2723,10 @@ static int i40iw_handle_ack_pkt(struct
> i40iw_cm_node *cm_node,
> >  		cm_node->tcp_cntxt.rem_ack_num = ntohl(tcph->ack_seq);
> >  		if (datasize) {
> >  			cm_node->tcp_cntxt.rcv_nxt = inc_sequence +
> datasize;
> > +			atomic_set(&cm_node->ack_rcvd, 0);
> >  			i40iw_handle_rcv_mpa(cm_node, rbuf);
> > +		} else {
> > +			atomic_set(&cm_node->ack_rcvd, 1);
> 
> Sorry, for my lame question, but why do you need atomic to set bool
> variable?
> Atomic doesn't ensure correctness and doesn't replace lock, just ensure that
> there is no intermediate result in the memory.
> 
> Or proper locking is needed here, or regular bool will do the same trick.
> 
> Thanks

Hi Leon,

Thank you for the feedback. A regular bool is sufficient in this case. We are going to send a V2 patch.

Tatyana
> 
> >  		}
> >  		break;
> >  	case I40IW_CM_STATE_LISTENING:
> > diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.h
> > b/drivers/infiniband/hw/i40iw/i40iw_cm.h
> > index 45abef7..7e86b64 100644
> > --- a/drivers/infiniband/hw/i40iw/i40iw_cm.h
> > +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.h
> > @@ -360,6 +360,7 @@ struct i40iw_cm_node {
> >
> >  	u8 pdata_buf[IETF_MAX_PRIV_DATA_LEN];
> >  	struct i40iw_kmem_info mpa_hdr;
> > +	atomic_t ack_rcvd;
> >  };
> >
> >  /* structure for client or CM to fill when making CM api calls. */
> > --
> > 2.8.3
> >
> > --
> > 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
--
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] 10+ messages in thread

end of thread, other threads:[~2017-10-03  3:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-30  1:29 [PATCH 0/5] more i40iw fixes Shiraz Saleem
     [not found] ` <20170930012942.9128-1-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-09-30  1:29   ` [PATCH 1/5] i40iw: Do not retransmit MPA request after it is ACKed Shiraz Saleem
     [not found]     ` <20170930012942.9128-2-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-10-01  6:16       ` Leon Romanovsky
     [not found]         ` <20171001061609.GC2031-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-03  3:34           ` Nikolova, Tatyana E
2017-09-30  1:29   ` [PATCH 2/5] i40iw: Do not generate CQE for RTR on QP flush Shiraz Saleem
     [not found]     ` <20170930012942.9128-3-shiraz.saleem-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-10-01  6:19       ` Leon Romanovsky
     [not found]         ` <20171001061928.GD2031-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-10-02 15:12           ` Ismail, Mustafa
2017-09-30  1:29   ` [PATCH 3/5] i40iw: Do not allow posting WR after QP is flushed Shiraz Saleem
2017-09-30  1:29   ` [PATCH 4/5] i40iw: Add missing memory barriers Shiraz Saleem
2017-09-30  1:29   ` [PATCH 5/5] i40iw: Fix port number for query QP Shiraz Saleem

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.