All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libmlx4 0/2] Misc fixes
@ 2016-03-14 11:47 Noa Osherovich
       [not found] ` <1457956055-2593-1-git-send-email-noaos-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Noa Osherovich @ 2016-03-14 11:47 UTC (permalink / raw)
  To: yishaih-VPRAkNaXOzVWk0Htik3J/w
  Cc: noaos-VPRAkNaXOzVWk0Htik3J/w, linux-rdma-u79uwXL29TY76Z2rM5mHXA

Hi Yishai
This series of patches fixes two issues in libmlx4 as follows.

The first patch fixes a resize CQ issue.
The second patch handles correctly the case when zero
length SGE was provided.

Noa.

Haggai Abramonvsky (1):
  Update consumer index after resize CQ operation

Noa Osherovich (1):
  Handling 0-length sge correctly

 src/cq.c    |  9 ++-------
 src/mlx4.h  | 14 ++++++++++++++
 src/qp.c    |  5 ++++-
 src/verbs.c |  1 +
 4 files changed, 21 insertions(+), 8 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] 4+ messages in thread

* [PATCH libmlx4 1/2] Handling 0-length sge correctly
       [not found] ` <1457956055-2593-1-git-send-email-noaos-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2016-03-14 11:47   ` Noa Osherovich
  2016-03-14 11:47   ` [PATCH libmlx4 2/2] Update consumer index after resize CQ operation Noa Osherovich
  1 sibling, 0 replies; 4+ messages in thread
From: Noa Osherovich @ 2016-03-14 11:47 UTC (permalink / raw)
  To: yishaih-VPRAkNaXOzVWk0Htik3J/w
  Cc: noaos-VPRAkNaXOzVWk0Htik3J/w, linux-rdma-u79uwXL29TY76Z2rM5mHXA

When the driver sees a 0-length sge, it should transform that into a
0-length inline segment entry.

The HW will then will not add any data to the outgoing package when
it encounters that inline entry.

Reviewed-by: Jack Morgenstein <jackm-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 src/mlx4.h | 8 ++++++++
 src/qp.c   | 5 ++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/mlx4.h b/src/mlx4.h
index 519d8f4..f8d2051 100644
--- a/src/mlx4.h
+++ b/src/mlx4.h
@@ -92,6 +92,14 @@ enum {
 	MLX4_STAT_RATE_OFFSET		= 5
 };
 
+#ifndef likely
+#ifdef __GNUC__
+#define likely(x)       __builtin_expect(!!(x),1)
+#else
+#define likely(x)      (x)
+#endif
+#endif
+
 enum {
 	MLX4_QP_TABLE_BITS		= 8,
 	MLX4_QP_TABLE_SIZE		= 1 << MLX4_QP_TABLE_BITS,
diff --git a/src/qp.c b/src/qp.c
index bc2d2e1..05874d2 100644
--- a/src/qp.c
+++ b/src/qp.c
@@ -170,7 +170,10 @@ static void set_data_seg(struct mlx4_wqe_data_seg *dseg, struct ibv_sge *sg)
 	 */
 	wmb();
 
-	dseg->byte_count = htonl(sg->length);
+	if (likely(sg->length))
+		dseg->byte_count = htonl(sg->length);
+	else
+		dseg->byte_count = htonl(0x80000000);
 }
 
 int mlx4_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
-- 
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] 4+ messages in thread

* [PATCH libmlx4 2/2] Update consumer index after resize CQ operation
       [not found] ` <1457956055-2593-1-git-send-email-noaos-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2016-03-14 11:47   ` [PATCH libmlx4 1/2] Handling 0-length sge correctly Noa Osherovich
@ 2016-03-14 11:47   ` Noa Osherovich
       [not found]     ` <1457956055-2593-3-git-send-email-noaos-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Noa Osherovich @ 2016-03-14 11:47 UTC (permalink / raw)
  To: yishaih-VPRAkNaXOzVWk0Htik3J/w
  Cc: noaos-VPRAkNaXOzVWk0Htik3J/w, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Haggai Abramonvsky

From: Haggai Abramonvsky <hagaya-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The resize CQ operation generates a special CQE to indicate that the
resize is done. After consuming this CQE, we need to increment the
consumer index and update the doorbell record in the hardware as well.

Before this patch, we didn't update the doorbell record in the hardware,
which could resulted in CQ overrun.

