diff mbox

[1/2] libmlx4: initialize SRQ scatter entries when creating an SRQ

Message ID 200912171715.40630.jackm@dev.mellanox.co.il (mailing list archive)
State Accepted, archived
Headers show

Commit Message

jackm Dec. 17, 2009, 3:15 p.m. UTC
None
diff mbox

Patch

diff --git a/src/srq.c b/src/srq.c
index ba2ceb9..f1d1240 100644
--- a/src/srq.c
+++ b/src/srq.c
@@ -128,6 +128,7 @@  int mlx4_alloc_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
 		       struct mlx4_srq *srq)
 {
 	struct mlx4_wqe_srq_next_seg *next;
+	struct mlx4_wqe_data_seg *scatter;
 	int size;
 	int buf_size;
 	int i;
@@ -160,6 +161,11 @@  int mlx4_alloc_srq_buf(struct ibv_pd *pd, struct ibv_srq_attr *attr,
 	for (i = 0; i < srq->max; ++i) {
 		next = get_wqe(srq, i);
 		next->next_wqe_index = htons((i + 1) & (srq->max - 1));
+
+		for (scatter = (void *) (next + 1);
+		     (void *) scatter < (void *) next + (1 << srq->wqe_shift);
+		     ++scatter)
+			scatter->lkey = htonl(MLX4_INVALID_LKEY);
 	}
 
 	srq->head = 0;