Signed-off-by: Haggai Abramovsky <hagaya-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 src/cq.c    | 9 ++-------
 src/mlx4.h  | 6 ++++++
 src/verbs.c | 1 +
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/cq.c b/src/cq.c
index 32c9070..0bfbce4 100644
--- a/src/cq.c
+++ b/src/cq.c
@@ -116,11 +116,6 @@ static struct mlx4_cqe *next_cqe_sw(struct mlx4_cq *cq)
 	return get_sw_cqe(cq, cq->cons_index);
 }
 
-static void update_cons_index(struct mlx4_cq *cq)
-{
-	*cq->set_ci_db = htonl(cq->cons_index & 0xffffff);
-}
-
 static void mlx4_handle_error_cqe(struct mlx4_err_cqe *cqe, struct ibv_wc *wc)
 {
 	if (cqe->syndrome == MLX4_CQE_SYNDROME_LOCAL_QP_OP_ERR)
@@ -356,7 +351,7 @@ int mlx4_poll_cq(struct ibv_cq *ibcq, int ne, struct ibv_wc *wc)
 	}
 
 	if (npolled || err == CQ_POLL_ERR)
-		update_cons_index(cq);
+		mlx4_update_cons_index(cq);
 
 	pthread_spin_unlock(&cq->lock);
 
@@ -448,7 +443,7 @@ void __mlx4_cq_clean(struct mlx4_cq *cq, uint32_t qpn, struct mlx4_srq *srq)
 		 * updating consumer index.
 		 */
 		wmb();
-		update_cons_index(cq);
+		mlx4_update_cons_index(cq);
 	}
 }
 
diff --git a/src/mlx4.h b/src/mlx4.h
index f8d2051..53ea4cb 100644
--- a/src/mlx4.h
+++ b/src/mlx4.h
@@ -35,6 +35,7 @@
 #define MLX4_H
 
 #include <stddef.h>
+#include <netinet/in.h>
 
 #include <infiniband/driver.h>
 #include <infiniband/arch.h>
@@ -378,6 +379,11 @@ static inline struct mlx4_ah *to_mah(struct ibv_ah *ibah)
 	return to_mxxx(ah, ah);
 }
 
+static inline void mlx4_update_cons_index(struct mlx4_cq *cq)
+{
+	*cq->set_ci_db = htonl(cq->cons_index & 0xffffff);
+}
+
 int mlx4_alloc_buf(struct mlx4_buf *buf, size_t size, int page_size);
 void mlx4_free_buf(struct mlx4_buf *buf);
 
diff --git a/src/verbs.c b/src/verbs.c
index 2cb1f8a..a4f90bf 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -332,6 +332,7 @@ int mlx4_resize_cq(struct ibv_cq *ibcq, int cqe)
 
 	mlx4_free_buf(&cq->buf);
 	cq->buf = buf;
+	mlx4_update_cons_index(cq);
 
 out:
 	pthread_spin_unlock(&cq->lock);
-- 
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] 4+ messages in thread

* Re: [PATCH libmlx4 2/2] Update consumer index after resize CQ operation
       [not found]     ` <1457956055-2593-3-git-send-email-noaos-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2016-03-14 21:09       ` Or Gerlitz
  0 siblings, 0 replies; 4+ messages in thread
From: Or Gerlitz @ 2016-03-14 21:09 UTC (permalink / raw)
  To: Noa Osherovich, Haggai Abramonvsky
  Cc: Yishai Hadas, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Mon, Mar 14, 2016 at 1:47 PM, Noa Osherovich <noaos-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
> From: Haggai Abramonvsky <hagaya-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> The resize CQ operation generates a special CQE to indicate that the
> resize is done. After consuming this CQE, we need to increment the
> consumer index and update the doorbell record in the hardware as well.
>
> Before this patch, we didn't update the doorbell record in the hardware,
> which could resulted in CQ overrun.
>
> Signed-off-by: Haggai Abramovsky <hagaya-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Someone impersonating the author? different family names?
--
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] 4+ messages in thread

end of thread, other threads:[~2016-03-14 21:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-14 11:47 [PATCH libmlx4 0/2] Misc fixes Noa Osherovich
     [not found] ` <1457956055-2593-1-git-send-email-noaos-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-03-14 11:47   ` [PATCH libmlx4 1/2] Handling 0-length sge correctly Noa Osherovich
2016-03-14 11:47   ` [PATCH libmlx4 2/2] Update consumer index after resize CQ operation Noa Osherovich
     [not found]     ` <1457956055-2593-3-git-send-email-noaos-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-03-14 21:09       ` Or Gerlitz

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.